From d2f29b2131d6f44b9b0b3edc916b2a4546d63d9b Mon Sep 17 00:00:00 2001 From: Paulocracy <36934614+Paulocracy@users.noreply.github.com> Date: Wed, 31 Jan 2024 09:41:07 +0100 Subject: [PATCH] Fix SDS loading --- cnapy/gui_elements/main_window.py | 10 +++++++--- cnapy/gui_elements/strain_design_dialog.py | 7 +++++-- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/cnapy/gui_elements/main_window.py b/cnapy/gui_elements/main_window.py index 6d9bd7c9..8ea6da7f 100644 --- a/cnapy/gui_elements/main_window.py +++ b/cnapy/gui_elements/main_window.py @@ -662,7 +662,7 @@ def strain_design_with_setup(self, sd_setup): def compute_strain_design(self,sd_setup): # launch progress viewer and computation thread self.sd_viewer = SDComputationViewer(self.appdata, sd_setup) - self.sd_viewer.show_sd_signal.connect(self.show_strain_designs,Qt.QueuedConnection) + self.sd_viewer.show_sd_signal.connect(self.show_strain_designs_with_setup, Qt.QueuedConnection) # connect signals to update progress self.sd_computation = SDComputationThread(self.appdata, sd_setup) self.sd_computation.output_connector.connect( self.sd_viewer.receive_progress_text,Qt.QueuedConnection) @@ -703,8 +703,12 @@ def terminate_strain_design_computation(self): self.sd_computation.terminate() @Slot(bytes) - def show_strain_designs(self,solutions): - self.sd_sols = SDViewer(self.appdata, solutions) + def show_strain_designs_with_setup(self, solutions_with_setup): + self.show_strain_designs(solutions_with_setup, with_setup=True) + + @Slot(bytes) + def show_strain_designs(self,solutions, with_setup=False): + self.sd_sols = SDViewer(self.appdata, solutions, with_setup) self.sd_sols.show() self.centralWidget().update_mode() diff --git a/cnapy/gui_elements/strain_design_dialog.py b/cnapy/gui_elements/strain_design_dialog.py index 3926f456..1eb9aeec 100644 --- a/cnapy/gui_elements/strain_design_dialog.py +++ b/cnapy/gui_elements/strain_design_dialog.py @@ -1456,10 +1456,13 @@ def flush(self): class SDViewer(QDialog): """A dialog that shows the results of the strain design computation""" - def __init__(self, appdata: AppData, solutions): + def __init__(self, appdata: AppData, solutions, with_setup: bool): super().__init__() try: - (self.solutions,self.sd_setup) = pickle.loads(solutions) + if with_setup: + (self.solutions,self.sd_setup) = pickle.loads(solutions) + else: + self.solutions = pickle.loads(solutions) except pickle.UnpicklingError: QMessageBox.critical( self,