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
15
16
17
+ # from arho_feature_template.utils.misc_utils import get_lambda_address, get_lambda_settings
18
+ from arho_feature_template .utils .misc_utils import get_lambda_settings
19
+
16
20
if TYPE_CHECKING :
17
21
from qgis .gui import QgisInterface , QgsMapTool
18
22
@@ -162,6 +166,24 @@ def initGui(self) -> None: # noqa N802
162
166
add_to_toolbar = True ,
163
167
)
164
168
169
+ self .validate_plan_action = self .add_action (
170
+ "" ,
171
+ text = "Vahvista kaava" ,
172
+ triggered_callback = self .validate_plan ,
173
+ add_to_menu = True ,
174
+ add_to_toolbar = True ,
175
+ status_tip = "Vahvista kaava" ,
176
+ )
177
+
178
+ self .plugin_settings_action = self .add_action (
179
+ "" ,
180
+ text = "Asetukset" ,
181
+ triggered_callback = self .open_settings ,
182
+ add_to_menu = True ,
183
+ add_to_toolbar = True ,
184
+ status_tip = "Säädä pluginin asetuksia" ,
185
+ )
186
+
165
187
def on_map_tool_changed (self , new_tool : QgsMapTool , old_tool : QgsMapTool ) -> None : # noqa: ARG002
166
188
if not isinstance (new_tool , TemplateGeometryDigitizeMapTool ):
167
189
self .template_dock_action .setChecked (False )
@@ -172,6 +194,20 @@ def add_new_plan(self):
172
194
def load_existing_land_use_plan (self ):
173
195
self .plan_manager .load_land_use_plan ()
174
196
197
+ def validate_plan (self ):
198
+ """Validate the plan."""
199
+ lambda_host , lambda_port = get_lambda_settings ()
200
+
201
+ # Testing.
202
+ QMessageBox .information (None , "Lambda Settings" , f"Lambda Host: { lambda_host } \n Lambda Port: { lambda_port } " )
203
+ # print(f"Hard Coded Lambda Host: {hc_lambda_host}")
204
+ # print(f"Hard Coded Lambda Port: {hc_lambda_port}")
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