Skip to content

Commit

Permalink
Close old workflow before creating new one.
Browse files Browse the repository at this point in the history
  • Loading branch information
hsorby committed May 15, 2024
1 parent 38b07f0 commit 7cb0b5b
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/mapclient/view/workflow/workflowwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,16 +219,18 @@ def setWidgetUndoRedoStack(self, stack):
self._main_window.set_current_undo_redo_stack(stack)

def new(self, pmr=False):
self.close()

workflowDir = self._get_workflow_dir()
if workflowDir:
self._createNewWorkflow(workflowDir, pmr)
self._create_new_workflow(workflowDir, pmr)

def _workflow_finished(self, successfully):
if successfully:
close_after = self._main_window.model().optionsManager().getOption(CLOSE_AFTER)
mb = MessageBox(QtWidgets.QMessageBox.Icon.Information, "Workflow Finished",
"Workflow finished successfully.",
QtWidgets.QMessageBox.Ok | QtWidgets.QMessageBox.Default,
QtWidgets.QMessageBox.StandardButton.Ok | QtWidgets.QMessageBox.StandardButton.Default,
parent=self._main_window,
close_after=close_after)
mb.setIconPixmap(QtGui.QPixmap(":/mapclient/images/green_tick.png").scaled(64, 64))
Expand Down Expand Up @@ -281,7 +283,7 @@ def rm_tree_unsuccessful(_one, _two, _three):

@handle_runtime_error
@set_wait_cursor
def _createNewWorkflow(self, workflow_dir, pmr):
def _create_new_workflow(self, workflow_dir, pmr):
m = self._main_window.model().workflowManager()
om = self._main_window.model().optionsManager()
m.new(workflow_dir)
Expand Down

0 comments on commit 7cb0b5b

Please sign in to comment.