-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathnavigation_analyzer.py
87 lines (63 loc) · 2.27 KB
/
navigation_analyzer.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
78
79
80
81
82
83
84
85
86
87
from __future__ import unicode_literals
from __future__ import absolute_import
# system modules
import math
import webbrowser
# QGIS modules
from qgis.core import *
from qgis.PyQt.QtCore import Qt
from qgis.PyQt.QtWidgets import *
from qgis.PyQt import uic
from shapely.geometry import MultiLineString, mapping, shape
# promaides modules
from .environment import get_ui_path
#Connection to the UI-file (GUI); Edit the ui-file via QTCreator
UI_PATH = get_ui_path('ui_navigation_analyzer.ui')
# This plugin serves as learning and test plugin
class PluginDialog(QDialog):
#set-up of the dialog
def __init__(self, iface, parent=None, flags=Qt.WindowFlags()):
QDialog.__init__(self, parent, flags)
#load the ui
uic.loadUi(UI_PATH, self)
self.iface = iface
self.HelpButton.clicked.connect(self.Help)
def Help(self):
webbrowser.open("https://promaides.myjetbrains.com/youtrack/articles/PMDP-A-52/Hello-World")
class Navigation_Analyzer(object):
def __init__(self, iface):
self.iface = iface
self.dialog = None
self.cancel = False
self.act = QAction('Navigation Analyzer', iface.mainWindow())
self.act.triggered.connect(self.execDialog)
def initGui(self, menu=None):
if menu is not None:
menu.addAction(self.act)
else:
self.iface.addToolBarIcon(self.act)
def unload(self, menu=None):
if menu is None:
menu.removeAction(self.act)
else:
self.iface.removeToolBarIcon(self.act)
#connect here the buttons to functions, e.g. "OK"-button to execTool
def execDialog(self):
"""
"""
self.dialog = PluginDialog(self.iface, self.iface.mainWindow())
self.dialog.accepted.connect(self.execTool)
self.dialog.rejected.connect(self.quitDialog)
self.dialog.show()
def scheduleAbort(self):
self.cancel = True
#Quit the dialog; in general make nothing
def quitDialog(self):
self.dialog = None
self.act.setEnabled(True)
self.cancel = False
#Execution of the tool by "ok" button
def execTool(self):
#Print text of the lineEdit to the QGIs python console
print(self.dialog.lineEdit_1.text())
self.quitDialog()