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

Fix SDS loading #500

Merged
merged 1 commit into from
Jan 31, 2024
Merged
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
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
Loading