-
Notifications
You must be signed in to change notification settings - Fork 1
/
polaris.py
45 lines (37 loc) · 1.68 KB
/
polaris.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
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from polaris_dialog import PolarisDialog
# initialize Qt resources from file resouces.py
import resources_rc
class Polaris:
def __init__(self, iface):
# save reference to the QGIS interface
self.iface = iface
def initGui(self):
# create action that will start plugin configuration
self.action = QAction(QIcon(":/plugins/polaris/icons/logo.png"), "POLARIS", self.iface.mainWindow())
self.action.setWhatsThis("Configuration for POLARIS plugin")
self.action.setStatusTip("This is status tip")
QObject.connect(self.action, SIGNAL("triggered()"), self.run)
# add toolbar button and menu item
self.iface.addToolBarIcon(self.action)
self.iface.addPluginToMenu("&POLARIS", self.action)
# connect to signal renderComplete which is emitted when canvas rendering is done
QObject.connect(self.iface.mapCanvas(), SIGNAL("renderComplete(QPainter *)"), self.renderTest)
def unload(self):
# remove the plugin menu item and icon
self.iface.removePluginMenu("&POLARIS",self.action)
self.iface.removeToolBarIcon(self.action)
# disconnect form signal of the canvas
QObject.disconnect(self.iface.mapCanvas(), SIGNAL("renderComplete(QPainter *)"), self.renderTest)
def run(self):
pass
# create and show a configuration dialog or something similar
# print "IndTools: run called!"
self.dlg = PolarisDialog()
self.dlg.show()
def renderTest(self, painter):
pass
# use painter for drawing to map canvas
# print "IndTools: renderTest called!"