-
Notifications
You must be signed in to change notification settings - Fork 0
/
plugin.py
38 lines (28 loc) · 1 KB
/
plugin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import logging
import sys
from PyQt5.QtCore import PYQT_VERSION_STR, QT_VERSION_STR
from PyQt5.QtWidgets import QAction
from qgis.core import QgsProject
from qgis.utils import iface # type: ignore
from .tool.tool import OFDSDedupToolDialog
logger = logging.getLogger(__name__)
class OFDSDedupPlugin:
def __init__(self):
self.tool_dialog = OFDSDedupToolDialog()
def initGui(self):
self.action = QAction("Consolidate OFDS", iface.mainWindow())
self.action.triggered.connect(self.run)
iface.addToolBarIcon(self.action)
def unload(self):
iface.removeToolBarIcon(self.action)
del self.action
def run(self):
logger.debug("Running OFDS Consolidation plugin")
logger.debug(
f"Qt: v{QT_VERSION_STR} PyQt: v{PYQT_VERSION_STR} Python: {sys.version}"
)
project = QgsProject.instance()
if not project:
raise Exception
self.tool_dialog.reset(project=project)
self.tool_dialog.show()