forked from wonder-sk/qgis-minimal-plugin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
__init__.py
32 lines (25 loc) · 1.06 KB
/
__init__.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
#-----------------------------------------------------------
# Copyright (C) 2015 Martin Dobias
#-----------------------------------------------------------
# Licensed under the terms of GNU GPL 2
#
# 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 PyQt5.QtWidgets import QAction, QMessageBox
def classFactory(iface):
return MinimalPlugin(iface)
class MinimalPlugin:
def __init__(self, iface):
self.iface = iface
def initGui(self):
self.action = QAction('Go!', self.iface.mainWindow())
self.action.triggered.connect(self.run)
self.iface.addToolBarIcon(self.action)
def unload(self):
self.iface.removeToolBarIcon(self.action)
del self.action
def run(self):
QMessageBox.information(None, 'Minimal plugin', 'Do something useful here')