-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocumentation_editor.py
More file actions
58 lines (50 loc) · 1.64 KB
/
documentation_editor.py
File metadata and controls
58 lines (50 loc) · 1.64 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
49
50
51
52
53
54
55
56
57
58
from PyQt4.QtGui import QAction
from PyQt4.QtGui import QIcon
from help_editor import HelpEditor
from . import PLUGIN_DIR
class StdmDocumentationEditor(object):
"""
StdmDocumentationEditor initializes the whole plugin and adds the plugin
on toolbar of QGIS.
"""
def __init__(self, iface):
"""
Initializes iface and importer object.
:param iface:
:type iface:
"""
self.iface = iface
self.editor = None
def initGui(self):
"""
Initializes the plugin GUI.
"""
self.action = QAction(
QIcon('{}/images/icon.png'.format(PLUGIN_DIR)),
'STDM Documentation Editor', self.iface.mainWindow()
)
self.action.setObjectName('stdm_documentation_editor')
self.action.setWhatsThis('STDM Documentation Editor')
self.action.setStatusTip('Edit STDM Documentation')
self.action.triggered.connect(self.run)
# add toolbar button and menu item
self.iface.addToolBarIcon(self.action)
def unload(self):
"""
Removes the plugin properly.
"""
# remove the plugin menu item and icon
self.iface.removePluginMenu('&STDM Documentation Editor', self.action)
self.iface.removeToolBarIcon(self.action)
# disconnect form signal of the canvas
self.action.triggered.disconnect(self.run)
def run(self):
"""
Starts the plugin GUI.
"""
if self.editor is None:
self.editor = HelpEditor()
self.editor.show()
else:
self.editor.show()
self.editor.activateWindow()