Skip to content

Commit

Permalink
[processing] fied issue with grass icons slowing down toolbox
Browse files Browse the repository at this point in the history
fixes #15550
  • Loading branch information
volaya committed Sep 21, 2016
1 parent 448961b commit 2fda177
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 6 deletions.
10 changes: 7 additions & 3 deletions python/plugins/processing/algs/grass/GrassAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,14 +84,18 @@ def __init__(self, descriptionfile):
self.descriptionFile = descriptionfile
self.defineCharacteristicsFromFile()
self.numExportedLayers = 0
self._icon = None

def getCopy(self):
newone = GrassAlgorithm(self.descriptionFile)
newone.provider = self.provider
return newone

def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
if self._icon is None:
self._icon = QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
return self._icon


def help(self):
return False, 'http://grass.osgeo.org/grass64/manuals/' + self.grassName + '.html'
Expand Down Expand Up @@ -158,7 +162,7 @@ def defineCharacteristicsFromFile(self):
elif isinstance(output, OutputVector):
vectorOutputs += 1
if isinstance(output, OutputHTML):
self.addOutput(OutputFile("rawoutput", output.description +
self.addOutput(OutputFile("rawoutput", output.description +
" (raw output)", "txt"))
line = lines.readline().strip('\n').strip()
except Exception as e:
Expand All @@ -180,7 +184,7 @@ def defineCharacteristicsFromFile(self):
if hasVectorInput:
param = ParameterNumber(self.GRASS_SNAP_TOLERANCE_PARAMETER,
'v.in.ogr snap tolerance (-1 = no snap)',
-1, None, -1.0)
- 1, None, -1.0)
param.isAdvanced = True
self.addParameter(param)
param = ParameterNumber(self.GRASS_MIN_AREA_PARAMETER,
Expand Down
9 changes: 6 additions & 3 deletions python/plugins/processing/algs/grass7/Grass7Algorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def __init__(self, descriptionfile):
self.descriptionFile = descriptionfile
self.defineCharacteristicsFromFile()
self.numExportedLayers = 0
self._icon = None
self.uniqueSufix = unicode(uuid.uuid4()).replace('-', '')

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

def getIcon(self):
return QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
if self._icon is None:
self._icon = QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
return self._icon

def help(self):
localDoc = None
Expand Down Expand Up @@ -192,7 +195,7 @@ def defineCharacteristicsFromFile(self):
elif isinstance(output, OutputVector):
vectorOutputs += 1
if isinstance(output, OutputHTML):
self.addOutput(OutputFile("rawoutput", output.description +
self.addOutput(OutputFile("rawoutput", output.description +
" (raw output)", "txt"))
line = lines.readline().strip('\n').strip()
except Exception as e:
Expand All @@ -214,7 +217,7 @@ def defineCharacteristicsFromFile(self):
if hasVectorInput:
param = ParameterNumber(self.GRASS_SNAP_TOLERANCE_PARAMETER,
'v.in.ogr snap tolerance (-1 = no snap)',
-1, None, -1.0)
- 1, None, -1.0)
param.isAdvanced = True
self.addParameter(param)
param = ParameterNumber(self.GRASS_MIN_AREA_PARAMETER,
Expand Down

0 comments on commit 2fda177

Please sign in to comment.