4
4
5
5
from qgis .PyQt .QtCore import QCoreApplication , Qt , QTranslator
6
6
from qgis .PyQt .QtGui import QIcon
7
- from qgis .PyQt .QtWidgets import QAction , QWidget
7
+ from qgis .PyQt .QtWidgets import QAction , QMessageBox , QWidget
8
8
from qgis .utils import iface
9
9
10
10
from arho_feature_template .core .feature_template_library import FeatureTemplater , TemplateGeometryDigitizeMapTool
11
11
from arho_feature_template .core .plan_manager import PlanManager
12
+ from arho_feature_template .gui .plugin_settings import PluginSettings
12
13
from arho_feature_template .qgis_plugin_tools .tools .custom_logging import setup_logger , teardown_logger
13
14
from arho_feature_template .qgis_plugin_tools .tools .i18n import setup_translation
14
15
from arho_feature_template .qgis_plugin_tools .tools .resources import plugin_name
16
+ from arho_feature_template .utils .misc_utils import get_active_plan_id , get_lambda_settings
15
17
16
18
if TYPE_CHECKING :
17
19
from qgis .gui import QgisInterface , QgsMapTool
@@ -162,6 +164,24 @@ def initGui(self) -> None: # noqa N802
162
164
add_to_toolbar = True ,
163
165
)
164
166
167
+ self .validate_plan_action = self .add_action (
168
+ "" ,
169
+ text = "Vahvista kaava" ,
170
+ triggered_callback = self .validate_plan ,
171
+ add_to_menu = True ,
172
+ add_to_toolbar = True ,
173
+ status_tip = "Vahvista kaava" ,
174
+ )
175
+
176
+ self .plugin_settings_action = self .add_action (
177
+ "" ,
178
+ text = "Asetukset" ,
179
+ triggered_callback = self .open_settings ,
180
+ add_to_menu = True ,
181
+ add_to_toolbar = False ,
182
+ status_tip = "Säädä pluginin asetuksia" ,
183
+ )
184
+
165
185
def on_map_tool_changed (self , new_tool : QgsMapTool , old_tool : QgsMapTool ) -> None : # noqa: ARG002
166
186
if not isinstance (new_tool , TemplateGeometryDigitizeMapTool ):
167
187
self .template_dock_action .setChecked (False )
@@ -172,6 +192,22 @@ def add_new_plan(self):
172
192
def load_existing_land_use_plan (self ):
173
193
self .plan_manager .load_land_use_plan ()
174
194
195
+ def validate_plan (self ):
196
+ """Validate the plan."""
197
+ lambda_host , lambda_port = get_lambda_settings ()
198
+
199
+ # Testing.
200
+ QMessageBox .information (
201
+ None ,
202
+ "Lambda asetukset" ,
203
+ f"Lambdan isäntä: { lambda_host } \n Lambdan portti: { lambda_port } \n Aktiivinen kaava: { active_plan } " ,
204
+ )
205
+
206
+ def open_settings (self ):
207
+ """Open the plugin settings dialog."""
208
+ settings = PluginSettings ()
209
+ settings .exec_ ()
210
+
175
211
def unload (self ) -> None :
176
212
"""Removes the plugin menu item and icon from QGIS GUI."""
177
213
for action in self .actions :
0 commit comments