From bec39734f46a0040b76b6966415b75d2a93c6431 Mon Sep 17 00:00:00 2001 From: Miikka Kallio Date: Fri, 7 Feb 2025 12:40:54 +0200 Subject: [PATCH 1/2] Renames plan regulation group form's title dynamically. --- arho_feature_template/core/plan_manager.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/arho_feature_template/core/plan_manager.py b/arho_feature_template/core/plan_manager.py index de3d081..fd9e2fb 100644 --- a/arho_feature_template/core/plan_manager.py +++ b/arho_feature_template/core/plan_manager.py @@ -167,6 +167,13 @@ def edit_regulation_group(self, regulation_group: RegulationGroup): def _open_regulation_group_form(self, regulation_group: RegulationGroup): regulation_group_form = PlanRegulationGroupForm(regulation_group, self.active_plan_regulation_group_library) + + # Dynamically rename form title. + if regulation_group == RegulationGroup(): + regulation_group_form.setWindowTitle("Luo kaavamääräysryhmä") + else: + regulation_group_form.setWindowTitle("Muokkaa kaavamääräysryhmää") + if regulation_group_form.exec_(): if regulation_group_form.save_as_config: save_regulation_group_as_config(regulation_group_form.model) From 5ad1ecdedef5496709a2e45616371c96c437d017 Mon Sep 17 00:00:00 2001 From: Miikka Kallio Date: Mon, 24 Feb 2025 11:03:06 +0200 Subject: [PATCH 2/2] Improved dynamic renaming Moved renaming of plan regulation group from's title to already existing id check. --- arho_feature_template/core/plan_manager.py | 6 ------ .../gui/dialogs/plan_regulation_group_form.py | 1 + 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/arho_feature_template/core/plan_manager.py b/arho_feature_template/core/plan_manager.py index fd9e2fb..59f31a2 100644 --- a/arho_feature_template/core/plan_manager.py +++ b/arho_feature_template/core/plan_manager.py @@ -168,12 +168,6 @@ def edit_regulation_group(self, regulation_group: RegulationGroup): def _open_regulation_group_form(self, regulation_group: RegulationGroup): regulation_group_form = PlanRegulationGroupForm(regulation_group, self.active_plan_regulation_group_library) - # Dynamically rename form title. - if regulation_group == RegulationGroup(): - regulation_group_form.setWindowTitle("Luo kaavamääräysryhmä") - else: - regulation_group_form.setWindowTitle("Muokkaa kaavamääräysryhmää") - if regulation_group_form.exec_(): if regulation_group_form.save_as_config: save_regulation_group_as_config(regulation_group_form.model) diff --git a/arho_feature_template/gui/dialogs/plan_regulation_group_form.py b/arho_feature_template/gui/dialogs/plan_regulation_group_form.py index a79971d..cd234ae 100644 --- a/arho_feature_template/gui/dialogs/plan_regulation_group_form.py +++ b/arho_feature_template/gui/dialogs/plan_regulation_group_form.py @@ -135,6 +135,7 @@ def __init__( layout.addWidget(self.link_label_text) self.regulation_group_info_tab.layout().insertLayout(1, layout) + self.setWindowTitle("Muokkaa kaavamääräysryhmää") def _initalize_regulation_from_config(self, config: RegulationConfig, parent: QTreeWidgetItem | None = None): item = self.regulations_selection_widget.add_item_to_tree(config.name, config, parent)