Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable external viewer buttons until data are available. #173

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 19 additions & 6 deletions src/dui/error_loading_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,19 +48,32 @@ def setupUi(self, LoadErrorDialog):

self.verticalLayout.addWidget(self.buttonBox)


self.gridLayout.addLayout(self.verticalLayout, 0, 0, 1, 1)


self.retranslateUi(LoadErrorDialog)
self.buttonBox.rejected.connect(LoadErrorDialog.close)

QMetaObject.connectSlotsByName(LoadErrorDialog)

# setupUi

def retranslateUi(self, LoadErrorDialog):
LoadErrorDialog.setWindowTitle(QCoreApplication.translate("LoadErrorDialog", u"Error loading DUI", None))
self.label.setText(QCoreApplication.translate("LoadErrorDialog", u"An unexpected error occured whilst loading your previous DUI workspace:", None))
self.label_2.setText(QCoreApplication.translate("LoadErrorDialog", u"<html><head/><body><p>Please report this error to <a href=\"mailto:dials-support@lists.sourceforge.net\"><span style=\" text-decoration: underline; color:#0000ff;\">dials-support@lists.sourceforge.net</span></a>.</p><p>Please move or remove the <tt>dui-files/</tt> subfolder or change your working directory to continue.</p></body></html>", None))
# retranslateUi
LoadErrorDialog.setWindowTitle(
QCoreApplication.translate("LoadErrorDialog", u"Error loading DUI", None)
)
self.label.setText(
QCoreApplication.translate(
"LoadErrorDialog",
u"An unexpected error occured whilst loading your previous DUI workspace:",
None,
)
)
self.label_2.setText(
QCoreApplication.translate(
"LoadErrorDialog",
u'<html><head/><body><p>Please report this error to <a href="mailto:dials-support@lists.sourceforge.net"><span style=" text-decoration: underline; color:#0000ff;">dials-support@lists.sourceforge.net</span></a>.</p><p>Please move or remove the <tt>dui-files/</tt> subfolder or change your working directory to continue.</p></body></html>',
None,
)
)

# retranslateUi
21 changes: 14 additions & 7 deletions src/dui/gui_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -723,13 +723,15 @@ def __init__(self):

v_box = QVBoxLayout()

recip_lat_but = QPushButton("\n Open reciprocal lattice viewer \n")
recip_lat_but.clicked.connect(self.run_recip_dialg)
v_box.addWidget(recip_lat_but)
self.recip_lat_but = QPushButton("\n Open reciprocal lattice viewer \n")
self.recip_lat_but.clicked.connect(self.run_recip_dialg)
self.recip_lat_but.setEnabled(False)
v_box.addWidget(self.recip_lat_but)

img_but = QPushButton("\n Open image viewer \n")
img_but.clicked.connect(self.run_img_dialg)
v_box.addWidget(img_but)
self.img_but = QPushButton("\n Open image viewer \n")
self.img_but.clicked.connect(self.run_img_dialg)
self.img_but.setEnabled(False)
v_box.addWidget(self.img_but)

self.diag = ExternalProcDialog(parent=self.window())
self.setLayout(v_box)
Expand All @@ -739,6 +741,11 @@ def update_data(self, new_pick=None, new_json=None):
self.my_pick = new_pick
self.my_json = new_json

if new_json and os.path.exists(new_json):
self.img_but.setEnabled(True)
if new_pick[0] and os.path.exists(new_pick[0]):
self.recip_lat_but.setEnabled(True)

def run_recip_dialg(self):
self.diag.run_my_proc(
"dials.reciprocal_lattice_viewer",
Expand Down Expand Up @@ -852,7 +859,7 @@ def loading_error_dialog(message):
# from dui.resources.error_loading_dialog import Ui_LoadErrorDialog

dialog_filename = get_package_path("resources/error_loading_dialog.ui")
#Ui_LoadErrorDialog, _ = loadUiType(dialog_filename)
# Ui_LoadErrorDialog, _ = loadUiType(dialog_filename)
# Use compiled class while pyside2-uic is broken in CCP4
from .error_loading_dialog import Ui_LoadErrorDialog

Expand Down
3 changes: 2 additions & 1 deletion src/dui/outputs_n_viewers/img_view_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def __init__(self, max_val=100, min_val=0, text="Working"):
cancelButtonText="",
minimum=min_val,
maximum=max_val,
parent=None)
parent=None,
)

self.setValue(min_val)
self.setWindowTitle("Updating GUI data")
Expand Down