diff --git a/src/dui/error_loading_dialog.py b/src/dui/error_loading_dialog.py index e577eb72..8e8b3856 100644 --- a/src/dui/error_loading_dialog.py +++ b/src/dui/error_loading_dialog.py @@ -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"
Please report this error to dials-support@lists.sourceforge.net.
Please move or remove the dui-files/ subfolder or change your working directory to continue.
", 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'Please report this error to dials-support@lists.sourceforge.net.
Please move or remove the dui-files/ subfolder or change your working directory to continue.
', + None, + ) + ) + # retranslateUi diff --git a/src/dui/gui_utils.py b/src/dui/gui_utils.py index 66a2ff80..38663d3f 100644 --- a/src/dui/gui_utils.py +++ b/src/dui/gui_utils.py @@ -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) @@ -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", @@ -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 diff --git a/src/dui/outputs_n_viewers/img_view_tools.py b/src/dui/outputs_n_viewers/img_view_tools.py index d4ea0caf..aea1346c 100644 --- a/src/dui/outputs_n_viewers/img_view_tools.py +++ b/src/dui/outputs_n_viewers/img_view_tools.py @@ -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")