Skip to content

Commit 2760f62

Browse files
committed
remove most success messages, fix use_wait_cursor decorator
1 parent 65679ab commit 2760f62

File tree

2 files changed

+6
-21
lines changed

2 files changed

+6
-21
lines changed

arho_feature_template/core/plan_manager.py

+4-21
Original file line numberDiff line numberDiff line change
@@ -161,14 +161,10 @@ def update_active_plan_regulation_group_library(self):
161161
self.regulation_groups_dock.update_regulation_groups(self.active_plan_regulation_group_library)
162162

163163
def create_new_regulation_group(self):
164-
new_group = self._open_regulation_group_form(RegulationGroup())
165-
if new_group:
166-
iface.messageBar().pushSuccess(None, f"Kaavamääräysryhmä {new_group!s} luotiin onnistuneesti.")
164+
self._open_regulation_group_form(RegulationGroup())
167165

168166
def edit_regulation_group(self, regulation_group: RegulationGroup):
169-
edited_group = self._open_regulation_group_form(regulation_group)
170-
if edited_group:
171-
iface.messageBar().pushSuccess(None, f"Kaavamääräysryhmää {edited_group!s} muokattiin onnistuneesti.")
167+
self._open_regulation_group_form(regulation_group)
172168

173169
def _open_regulation_group_form(self, regulation_group: RegulationGroup):
174170
regulation_group_form = PlanRegulationGroupForm(regulation_group, self.active_plan_regulation_group_library)
@@ -187,7 +183,6 @@ def _open_regulation_group_form(self, regulation_group: RegulationGroup):
187183

188184
def delete_regulation_group(self, group: RegulationGroup):
189185
if delete_regulation_group(group):
190-
iface.messageBar().pushSuccess(None, f"Kaavamääräysryhmä {group!s} poistettiin onnistuneesti.")
191186
self.update_active_plan_regulation_group_library()
192187

193188
def toggle_identify_plan_features(self, activate: bool): # noqa: FBT001
@@ -257,9 +252,6 @@ def edit_plan(self):
257252
if attribute_form.exec_():
258253
feature = save_plan(attribute_form.model)
259254
if feature:
260-
iface.messageBar().pushSuccess(
261-
"", f"Kaavan {attribute_form.model.name} tietoja muokattiin onnistuneesti."
262-
)
263255
self.update_active_plan_regulation_group_library()
264256

265257
def edit_lifecycles(self):
@@ -307,11 +299,7 @@ def _plan_geom_digitized(self, feature: QgsFeature):
307299
attribute_form = PlanAttributeForm(plan_model, self.regulation_group_libraries)
308300
if attribute_form.exec_():
309301
feat = save_plan(attribute_form.model)
310-
if feat:
311-
iface.messageBar().pushSuccess("", f"Kaava {attribute_form.model.name} luotiin onnistuneesti.")
312-
plan_to_be_activated = feat["id"]
313-
else:
314-
plan_to_be_activated = self.previous_active_plan_id
302+
plan_to_be_activated = feat["id"] if feat else self.previous_active_plan_id
315303
else:
316304
plan_to_be_activated = self.previous_active_plan_id
317305

@@ -338,7 +326,6 @@ def _plan_feature_geom_digitized(self, feature: QgsFeature):
338326
plan_feature, title, self.regulation_group_libraries, self.active_plan_regulation_group_library
339327
)
340328
if attribute_form.exec_() and save_plan_feature(attribute_form.model):
341-
iface.messageBar().pushSuccess("", f"Kaavakohde {attribute_form.model!s} luotiin onnistuneesti.")
342329
self.update_active_plan_regulation_group_library()
343330

344331
def edit_plan_feature(self, feature: QgsFeature, layer_name: str):
@@ -350,7 +337,6 @@ def edit_plan_feature(self, feature: QgsFeature, layer_name: str):
350337
plan_feature, title, self.regulation_group_libraries, self.active_plan_regulation_group_library
351338
)
352339
if attribute_form.exec_() and save_plan_feature(attribute_form.model):
353-
iface.messageBar().pushSuccess("", f"Kaavakohdetta {attribute_form.model!s} muokattiin onnistuneesti.")
354340
self.update_active_plan_regulation_group_library()
355341

356342
def set_active_plan(self, plan_id: str | None):
@@ -393,13 +379,10 @@ def load_land_use_plan(self):
393379

394380
if dialog.exec_() == QDialog.Accepted:
395381
selected_plan_id = dialog.get_selected_plan_id()
396-
selected_plan_name = dialog.get_selected_plan_name()
397382
self.commit_all_editable_layers()
398383

399384
self.set_active_plan(selected_plan_id)
400385

401-
iface.messageBar().pushSuccess("", f"Kaava {selected_plan_name} avattiin onnistuneesti.")
402-
403386
def commit_all_editable_layers(self):
404387
"""Commit all changes in any editable layers."""
405388
for layer in QgsProject.instance().mapLayers().values():
@@ -438,7 +421,7 @@ def save_plan_jsons(self, plan_json, outline_json):
438421
with open(self.json_plan_outline_path, "w", encoding="utf-8") as outline_file:
439422
json.dump(outline_json, outline_file, ensure_ascii=False, indent=2)
440423

441-
iface.messageBar().pushSuccess("", "Kaava ja sen ulkoraja tallennettu onnistuneesti.")
424+
iface.messageBar().pushSuccess("", "Kaava ja kaavan ulkoraja tallennettu.")
442425

443426
def unload(self):
444427
# Set pan map tool as active (to deactivate our custom tools to avoid errors)

arho_feature_template/utils/misc_utils.py

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import os
44
from contextlib import suppress
5+
from functools import wraps
56
from typing import TYPE_CHECKING, Any, cast
67

78
from qgis.core import QgsExpressionContextUtils, QgsProject, QgsVectorLayer
@@ -131,6 +132,7 @@ def deserialize_localized_text(text_value: dict[str, str] | None | Any) -> str |
131132

132133

133134
def use_wait_cursor(func):
135+
@wraps(func)
134136
def wrapper(*args, **kwargs):
135137
with OverrideCursor(Qt.WaitCursor):
136138
return func(*args, **kwargs)

0 commit comments

Comments
 (0)