-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathB4UdigNL.py
77 lines (68 loc) · 3.08 KB
/
B4UdigNL.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
"""
/***************************************************************************
B4UdigNL
A QGIS plugin
View the result of a Dutch B4Udig request
-------------------
begin : 2010-05-18
copyright : (C) 2010 by Diethard Jansen
email : diethard.jansen at gmail.com
***************************************************************************/
/***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
"""
from __future__ import absolute_import
# Import the PyQt and QGIS libraries
from builtins import object
from qgis.PyQt.QtCore import QSettings, QTranslator, QObject
from qgis.PyQt.QtWidgets import QApplication, QAction
from qgis.PyQt.QtGui import QIcon
from qgis.core import QgsApplication
# Initialize Qt resources from file resources.py
from . import qrc_resources
# Add translations to translator
application = QgsApplication.instance()
localeName = QSettings().value("locale/userLocale", type=str)
translator = QTranslator()
translator.load("B4UdigNL_"+str(localeName), ":/")
# Add translator to application
application.installTranslator(translator)
# Import the code for the dialog
from .B4UdigNLDialog import B4UdigNLDialog
class B4UdigNL(object):
def __init__(self, iface):
# Save reference to the QGIS interface
self.iface = iface
self.dialog = None
def initGui(self):
# Create action that will start plugin configuration
self.action = QAction(QIcon(":/b4udignl.png"), \
QApplication.translate("B4UdigNL","KLIC Viewer"), self.iface.mainWindow())
# connect the action to the run method
self.action.triggered.connect(self.run)
# Add toolbar button and menu item
self.iface.addToolBarIcon(self.action)
self.iface.addPluginToMenu(QApplication.translate("B4UdigNL","&KLIC Viewer"), self.action)
def unload(self):
# Remove the plugin menu item and icon
if self.dialog != None:
self.dialog.storeDialogPosition()
self.iface.removePluginMenu(QApplication.translate("B4UdigNL","&KLIC Viewer"),self.action)
self.iface.removeToolBarIcon(self.action)
# run method that performs all the real work
def run(self):
# create and show the dialog
if self.dialog is None:
self.dialog = B4UdigNLDialog(self.iface)
# show the dialog
l_dialog = self.dialog
# move the dialog to where it was the last time it was used!
#l_dialog.restoreDialogPosition()
l_dialog.show()
result = l_dialog.exec_()