Skip to content

Commit

Permalink
[ui] Open a warning dialog when attempting to submit an unsaved project
Browse files Browse the repository at this point in the history
A project needs to be saved in order to be submitted to the renderfarm.
Prior to this commit, attempting to submit an unsaved project would not
prompt any dialog in the UI despite the exception that was thrown on the
Python side.

A warning dialog is now opened to let the user know that the project
cannot be submitted until it is saved.
  • Loading branch information
cbentejac committed Mar 9, 2023
1 parent 33def1d commit 16dfe96
Showing 1 changed file with 27 additions and 7 deletions.
34 changes: 27 additions & 7 deletions meshroom/ui/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -217,13 +217,17 @@ ApplicationWindow {
}

function submit(node) {
try {
_reconstruction.submit(node)
}
catch (error) {
const data = ErrorHandler.analyseError(error)
if(data.context === "SUBMITTING")
computeSubmitErrorDialog.openError(data.type, data.msg, node)
if (!canSubmit) {
unsavedSubmitDialog.open()
} else {
try {
_reconstruction.submit(node)
}
catch (error) {
const data = ErrorHandler.analyseError(error)
if(data.context === "SUBMITTING")
computeSubmitErrorDialog.openError(data.type, data.msg, node)
}
}
}

Expand Down Expand Up @@ -319,6 +323,22 @@ ApplicationWindow {
onDiscarded: { close(); computeManager.compute(currentNode, true) }
onAccepted: saveAsAction.trigger()
}

MessageDialog {
id: unsavedSubmitDialog

canCopy: false
icon.text: MaterialIcons.warning
parent: Overlay.overlay
preset: "Warning"
title: "Unsaved Project"
text: "The project cannot be submitted if it remains unsaved."
helperText: "Save the project to be able to submit it?"
standardButtons: Dialog.Cancel | Dialog.Save

onDiscarded: close()
onAccepted: saveAsAction.trigger()
}
}

FileDialog {
Expand Down

0 comments on commit 16dfe96

Please sign in to comment.