-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplugin.py
More file actions
38 lines (28 loc) · 1.32 KB
/
Copy pathplugin.py
File metadata and controls
38 lines (28 loc) · 1.32 KB
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
from typing import Any
from qgis.core import Qgis, QgsApplication
from qgis.PyQt.QtCore import QObject
from raster_caster_plugin.communication import UICommunication
from raster_caster_plugin.provider import RasterCasterProvider
PLUGIN_NAME = "Raster Caster"
UNSUPPORTED_QGIS_VERSION_INT = 40200
class RasterCasterPlugin(QObject):
"""Main Plugin Class which register toolbar ad menu and add tools"""
def __init__(self, iface: Any) -> None:
QObject.__init__(self)
self.iface = iface
self.communication = UICommunication(PLUGIN_NAME)
if Qgis.versionInt() == UNSUPPORTED_QGIS_VERSION_INT:
self.communication.show_warn(
"QGIS 4.2.0 is not supported by this plugin because of a bug in "
"OGR/GDAL 3.13.1. Please use a different QGIS version."
)
self.provider: RasterCasterProvider | None = None
def initGui(self) -> None:
"""Create the UI. Called when the plugin is loaded."""
self.provider = RasterCasterProvider()
QgsApplication.processingRegistry().addProvider(self.provider)
def unload(self) -> None:
"""Remove UI. Called then the plugin is unloaded."""
if self.provider is not None:
QgsApplication.processingRegistry().removeProvider(self.provider)
self.provider = None