Skip to content

Commit 046c56b

Browse files
Mtk112LKajan
authored andcommitted
Improved validation UI
Validate button is now disabled during validation run. Added progress bar to indicate that validation is running.
1 parent 6536779 commit 046c56b

File tree

2 files changed

+22
-1
lines changed

2 files changed

+22
-1
lines changed

arho_feature_template/gui/validation_dock.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,15 @@
1212
from arho_feature_template.utils.misc_utils import get_active_plan_id
1313

1414
if TYPE_CHECKING:
15-
from qgis.PyQt.QtWidgets import QListView
15+
from qgis.PyQt.QtWidgets import QListView, QProgressBar
1616

1717
ui_path = resources.files(__package__) / "validation_dock.ui"
1818
DockClass, _ = uic.loadUiType(ui_path)
1919

2020

2121
class ValidationDock(QgsDockWidget, DockClass): # type: ignore
2222
error_list_view: QListView
23+
progress_bar: QProgressBar
2324

2425
def __init__(self):
2526
super().__init__()
@@ -37,6 +38,10 @@ def validate(self):
3738
iface.messageBar().pushMessage("Virhe", "Ei aktiivista kaavaa.", level=3)
3839
return
3940

41+
# Disable button and show progress bar
42+
self.validate_button.setEnabled(False)
43+
self.progress_bar.setVisible(True)
44+
4045
self.lambda_service.validate_plan(active_plan_id)
4146

4247
def list_validation_errors(self, validation_json):
@@ -76,3 +81,6 @@ def list_validation_errors(self, validation_json):
7681

7782
# Update the list view with the new errors and warnings
7883
self.error_list_model.setStringList(new_errors)
84+
# Hide progress bar and re-enable the button
85+
self.progress_bar.setVisible(False)
86+
self.validate_button.setEnabled(True)

arho_feature_template/gui/validation_dock.ui

+13
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,19 @@
1717
</item>
1818
</layout>
1919
</item>
20+
<item>
21+
<widget class="QProgressBar" name="progress_bar">
22+
<property name="minimum">
23+
<number>0</number>
24+
</property>
25+
<property name="maximum">
26+
<number>0</number>
27+
</property>
28+
<property name="visible">
29+
<bool>false</bool>
30+
</property>
31+
</widget>
32+
</item>
2033
<item>
2134
<widget class="QListView" name="error_list_view"/>
2235
</item>

0 commit comments

Comments
 (0)