From 5da60811dbcb1972c840d1e96a5b9cd2fc2019c9 Mon Sep 17 00:00:00 2001 From: signedav Date: Fri, 14 Apr 2023 13:23:59 +0200 Subject: [PATCH] do re-set the model on setup dialog to be stable on validation gui and on export data page. it needs to set the model new and it needs to disconnect and reconnect the sloths. --- QgisModelBaker/gui/panel/export_models_panel.py | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/QgisModelBaker/gui/panel/export_models_panel.py b/QgisModelBaker/gui/panel/export_models_panel.py index d8faa781c..a647d1d12 100644 --- a/QgisModelBaker/gui/panel/export_models_panel.py +++ b/QgisModelBaker/gui/panel/export_models_panel.py @@ -31,7 +31,18 @@ def __init__(self, parent=None): self.setupUi(self) self.parent = parent + def setup_dialog(self, validation=False): + self._generate_texts(validation) + self.export_models_checkbox.setChecked(False) + self.items_view.setVisible(False) + if self.parent: + try: + self.items_view.clicked.disconnect() + self.items_view.space_pressed.disconnect() + except Exception: + pass + self.items_view.setModel(self.parent.current_export_models_model) self.items_view.clicked.connect(self.items_view.model().check) self.items_view.space_pressed.connect(self.items_view.model().check) @@ -42,11 +53,6 @@ def __init__(self, parent=None): self.export_models_checkbox.stateChanged.connect(self._active_state_changed) self._active_state_changed(self.parent.current_export_models_active) - def setup_dialog(self, validation=False): - self._generate_texts(validation) - self.export_models_checkbox.setChecked(False) - self.items_view.setVisible(False) - def _generate_texts(self, validation): self.export_models_checkbox.setText( self.tr(