-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSPHY_plugin.py
More file actions
104 lines (91 loc) · 3.73 KB
/
Copy pathSPHY_plugin.py
File metadata and controls
104 lines (91 loc) · 3.73 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
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
# The Spatial Processes in HYdrology (SPHY) model:
# A spatially distributed hydrological model
# Copyright (C) 2013-2019 FutureWater
# Email: sphy@futurewater.nl
#
# Authors (alphabetical order):
# P. Droogers, J. Eekhout, W. Immerzeel, S. Khanal, A. Lutz, G. Simons, W. Terink
#
# 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 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#-Authorship information-###################################################################
__author__ = "FutureWater"
__copyright__ = "FutureWater"
__license__ = "GPL"
__version__ = "1.0"
__email__ = "sphy@futurewater.nl"
__date__ ='1 August 2025'
############################################################################################
"""
/***************************************************************************
SphyPlugin
A QGIS plugin
A tool to convert raw data into SPHY model input data
-------------------
begin : 2025-08-01
git sha : $Format:%H$
copyright : FutureWater
email : info@futurewater.nl
***************************************************************************/
"""
from qgis.PyQt.QtCore import QSettings, QTranslator, qVersion, QCoreApplication
from qgis.PyQt.QtWidgets import QAction
from qgis.PyQt.QtGui import QIcon
# Initialize Qt resources from file resources.py
from SphyPlugin.gui.generated import resources_rc
# Import the code for the dialog
from .SPHY_plugin_dialog import SphyPluginDialog
import os.path
try:
from pydevd import *
except:
None
class SphyPlugin(object):
def __init__(self, iface):
self.iface = iface
# Save reference to the QGIS interface
self.iface = iface
# initialize plugin directory
self.plugin_dir = os.path.dirname(__file__)
# initialize locale
locale = QSettings().value('locale/userLocale')[0:2]
locale_path = os.path.join(
self.plugin_dir,
'i18n',
'SphyPreProcess_{}.qm'.format(locale))
if os.path.exists(locale_path):
self.translator = QTranslator()
self.translator.load(locale_path)
if qVersion() > '4.3.3':
QCoreApplication.installTranslator(self.translator)
# Create the dialog (after translation) and keep reference
self.dlg = SphyPluginDialog()
def initGui(self):
self.action = QAction(QIcon(":/plugins/SphyPlugin/images/icon.png"), u"SPHY PLUGIN", self.iface.mainWindow())
self.action.triggered.connect(self.run)
self.iface.addToolBarIcon(self.action)
self.iface.addPluginToMenu(u"&SPHY PLUGIN", self.action)
def unload(self):
self.iface.removePluginMenu(u"&SPHY PLUGIN", self.action)
self.iface.removeToolBarIcon(self.action)
def run(self):
"""Run method that performs all the real work"""
# show the dialog
self.dlg.show()
# Run the dialog event loop
result = self.dlg.exec_()
# See if OK was pressed
if result:
# Do something useful here - delete the line containing pass and
# substitute with your code.
pass