2
2
3
3
from typing import Callable
4
4
5
- from qgis .PyQt .QtCore import QCoreApplication , QTranslator
5
+ from qgis .gui import QgsDockWidget
6
+ from qgis .PyQt .QtCore import QCoreApplication , Qt , QTranslator
6
7
from qgis .PyQt .QtGui import QIcon
7
8
from qgis .PyQt .QtWidgets import QAction , QWidget
8
9
from qgis .utils import iface
9
10
11
+ from arho_feature_template .core .feature_template_library import FeatureTemplateLibrary
12
+ from arho_feature_template .core .panels .template_library_panel import TemplateLibraryPanel
10
13
from arho_feature_template .qgis_plugin_tools .tools .custom_logging import setup_logger , teardown_logger
11
14
from arho_feature_template .qgis_plugin_tools .tools .i18n import setup_translation
12
- from arho_feature_template .qgis_plugin_tools .tools .resources import plugin_name
15
+ from arho_feature_template .qgis_plugin_tools .tools .resources import plugin_name , resources_path
13
16
17
+ LIBRARY_JSON = resources_path ("asemakaava-template-library-test.json" )
14
18
15
19
class Plugin :
16
20
"""QGIS Plugin Implementation."""
@@ -33,6 +37,9 @@ def __init__(self) -> None:
33
37
self .actions : list [QAction ] = []
34
38
self .menu = Plugin .name
35
39
40
+ # Create and initialize default feature template library
41
+ self .active_library = FeatureTemplateLibrary (LIBRARY_JSON )
42
+
36
43
def add_action (
37
44
self ,
38
45
icon_path : str ,
@@ -107,7 +114,7 @@ def initGui(self) -> None: # noqa N802
107
114
text = Plugin .name ,
108
115
callback = self .run ,
109
116
parent = iface .mainWindow (),
110
- add_to_toolbar = False ,
117
+ add_to_toolbar = True ,
111
118
)
112
119
113
120
def onClosePlugin (self ) -> None : # noqa N802
@@ -121,5 +128,9 @@ def unload(self) -> None:
121
128
teardown_logger (Plugin .name )
122
129
123
130
def run (self ) -> None :
124
- """Run method that performs all the real work"""
125
- print ("Hello QGIS plugin" ) # noqa: T201
131
+ self .feature_template_dock = QgsDockWidget ()
132
+ self .add_feature_panel = TemplateLibraryPanel (self .active_library )
133
+ self .feature_template_dock .setWidget (self .add_feature_panel )
134
+ self .feature_template_dock .setWindowTitle ("ARHO" ) # NOTE: Placeholder name
135
+
136
+ iface .addDockWidget (Qt .RightDockWidgetArea , self .feature_template_dock )
0 commit comments