44 This code is licensed under the GPL 2.0 license.
55"""
66
7- __author__ = "ntreff"
8- __date__ = "July 2025"
9-
10- import sys
11-
127from qgis .core import QgsNetworkAccessManager
13- from qgis .gui import QgsMessageBar
148from qgis .PyQt .QtCore import QObject , Qt , QTimer
159from qgis .PyQt .QtWidgets import QAction , QMenu , QMessageBox , QTreeWidgetItemIterator
16- from qgis_shogun_editor_plugin .connection .shogunressource import ShogunRessource
1710
11+ from ..connection .shogunressource import ShogunRessource
1812from .dialog_bases .connectdlg import ConnectDialog
1913from .dialog_bases .dockwidget import DockWidget
20- from .editoritems import EditorItem , EditorTopItem , QgisLayerItem , ApplicationItem , LayerItem
21- from ..connection .shogunressource import ShogunRessource
14+ from .editoritems import ApplicationItem , EditorItem , EditorTopItem , LayerItem , QgisLayerItem
15+
16+ __author__ = "ntreff"
17+ __date__ = "July 2025"
2218
2319
2420class Editor (QObject ):
@@ -53,12 +49,13 @@ def __init__(self, iface):
5349 'authenticationRequired' (inherited from QNetworkAccessManager) to a
5450 method where a dialog in QGIS pops up asking for the users credentials
5551 (when working with Basic Auth). We disable the signal here as the
56- case of wrong identifacation credentials is treated separately
52+ case of wrong identification credentials is treated separately
5753 in def: checkConnection(self)
5854 """
5955 try :
6056 QgsNetworkAccessManager .instance ().authenticationRequired .disconnect ()
61- except :
57+ except Exception as e :
58+ print ('Error occurred: ' + str (e ))
6259 pass
6360
6461 def on_context_menu (self , point ):
@@ -138,7 +135,8 @@ def on_tree_item_double_clicked(self, item):
138135 if isinstance (item , QgisLayerItem ):
139136 try :
140137 self .iface .showLayerProperties (item .layer )
141- except :
138+ except Exception as e :
139+ print ('Error occurred: ' + str (e ))
142140 pass
143141
144142 def showDialog (self , item ):
@@ -158,7 +156,8 @@ def showDialog(self, item):
158156 try :
159157 dialog .setWindowState (Qt .WindowActive )
160158 dialog .activateWindow ()
161- except :
159+ except Exception as e :
160+ print ('Error occurred: ' + str (e ))
162161 pass
163162
164163 def setupNewConnection (self ):
@@ -175,7 +174,7 @@ def setupNewConnection(self):
175174 pw = self .connectdlg .passwordIn .text ()
176175
177176 if len (url ) == 0 or len (name ) == 0 :
178- self .showWarning (self .connectdlg , "Please fill in all necessary " " fields" )
177+ self .showWarning (self .connectdlg , "Please fill in all necessary fields" )
179178 self .connectdlg .show ()
180179 return
181180
@@ -195,10 +194,10 @@ def setupNewConnection(self):
195194 self .connectdlg .show ()
196195 return
197196
198- bool = newRessource .updateData ()
199- if not bool :
197+ result = newRessource .updateData ()
198+ if not result :
200199 self .showWarning (
201- self .connectdlg , "Error: Could not retrieve all " " data from Shogun"
200+ self .connectdlg , "Error: Could not retrieve all data from Shogun"
202201 )
203202
204203 self .connectdlg .hide ()
@@ -223,7 +222,7 @@ def refreshConnection(self, item):
223222 self .expandEditorTree (item )
224223
225224 def showWarning (self , parent , text ):
226- warn = QMessageBox .warning (parent , "Warning" , text , QMessageBox .Ok )
225+ QMessageBox .warning (parent , "Warning" , text , QMessageBox .Ok )
227226
228227 def uploadStyle (self , item ):
229228 success = item .uploadStyle ()
@@ -249,9 +248,9 @@ def loadAllAppLayers(self, item):
249248 layer .addQgsLayer (self .iface )
250249
251250 def expandEditorTree (self , connectionItem ):
252- iter = QTreeWidgetItemIterator (connectionItem )
253- val = iter .value ()
251+ iterator = QTreeWidgetItemIterator (connectionItem )
252+ val = iterator .value ()
254253 while val :
255254 val .setExpanded (True )
256- iter += 1
257- val = iter .value ()
255+ iterator += 1
256+ val = iterator .value ()
0 commit comments