-
Notifications
You must be signed in to change notification settings - Fork 8
/
wfsclient.py
126 lines (110 loc) · 5.63 KB
/
wfsclient.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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
"""
/***************************************************************************
WfsClient
A QGIS plugin
WFS 2.0 Client
-------------------
begin : 2012-05-17
copyright : (C) 2012 by Juergen Weichand
email : [email protected]
website : http://www.weichand.de
***************************************************************************/
/***************************************************************************
* *
* 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 the PyQt and QGIS libraries
from PyQt5.QtCore import *
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from qgis.core import *
# Initialize Qt resources from file resources.py
from .resources import *
# Import the code for the dialog
from .wfsclientdialog import WfsClientDialog
from .wfsclientconfigdialog import WfsClientConfigDialog
class WfsClient:
def __init__(self, iface):
# Save reference to the QGIS interface
self.iface = iface
def initGui(self):
# Create action that will start plugin configuration
self.clientAction = QAction(QIcon(":/plugins/wfsclient/icon.png"), \
"WFS 2.0 Client", self.iface.mainWindow())
# connect the action to the run method
self.clientAction.triggered.connect(self.runClient)
self.configAction = QAction(QIcon(":/plugins/wfsclient/icon.png"), \
"Config", self.iface.mainWindow())
# connect the action to the run method
self.configAction.triggered.connect(self.runConfig)
self.aboutAction=QAction(QIcon(":/plugins/wfsclient/icon.png"), \
"About", self.iface.mainWindow())
self.aboutAction.triggered.connect(self.about)
# Add toolbar button and menu item
if hasattr( self.iface, "addPluginToWebMenu" ):
self.iface.addPluginToWebMenu("&WFS 2.0 Client", self.clientAction)
self.iface.addPluginToWebMenu("&WFS 2.0 Client", self.configAction)
self.iface.addPluginToWebMenu("&WFS 2.0 Client", self.aboutAction)
self.iface.addWebToolBarIcon(self.clientAction)
else:
self.iface.addToolBarIcon(self.clientAction)
self.iface.addPluginToMenu("&WFS 2.0 Client", self.clientAction)
self.iface.addPluginToMenu("&WFS 2.0 Client", self.configAction)
self.iface.addPluginToMenu("&WFS 2.0 Client", self.aboutAction)
def unload(self):
# Remove the plugin menu item and icon
if hasattr( self.iface, "addPluginToWebMenu" ):
self.iface.removePluginWebMenu("&WFS 2.0 Client", self.clientAction)
self.iface.removePluginWebMenu("&WFS 2.0 Client", self.configAction)
self.iface.removePluginWebMenu("&WFS 2.0 Client", self.aboutAction)
self.iface.removeWebToolBarIcon(self.clientAction)
else:
self.iface.removeToolBarIcon(self.clientAction)
self.iface.removePluginMenu("&WFS 2.0 Client", self.clientAction)
self.iface.removePluginMenu("&WFS 2.0 Client", self.configAction)
self.iface.removePluginMenu("&WFS 2.0 Client", self.aboutAction)
def about(self):
infoString = "<table>" \
"<tr><td colspan=\"2\"><b>WFS 2.0 Client 0.9.11</b></td></tr>" \
"<tr><td colspan=\"2\"></td></tr>" \
"<tr><td rowspan=\"3\">Authors:</td>" \
"<td>Jürgen Weichand " \
"(<a href=\"mailto:[email protected]\">[email protected]</a>)</td></tr>" \
"<tr><td>Tim Vinzing</td></tr>" \
"<tr><td>Edward Nash " \
"(<a href=\"mailto:[email protected]\">[email protected]</a>)</td></tr>" \
"<tr><td colspan=\"2\"></td></tr>" \
"<tr><td>Website:</td>" \
"<td><a href=\"https://github.com/qgisinspiretools/qgis-wfs20-client-plugin\">" \
"https://github.com/qgisinspiretools/qgis-wfs20-client-plugin</a></td></tr>" \
"</table>"
QMessageBox.information(self.iface.mainWindow(), "About WFS 2.0 Client", infoString)
# run method that performs all the real work
def runClient(self, url=None):
# create and show the dialog
dlg = WfsClientDialog(self, url)
# show the dialog
dlg.show()
result = dlg.exec_()
# See if OK was pressed
if result == 1:
# do something useful (delete the line containing pass and
# substitute with your code
pass
# run method that performs all the real work
def runConfig(self):
# create and show the dialog
dlg = WfsClientConfigDialog(self)
# show the dialog
dlg.show()
result = dlg.exec_()
# See if OK was pressed
if result == 1:
# do something useful (delete the line containing pass and
# substitute with your code
pass