From 104e23d237ad3d301ff6f890dbf9a701127cfbb9 Mon Sep 17 00:00:00 2001 From: Stefano Simonelli <16114781+s-simoncelli@users.noreply.github.com> Date: Mon, 19 Feb 2024 10:24:09 +0000 Subject: [PATCH] Do not close the dialog if the form validation fails --- pywr_editor/dialogs/metadata/metadata_dialog.py | 4 ++-- pywr_editor/dialogs/node/node_dialog.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pywr_editor/dialogs/metadata/metadata_dialog.py b/pywr_editor/dialogs/metadata/metadata_dialog.py index 6268102..ecc9dcc 100644 --- a/pywr_editor/dialogs/metadata/metadata_dialog.py +++ b/pywr_editor/dialogs/metadata/metadata_dialog.py @@ -65,5 +65,5 @@ def on_form_save(self) -> None: Save the form and close the dialog. :return: None """ - self.form.on_save() - self.close() + if self.form.on_save(): + self.close() diff --git a/pywr_editor/dialogs/node/node_dialog.py b/pywr_editor/dialogs/node/node_dialog.py index 3f232da..0b37a98 100644 --- a/pywr_editor/dialogs/node/node_dialog.py +++ b/pywr_editor/dialogs/node/node_dialog.py @@ -75,8 +75,8 @@ def on_form_save(self) -> None: Save the form and close the dialog. :return: None """ - self.form.save() - self.close() + if self.form.save(): + self.close() class NodeDialogTitle(QWidget):