-
Notifications
You must be signed in to change notification settings - Fork 0
/
inspector_plugin.py
executable file
·53 lines (43 loc) · 2.24 KB
/
inspector_plugin.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
# -*- coding: utf-8 -*-
"""
/***************************************************************************
Name : QGIS Plugin Inspector
Description : Get various info about active plugins
Date : 2019-08-26
***************************************************************************/
/***************************************************************************
* *
* 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. *
* *
***************************************************************************/
"""
import os
from PyQt5.QtWidgets import QMenu, QToolBar, QAction
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import Qt, QSettings
from qgis.core import QgsProject
from functools import partial
from .inspector_dock import InspectorDock
class InspectorPlugin:
def __init__(self, iface):
self.iface = iface
self.canvas = iface.mapCanvas()
self.pluginPath = os.path.dirname(__file__)
def initGui(self):
self.actionOpen = QAction("Open Inspector", self.iface.mainWindow())
self.actionOpen.setIcon(QIcon(os.path.join(self.pluginPath, "inspector.png")))
self.actionOpen.setToolTip("Opens the Inspector window")
self.iface.addToolBarIcon(self.actionOpen)
self.iface.addPluginToMenu("Plugin &Inspector", self.actionOpen)
self.iface.registerMainWindowAction(self.actionOpen, 'F7')
self.actionOpen.triggered.connect(self.openDock)
def unload(self):
self.iface.removePluginMenu("Plugin &Inspector",self.actionOpen)
self.iface.removeToolBarIcon(self.actionOpen)
self.iface.unregisterMainWindowAction(self.actionOpen)
def openDock(self):
self.inspectorDock = InspectorDock(self.iface)
self.iface.addDockWidget(Qt.RightDockWidgetArea, self.inspectorDock)