4646
4747# Initialize Qt resources from file resources.py
4848
49+
4950class QgisShogunEditor :
5051 """QGIS Plugin Implementation."""
5152
@@ -87,9 +88,9 @@ def __init__(self, iface):
8788 # read actual browser model
8889 self .browser_model = QgsBrowserModel ()
8990
90- #network access
91+ # network access
9192 self .na_manager = QgsNetworkAccessManager .instance ()
92- self .request = QNetworkRequest ()
93+ self .request = QNetworkRequest ()
9394
9495 # Achtung: T/F bei Zertifikaten
9596 self .disable_ssl_verification = self .settings .value (
@@ -113,18 +114,17 @@ def tr(self, message):
113114 # noinspection PyTypeChecker,PyArgumentList,PyCallByClass
114115 return QCoreApplication .translate ('ShogunQgisConfigurator' , message )
115116
116-
117117 def add_action (
118- self ,
119- icon_path ,
120- text ,
121- callback ,
122- enabled_flag = True ,
123- add_to_menu = True ,
124- add_to_toolbar = True ,
125- status_tip = None ,
126- whats_this = None ,
127- parent = None ):
118+ self ,
119+ icon_path ,
120+ text ,
121+ callback ,
122+ enabled_flag = True ,
123+ add_to_menu = True ,
124+ add_to_toolbar = True ,
125+ status_tip = None ,
126+ whats_this = None ,
127+ parent = None ):
128128 """Add a toolbar icon to the toolbar.
129129
130130 :param icon_path: Path to the icon for this action. Can be a resource
@@ -200,7 +200,6 @@ def initGui(self):
200200 # will be set False in run()
201201 self .first_start = True
202202
203-
204203 def unload (self ):
205204 """Removes the plugin menu item and icon from QGIS GUI."""
206205 for action in self .actions :
@@ -214,7 +213,7 @@ def run(self):
214213
215214 # Create the dialog with elements (after translation) and keep reference
216215 # Only create GUI ONCE in callback, so that it will only load when the plugin is started
217- if self .first_start == True :
216+ if self .first_start :
218217 self .first_start = False
219218 self .dlg = QgisShogunEditorDialog ()
220219
@@ -228,13 +227,14 @@ def run(self):
228227 # build
229228 pixmap = QPixmap (logo_path )
230229 # draw preview
231- self .dlg .labelLogo .setPixmap (pixmap .scaled (self .dlg .labelLogo .size (), Qt .KeepAspectRatio , Qt .SmoothTransformation ))
230+ self .dlg .labelLogo .setPixmap (pixmap .scaled (self .dlg .labelLogo .size (),
231+ Qt .KeepAspectRatio , Qt .SmoothTransformation ))
232232 self .dlg .labelLogo .mousePressEvent = self .open_project_link
233233 else :
234234 QgsMessageLog .logMessage ("An error occured while try to open url: " , 'QgisShogunEditor' ,
235235 level = Qgis .Critical )
236236 # add link to github for help
237- help_icon_path = os .path .join (os .path .dirname (__file__ ), "questionmark.png" )
237+ # help_icon_path = os.path.join(os.path.dirname(__file__), "questionmark.png")
238238 # show the dialog
239239 self .dlg .show ()
240240 # Run the dialog event loop
@@ -278,10 +278,10 @@ def check_url_for_layers(self, input_url):
278278 return input_url + 's'
279279 elif input_url .endswith ('/' ):
280280 return input_url + 'layers'
281-
281+
282282 def request_public_entity (self , url ):
283283 self .request .setUrl (QUrl (url ))
284-
284+
285285 # no certificate
286286 ssl_config = self .request .sslConfiguration ()
287287 ssl_config .setPeerVerifyMode (QSslSocket .VerifyNone )
@@ -292,10 +292,10 @@ def request_public_entity(self, url):
292292 eventLoop = QEventLoop ()
293293 self .reply .finished .connect (eventLoop .quit )
294294 eventLoop .exec_ () # blocs until finished
295-
295+
296296 if self .reply .error () == self .reply .NoError :
297297 self .response = self .reply .readAll ().data ().decode ("utf-8" )
298- #print("Response:", self.response)
298+ # print("Response:", self.response)
299299 else :
300300 self .response = None
301301 print ("Error:" , self .reply .errorString ())
@@ -321,9 +321,9 @@ def load_applications(self):
321321 # check url
322322 applications_url = self .check_url_for_applications (inputUrl )
323323 layers_url = self .check_url_for_layers (inputUrl )
324- if (len (applications_url ) > 0 and len (layers_url ) > 0 ):
324+ if (len (applications_url ) > 0 and len (layers_url ) > 0 ):
325325 # request (all public) applications
326- applications_response = self .request_public_entity (applications_url )
326+ applications_response = self .request_public_entity (applications_url )
327327 applications_json = json .loads (applications_response )
328328 applicatons_content = applications_json ['content' ][0 ]
329329 applications_layertree = applicatons_content ['layerTree' ]
0 commit comments