Skip to content

Commit

Permalink
Merge pull request #117 from hsorby/main
Browse files Browse the repository at this point in the history
Add a picture of the workflow when saving.
  • Loading branch information
hsorby authored Jul 2, 2024
2 parents 1d9e562 + 020f072 commit 3b02999
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/mapclient/core/managers/workflowmanager.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ def load(self, location, scene_rect=QtCore.QRectF(0, 0, 640, 480)):

self._saveStateIndex = self._currentStateIndex = 0

def save(self):
def save(self, pixmap=None):
wf = _get_workflow_configuration(self._location)

if 'version' not in wf.allKeys():
Expand All @@ -300,6 +300,8 @@ def save(self):
self._scene.saveState(wf)
self._saveStateIndex = self._currentStateIndex
af = _get_workflow_meta_absolute_filename(self._location)
if pixmap:
pixmap.save(_get_workflow_configuration_absolute_filename(self._location) + ".png")

try:
annotation = serializeWorkflowAnnotation().decode('utf-8')
Expand Down
3 changes: 2 additions & 1 deletion src/mapclient/view/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,8 @@ def confirm_close(self):
'You have unsaved changes, would you like to save these changes now?',
QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No)
if ret == QtWidgets.QMessageBox.StandardButton.Yes:
self._model.workflowManager().save()
pixmap = self._workflowWidget.pixmap()
self._model.workflowManager().save(pixmap)

def quit_application(self):
self.confirm_close()
Expand Down
5 changes: 4 additions & 1 deletion src/mapclient/view/workflow/workflowwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,6 +482,9 @@ def close(self):
m.close()
self._update_ui()

def pixmap(self):
return self._ui.graphicsView.grab()

def save(self):
m = self._main_window.model().workflowManager()
location_set = os.path.exists(m.location())
Expand All @@ -491,7 +494,7 @@ def save(self):
location_set = self._set_location()
if location_set:
m.scene().setViewParameters(self._ui.graphicsView.getViewParameters())
m.save()
m.save(self.pixmap())
if self.commitChanges(m.location()):
self._setIndexerFile(m.location())
else:
Expand Down

0 comments on commit 3b02999

Please sign in to comment.