-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathjpdata.py
More file actions
48 lines (40 loc) · 1.48 KB
/
Copy pathjpdata.py
File metadata and controls
48 lines (40 loc) · 1.48 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
39
40
41
42
43
44
45
46
47
48
# -*- coding: utf-8 -*-
import os
from qgis.PyQt.QtCore import QSettings, QTranslator, QCoreApplication
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtWidgets import QAction
from .translation import setup_translation
from .manager import JPDataManager
class jpData:
def __init__(self, iface):
self.plugin_dir = os.path.dirname(__file__)
self.translator = setup_translation(
self.plugin_dir,
'jpData'
)
self.iface = iface
# locale = QSettings().value("locale/userLocale")[0:2]
# locale_path = os.path.join(self.plugin_dir, "i18n", f"jpdata_{locale}.qm")
# if os.path.exists(locale_path):
# self.translator = QTranslator()
# self.translator.load(locale_path)
# QCoreApplication.installTranslator(self.translator)
self.manager = JPDataManager(self.iface)
self.action = None
# def tr(self, message):
# return QCoreApplication.translate("jpdata", message)
def initGui(self):
icon_path = os.path.join(self.plugin_dir, "icon.png")
self.action = QAction(
QIcon(icon_path),
"jpdata",
self.iface.mainWindow()
)
self.action.triggered.connect(self.run)
self.iface.addPluginToMenu("&jpdata", self.action)
def unload(self):
if self.action:
self.iface.removePluginMenu("&jpdata", self.action)
self.manager.unload()
def run(self):
self.manager.run()