Skip to content

Commit c2e0205

Browse files
committed
[processing] fied issue with grass icons slowing down toolbox
fixes #15550
1 parent 24f3460 commit c2e0205

File tree

2 files changed

+13
-6
lines changed

2 files changed

+13
-6
lines changed

python/plugins/processing/algs/grass/GrassAlgorithm.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,18 @@ def __init__(self, descriptionfile):
8484
self.descriptionFile = descriptionfile
8585
self.defineCharacteristicsFromFile()
8686
self.numExportedLayers = 0
87+
self._icon = None
8788

8889
def getCopy(self):
8990
newone = GrassAlgorithm(self.descriptionFile)
9091
newone.provider = self.provider
9192
return newone
9293

9394
def getIcon(self):
94-
return QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
95+
if self._icon is None:
96+
self._icon = QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
97+
return self._icon
98+
9599

96100
def help(self):
97101
return False, 'http://grass.osgeo.org/grass64/manuals/' + self.grassName + '.html'
@@ -158,7 +162,7 @@ def defineCharacteristicsFromFile(self):
158162
elif isinstance(output, OutputVector):
159163
vectorOutputs += 1
160164
if isinstance(output, OutputHTML):
161-
self.addOutput(OutputFile("rawoutput", output.description +
165+
self.addOutput(OutputFile("rawoutput", output.description +
162166
" (raw output)", "txt"))
163167
line = lines.readline().strip('\n').strip()
164168
except Exception as e:
@@ -180,7 +184,7 @@ def defineCharacteristicsFromFile(self):
180184
if hasVectorInput:
181185
param = ParameterNumber(self.GRASS_SNAP_TOLERANCE_PARAMETER,
182186
'v.in.ogr snap tolerance (-1 = no snap)',
183-
-1, None, -1.0)
187+
- 1, None, -1.0)
184188
param.isAdvanced = True
185189
self.addParameter(param)
186190
param = ParameterNumber(self.GRASS_MIN_AREA_PARAMETER,

python/plugins/processing/algs/grass7/Grass7Algorithm.py

+6-3
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ def __init__(self, descriptionfile):
8383
self.descriptionFile = descriptionfile
8484
self.defineCharacteristicsFromFile()
8585
self.numExportedLayers = 0
86+
self._icon = None
8687
self.uniqueSufix = unicode(uuid.uuid4()).replace('-', '')
8788

8889
# Use the ext mechanism
@@ -98,7 +99,9 @@ def getCopy(self):
9899
return newone
99100

100101
def getIcon(self):
101-
return QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
102+
if self._icon is None:
103+
self._icon = QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
104+
return self._icon
102105

103106
def help(self):
104107
localDoc = None
@@ -192,7 +195,7 @@ def defineCharacteristicsFromFile(self):
192195
elif isinstance(output, OutputVector):
193196
vectorOutputs += 1
194197
if isinstance(output, OutputHTML):
195-
self.addOutput(OutputFile("rawoutput", output.description +
198+
self.addOutput(OutputFile("rawoutput", output.description +
196199
" (raw output)", "txt"))
197200
line = lines.readline().strip('\n').strip()
198201
except Exception as e:
@@ -214,7 +217,7 @@ def defineCharacteristicsFromFile(self):
214217
if hasVectorInput:
215218
param = ParameterNumber(self.GRASS_SNAP_TOLERANCE_PARAMETER,
216219
'v.in.ogr snap tolerance (-1 = no snap)',
217-
-1, None, -1.0)
220+
- 1, None, -1.0)
218221
param.isAdvanced = True
219222
self.addParameter(param)
220223
param = ParameterNumber(self.GRASS_MIN_AREA_PARAMETER,

0 commit comments

Comments
 (0)