Skip to content

Commit d265f33

Browse files
committedSep 13, 2016
[processing] cache icons to speed up toolbox rendering
fixes #15550
1 parent f55d7d3 commit d265f33

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed
 

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666
pluginPath = os.path.normpath(os.path.join(
6767
os.path.split(os.path.dirname(__file__))[0], os.pardir))
6868

69+
_icon = QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
6970

7071
class GrassAlgorithm(GeoAlgorithm):
7172

@@ -89,9 +90,10 @@ def getCopy(self):
8990
newone = GrassAlgorithm(self.descriptionFile)
9091
newone.provider = self.provider
9192
return newone
92-
93+
9394
def getIcon(self):
94-
return QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
95+
return _icon
96+
9597

9698
def help(self):
9799
return False, 'http://grass.osgeo.org/grass64/manuals/' + self.grassName + '.html'
@@ -121,11 +123,10 @@ def defineCharacteristicsFromFile(self):
121123
line = lines.readline().strip('\n').strip()
122124
self.grassName = line
123125
line = lines.readline().strip('\n').strip()
124-
self.name = line
125-
self.i18n_name = QCoreApplication.translate("GrassAlgorithm", line)
126-
if " - " not in self.name:
127-
self.name = self.grassName + " - " + self.name
128-
self.i18n_name = self.grassName + " - " + self.i18n_name
126+
self.name = line.split("-")[0]
127+
#self.i18n_name = QCoreApplication.translate("GrassAlgorithm", self.name)
128+
self.name = self.grassName
129+
self.i18n_name = self.grassName
129130
line = lines.readline().strip('\n').strip()
130131
self.group = line
131132
self.i18n_group = QCoreApplication.translate("GrassAlgorithm", line)

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

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
pluginPath = os.path.normpath(os.path.join(
6666
os.path.split(os.path.dirname(__file__))[0], os.pardir))
6767

68+
_icon = QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
6869

6970
class Grass7Algorithm(GeoAlgorithm):
7071

@@ -98,8 +99,8 @@ def getCopy(self):
9899
return newone
99100

100101
def getIcon(self):
101-
return QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
102-
102+
return _icon
103+
103104
def help(self):
104105
localDoc = None
105106
html = self.grass7Name + '.html'

‎python/plugins/processing/algs/otb/OTBAlgorithm.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
pluginPath = os.path.normpath(os.path.join(
5252
os.path.split(os.path.dirname(__file__))[0], os.pardir))
5353

54+
_icon = QIcon(os.path.join(pluginPath, 'images', 'otb.png'))
5455

5556
class OTBAlgorithm(GeoAlgorithm):
5657

@@ -73,7 +74,7 @@ def getCopy(self):
7374
return newone
7475

7576
def getIcon(self):
76-
return QIcon(os.path.join(pluginPath, 'images', 'otb.png'))
77+
return _icon
7778

7879
def help(self):
7980
version = OTBUtils.getInstalledVersion()

‎python/plugins/processing/algs/saga/SagaAlgorithm212.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757

5858
sessionExportedLayers = {}
5959

60+
_icon = QIcon(os.path.join(pluginPath, 'images', 'saga.png'))
6061

6162
class SagaAlgorithm212(GeoAlgorithm):
6263

@@ -75,8 +76,8 @@ def getCopy(self):
7576
return newone
7677

7778
def getIcon(self):
78-
return QIcon(os.path.join(pluginPath, 'images', 'saga.png'))
79-
79+
return _icon
80+
8081
def defineCharacteristicsFromFile(self):
8182
lines = open(self.descriptionFile)
8283
line = lines.readline().strip('\n').strip()

1 commit comments

Comments
 (1)

nyalldawson commented on Sep 13, 2016

@nyalldawson
Collaborator

@volaya I've had to revert this change - it broke all the processing tests on Travis. Can you rework and push again?

Please sign in to comment.