Skip to content

Commit f00799f

Browse files
committed
remove most success messages, fix use_wait_cursor decorator
1 parent 2f2c83d commit f00799f

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)
@@ -186,7 +182,6 @@ def _open_regulation_group_form(self, regulation_group: RegulationGroup):
186182

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

192187
def toggle_identify_plan_features(self, activate: bool): # noqa: FBT001
@@ -256,9 +251,6 @@ def edit_plan(self):
256251
if attribute_form.exec_():
257252
feature = save_plan(attribute_form.model)
258253
if feature:
259-
iface.messageBar().pushSuccess(
260-
"", f"Kaavan {attribute_form.model.name} tietoja muokattiin onnistuneesti."
261-
)
262254
self.update_active_plan_regulation_group_library()
263255

264256
def edit_lifecycles(self):
@@ -306,11 +298,7 @@ def _plan_geom_digitized(self, feature: QgsFeature):
306298
attribute_form = PlanAttributeForm(plan_model, self.regulation_group_libraries)
307299
if attribute_form.exec_():
308300
feat = save_plan(attribute_form.model)
309-
if feat:
310-
iface.messageBar().pushSuccess("", f"Kaava {attribute_form.model.name} luotiin onnistuneesti.")
311-
plan_to_be_activated = feat["id"]
312-
else:
313-
plan_to_be_activated = self.previous_active_plan_id
301+
plan_to_be_activated = feat["id"] if feat else self.previous_active_plan_id
314302
else:
315303
plan_to_be_activated = self.previous_active_plan_id
316304

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

343330
def edit_plan_feature(self, feature: QgsFeature, layer_name: str):
@@ -349,7 +336,6 @@ def edit_plan_feature(self, feature: QgsFeature, layer_name: str):
349336
plan_feature, title, self.regulation_group_libraries, self.active_plan_regulation_group_library
350337
)
351338
if attribute_form.exec_() and save_plan_feature(attribute_form.model):
352-
iface.messageBar().pushSuccess("", f"Kaavakohdetta {attribute_form.model!s} muokattiin onnistuneesti.")
353339
self.update_active_plan_regulation_group_library()
354340

355341
def set_active_plan(self, plan_id: str | None):
@@ -392,13 +378,10 @@ def load_land_use_plan(self):
392378

393379
if dialog.exec_() == QDialog.Accepted:
394380
selected_plan_id = dialog.get_selected_plan_id()
395-
selected_plan_name = dialog.get_selected_plan_name()
396381
self.commit_all_editable_layers()
397382

398383
self.set_active_plan(selected_plan_id)
399384

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

440-
iface.messageBar().pushSuccess("", "Kaava ja sen ulkoraja tallennettu onnistuneesti.")
423+
iface.messageBar().pushSuccess("", "Kaava ja kaavan ulkoraja tallennettu.")
441424

442425
def unload(self):
443426
# 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)