Skip to content

Commit

Permalink
[processing] add icon caching for other providers
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 4, 2016
1 parent d03d206 commit cc62c52
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 5 deletions.
8 changes: 7 additions & 1 deletion python/plugins/processing/algs/gdal/GdalAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,14 @@

class GdalAlgorithm(GeoAlgorithm):

def __init__(self):
GeoAlgorithm.__init__(self)
self._icon = None

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

def getCustomParametersDialog(self):
return GdalAlgorithmDialog(self)
Expand Down
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/otb/OTBAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ def __init__(self, descriptionfile):
self.defineCharacteristicsFromFile()
self.numExportedLayers = 0
self.hasROI = None
self._icon = None

def __str__(self):
return("Algo : " + self.name + " from app : " + self.cliName + " in : " + self.group)
Expand All @@ -77,7 +78,9 @@ def getCopy(self):
return newone

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

def help(self):
version = OTBUtils.getInstalledVersion()
Expand Down
8 changes: 7 additions & 1 deletion python/plugins/processing/algs/r/RAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@
from processing.script.WrongScriptException import WrongScriptException
from .RUtils import RUtils

pluginPath = os.path.normpath(os.path.join(
os.path.split(os.path.dirname(__file__))[0], os.pardir))


class RAlgorithm(GeoAlgorithm):

Expand All @@ -80,9 +83,12 @@ def __init__(self, descriptionFile, script=None):
self.defineCharacteristicsFromScript()
if descriptionFile is not None:
self.defineCharacteristicsFromFile()
self._icon = None

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/r.svg')
if self._icon is None:
self._icon = QIcon(os.path.join(pluginPath, 'images', 'r.svg'))
return self._icon

def defineCharacteristicsFromScript(self):
lines = self.script.split('\n')
Expand Down
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/saga/SagaAlgorithm212.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,17 @@ def __init__(self, descriptionfile):
self.allowUnmatchingGridExtents = False
self.descriptionFile = descriptionfile
self.defineCharacteristicsFromFile()
self._icon = None

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

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

def defineCharacteristicsFromFile(self):
lines = open(self.descriptionFile)
Expand Down
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/taudem/TauDEMAlgorithm.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,17 @@ def __init__(self, descriptionfile):
GeoAlgorithm.__init__(self)
self.descriptionFile = descriptionfile
self.defineCharacteristicsFromFile()
self._icon = None

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

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

def defineCharacteristicsFromFile(self):
with codecs.open(self.descriptionFile, encoding='utf-8') as f:
Expand Down

0 comments on commit cc62c52

Please sign in to comment.