Skip to content

Commit

Permalink
Fix SDS loading (#500)
Browse files Browse the repository at this point in the history
  • Loading branch information
Paulocracy authored Jan 31, 2024
1 parent c43c61f commit 94cc4b8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions cnapy/gui_elements/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()

Expand Down
7 changes: 5 additions & 2 deletions cnapy/gui_elements/strain_design_dialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 94cc4b8

Please sign in to comment.