Bläddra i källkod

minor fixes

- init processing provider correclty to allow reloading of plugin
- fix processing progress bug when called without gui
  see https://gis.stackexchange.com/a/250134
- log client errors to console when not using QgsMsgbar
feature/processing_qgs2
Norwin Roosen 1 år sedan
förälder
incheckning
52fb371656
Inget konto är kopplat till bidragsgivarens mejladress
3 ändrade filer med 9 tillägg och 3 borttagningar
  1. 4
    0
      core/client.py
  2. 4
    2
      osm_tools.py
  3. 1
    1
      osmtools_processing/isochrones.py

+ 4
- 0
core/client.py Visa fil

@@ -140,6 +140,8 @@ class Client(object):
140 140
                                                     'Request limit of {} per minute exceeded. '
141 141
                                                     'Wait for {} seconds'.format(self.queries_per_minute,
142 142
                                                                                 60 - elapsed_since_earliest))
143
+                else:
144
+                    print "Ratelimit exceeded. Please wait 60s before the next request"
143 145
                 time.sleep(60 - elapsed_since_earliest)
144 146
 
145 147
         # Determine GET/POST.
@@ -173,6 +175,8 @@ class Client(object):
173 175
 
174 176
             if self.iface:
175 177
                 self.iface.messageBar().pushInfo('Rate limit exceeded.\nRetrying for the {}th time.'.format(retry_counter + 1))
178
+            else:
179
+                print "Ratelimit exceeded. Retrying.."
176 180
             return self.request(url, params, first_request_time,
177 181
                                  retry_counter + 1, requests_kwargs, post_json)
178 182
         except:

+ 4
- 2
osm_tools.py Visa fil

@@ -86,8 +86,6 @@ class OSMtools():
86 86
         self.script_dir = os.path.dirname(os.path.abspath(__file__))
87 87
         self.provider = OSMtoolsAlgoProvider()
88 88
 
89
-        # Add to processing
90
-        Processing.addProvider(self.provider, True)
91 89
 
92 90
 
93 91
     # noinspection PyMethodMayBeStatic
@@ -118,10 +116,14 @@ class OSMtools():
118 116
         self.iface.addToolBarIcon(self.action)
119 117
         self.action.triggered.connect(self.run)
120 118
 
119
+        # Add to processing
120
+        Processing.addProvider(self.provider, True)
121
+
121 122
     def unload(self):
122 123
         QApplication.restoreOverrideCursor()
123 124
         self.iface.removePluginWebMenu(u"&OSM Tools", self.action)
124 125
         self.iface.removeToolBarIcon(self.action)
126
+        Processing.removeProvider(self.provider)
125 127
         del self.toolbar
126 128
 
127 129
 

+ 1
- 1
osmtools_processing/isochrones.py Visa fil

@@ -144,7 +144,7 @@ class IsochronesGeoAlg(GeoAlgorithm):
144 144
             progress.setInfo('Simplifying geometry')
145 145
             # merge overlapping polygons of same range
146 146
             groupByColumn = 'AA_MINS' if metric == 'time' else 'AA_METERS'
147
-            dissolved = runalg('qgis:dissolve', tmpFile, False, groupByColumn, None)
147
+            dissolved = runalg('qgis:dissolve', tmpFile, False, groupByColumn, None, progress=None)
148 148
             isoLayer = getObjectFromUri(dissolved['OUTPUT'])
149 149
 
150 150
             # make polygons of different ranges distinct

Laddar…
Avbryt
Spara