Skip to content
Permalink
Browse files

[processing] Move some SVG icons out of plugin to themes

...and swap to using QgsApplication methods for retrieving cached icons,
implement svgIconPath for providers with SVG icons
  • Loading branch information
nyalldawson committed Jan 11, 2017
1 parent bf484da commit 04eb29336288caf3ba9a858c23969f2f46cec3cb
Showing with 148 additions and 137 deletions.
  1. +8 −0 images/images.qrc
  2. 0 python/plugins/processing/images/alg.svg → images/themes/default/processingAlgorithm.svg
  3. 0 python/plugins/processing/images/model.svg → images/themes/default/processingModel.svg
  4. 0 python/plugins/processing/images/script.svg → images/themes/default/processingScript.svg
  5. 0 python/plugins/processing/images/gdal.svg → images/themes/default/providerGdal.svg
  6. 0 python/plugins/processing/images/grass.svg → images/themes/default/providerGrass.svg
  7. 0 python/plugins/processing/images/qgis.svg → images/themes/default/providerQgis.svg
  8. 0 python/plugins/processing/images/r.svg → images/themes/default/providerR.svg
  9. +9 −76 python/plugins/processing/images/taudem.svg → images/themes/default/providerTaudem.svg
  10. +2 −2 python/plugins/processing/ProcessingPlugin.py
  11. +3 −1 python/plugins/processing/algs/gdal/GdalAlgorithm.py
  12. +5 −1 python/plugins/processing/algs/gdal/GdalAlgorithmProvider.py
  13. +3 −2 python/plugins/processing/algs/grass7/Grass7Algorithm.py
  14. +5 −1 python/plugins/processing/algs/grass7/Grass7AlgorithmProvider.py
  15. +8 −3 python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py
  16. +3 −1 python/plugins/processing/algs/r/RAlgorithm.py
  17. +5 −2 python/plugins/processing/algs/r/RAlgorithmProvider.py
  18. +2 −2 python/plugins/processing/algs/taudem/TauDEMAlgorithm.py
  19. +6 −1 python/plugins/processing/algs/taudem/TauDEMAlgorithmProvider.py
  20. +3 −1 python/plugins/processing/algs/taudem/dinfdistdown.py
  21. +3 −1 python/plugins/processing/algs/taudem/dinfdistup.py
  22. +3 −1 python/plugins/processing/algs/taudem/dinftranslimaccum.py
  23. +3 −1 python/plugins/processing/algs/taudem/dinftranslimaccum2.py
  24. +3 −1 python/plugins/processing/algs/taudem/dropanalysis.py
  25. +3 −1 python/plugins/processing/algs/taudem/gridnet.py
  26. +3 −1 python/plugins/processing/algs/taudem/lengtharea.py
  27. +4 −2 python/plugins/processing/algs/taudem/peukerdouglas.py
  28. +2 −2 python/plugins/processing/algs/taudem/slopearea.py
  29. +2 −3 python/plugins/processing/core/GeoAlgorithm.py
  30. +5 −4 python/plugins/processing/core/ProcessingConfig.py
  31. +1 −1 python/plugins/processing/gui/BatchPanel.py
  32. +3 −2 python/plugins/processing/gui/ConfigDialog.py
  33. +4 −2 python/plugins/processing/gui/CreateNewScriptAction.py
  34. +9 −7 python/plugins/processing/gui/GetScriptsAndModels.py
  35. +4 −2 python/plugins/processing/gui/ToolboxAction.py
  36. +4 −1 python/plugins/processing/modeler/AddModelFromFileAction.py
  37. +4 −1 python/plugins/processing/modeler/CreateNewModelAction.py
  38. +2 −2 python/plugins/processing/modeler/ModelerAlgorithm.py
  39. +6 −1 python/plugins/processing/modeler/ModelerAlgorithmProvider.py
  40. +3 −2 python/plugins/processing/script/AddScriptFromFileAction.py
  41. +3 −2 python/plugins/processing/script/CreateScriptCollectionPluginAction.py
  42. +6 −3 python/plugins/processing/script/ScriptAlgorithm.py
  43. +6 −1 python/plugins/processing/script/ScriptAlgorithmProvider.py
@@ -550,6 +550,14 @@
<file>themes/default/mTaskRunning.svg</file>
<file>themes/default/mTaskTerminated.svg</file>
<file>themes/default/mTaskCancel.svg</file>
<file>themes/default/providerGdal.svg</file>
<file>themes/default/providerGrass.svg</file>
<file>themes/default/providerQgis.svg</file>
<file>themes/default/providerR.svg</file>
<file>themes/default/providerTaudem.svg</file>
<file>themes/default/processingModel.svg</file>
<file>themes/default/processingScript.svg</file>
<file>themes/default/processingAlgorithm.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -13,11 +13,11 @@
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="svg3399"
version="1.1"
inkscape:version="0.91 r13725"
inkscape:version="0.92pre3 r"
width="25.4mm"
height="25.4mm"
viewBox="0 0 89.999998 89.999999"
sodipodi:docname="taudem.svg">
sodipodi:docname="providerTaudem.svg">
<metadata
id="metadata3405">
<rdf:RDF>
@@ -32,30 +32,6 @@
</metadata>
<defs
id="defs3403">
<linearGradient
inkscape:collect="always"
id="linearGradient5605">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop5607" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop5610" />
</linearGradient>
<linearGradient
inkscape:collect="always"
id="linearGradient5613">
<stop
style="stop-color:#000000;stop-opacity:1;"
offset="0"
id="stop5615" />
<stop
style="stop-color:#000000;stop-opacity:0;"
offset="1"
id="stop5617" />
</linearGradient>
<linearGradient
id="linearGradient5607"
osb:paint="solid">
@@ -94,35 +70,6 @@
y2="699.9278"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(0,-654.09448)" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5589"
id="linearGradient5593"
x1="54.945377"
y1="51.502598"
x2="85.780338"
y2="51.502598"
gradientUnits="userSpaceOnUse" />
<linearGradient
inkscape:collect="always"
xlink:href="#linearGradient5613"
id="linearGradient5619"
x1="54.445377"
y1="51.502598"
x2="86.280338"
y2="51.502598"
gradientUnits="userSpaceOnUse" />
<radialGradient
inkscape:collect="always"
xlink:href="#linearGradient5605"
id="radialGradient5612"
cx="71.826358"
cy="50.677773"
fx="71.826358"
fy="50.677773"
r="15.378681"
gradientTransform="matrix(1,0,0,0.317652,0,34.579877)"
gradientUnits="userSpaceOnUse" />
</defs>
<sodipodi:namedview
pagecolor="#ffffff"
@@ -133,8 +80,8 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="714"
inkscape:window-width="1920"
inkscape:window-height="1016"
id="namedview3401"
showgrid="false"
fit-margin-top="0"
@@ -143,12 +90,12 @@
fit-margin-bottom="0"
units="mm"
inkscape:zoom="2.1213203"
inkscape:cx="-78.093983"
inkscape:cy="46.505347"
inkscape:cx="37.400126"
inkscape:cy="64.418719"
inkscape:window-x="0"
inkscape:window-y="25"
inkscape:window-y="27"
inkscape:window-maximized="1"
inkscape:current-layer="layer1" />
inkscape:current-layer="layer3" />
<g
inkscape:groupmode="layer"
id="layer1"
@@ -178,19 +125,5 @@
<g
inkscape:groupmode="layer"
id="layer3"
inkscape:label="dem">
<text
xml:space="preserve"
style="font-style:italic;font-variant:normal;font-weight:bold;font-stretch:normal;font-size:12.07694149px;line-height:125%;font-family:Sans;-inkscape-font-specification:'Sans Bold Italic';letter-spacing:0px;word-spacing:0px;opacity:0.766;fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.966;stroke-linecap:round;stroke-linejoin:round;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;"
x="56.677109"
y="55.079842"
id="text4139"
sodipodi:linespacing="125%"
transform="scale(0.97457262,1.0260908)"><tspan
sodipodi:role="line"
id="tspan4141"
x="56.677109"
y="55.079842"
style="fill:#ffffff;fill-opacity:1;stroke:#000000;stroke-width:0.966;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-linejoin:round;stroke-linecap:round;">DEM</tspan></text>
</g>
inkscape:label="dem" />
</svg>
@@ -72,13 +72,13 @@ def initGui(self):
self.toolboxAction = self.toolbox.toggleViewAction()
self.toolboxAction.setObjectName('toolboxAction')
self.toolboxAction.setIcon(
QIcon(os.path.join(cmd_folder, 'images', 'alg.svg')))
QgsApplication.getThemeIcon("/processingAlgorithm.svg"))
self.toolboxAction.setText(self.tr('&Toolbox'))
self.iface.registerMainWindowAction(self.toolboxAction, 'Ctrl+Alt+T')
self.menu.addAction(self.toolboxAction)

self.modelerAction = QAction(
QIcon(os.path.join(cmd_folder, 'images', 'model.svg')),
QgsApplication.getThemeIcon("/processingModel.svg"),
self.tr('Graphical &Modeler...'), self.iface.mainWindow())
self.modelerAction.setObjectName('modelerAction')
self.modelerAction.triggered.connect(self.openModeler)
@@ -31,6 +31,8 @@
from qgis.PyQt.QtGui import QIcon
from qgis.PyQt.QtCore import QUrl

from qgis.core import QgsApplication

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.algs.gdal.GdalAlgorithmDialog import GdalAlgorithmDialog
from processing.algs.gdal.GdalUtils import GdalUtils
@@ -48,7 +50,7 @@ def __init__(self):

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

def getCustomParametersDialog(self):
@@ -28,6 +28,7 @@
import os
from qgis.PyQt.QtGui import QIcon

from qgis.core import QgsApplication
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from .GdalUtils import GdalUtils
@@ -120,7 +121,10 @@ def id(self):
return 'gdal'

def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'gdal.svg'))
return QgsApplication.getThemeIcon("/providerGdal.svg")

def svgIconPath(self):
return QgsApplication.iconPath("providerGdal.svg")

def _loadAlgorithms(self):
self.algs = self.preloadedAlgs
@@ -35,7 +35,8 @@
from qgis.PyQt.QtCore import QCoreApplication, QUrl
from qgis.PyQt.QtGui import QIcon

from qgis.core import QgsRasterLayer
from qgis.core import (QgsRasterLayer,
QgsApplication)
from qgis.utils import iface

from processing.core.GeoAlgorithm import GeoAlgorithm
@@ -102,7 +103,7 @@ def getCopy(self):

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

def help(self):
@@ -28,6 +28,7 @@

import os
from qgis.PyQt.QtGui import QIcon
from qgis.core import QgsApplication
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.core.ProcessingLog import ProcessingLog
@@ -105,7 +106,10 @@ def id(self):
return 'grass7'

def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'grass.svg'))
return QgsApplication.getThemeIcon("/providerGrass.svg")

def svgIconPath(self):
return QgsApplication.iconPath("providerGrass.svg")

def getSupportedOutputVectorLayerExtensions(self):
return ['shp']
@@ -43,7 +43,9 @@

from qgis.PyQt.QtGui import QIcon

from qgis.core import Qgis, QgsWkbTypes
from qgis.core import (Qgis,
QgsWkbTypes,
QgsApplication)

from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.script.ScriptUtils import ScriptUtils
@@ -197,7 +199,7 @@ class QGISAlgorithmProvider(AlgorithmProvider):

def __init__(self):
super().__init__()
self._icon = QIcon(os.path.join(pluginPath, 'images', 'qgis.svg'))
self._icon = QgsApplication.getThemeIcon("/providerQgis.svg")

self.alglist = [SumLines(), PointsInPolygon(),
PointsInPolygonWeighted(), PointsInPolygonUnique(),
@@ -304,7 +306,10 @@ def name(self):
return 'QGIS'

def icon(self):
return self._icon
return QgsApplication.getThemeIcon("/providerQgis.svg")

def svgIconPath(self):
return QgsApplication.iconPath("providerQgis.svg")

def _loadAlgorithms(self):
self.algs = list(self.alglist) + self.externalAlgs
@@ -33,6 +33,8 @@

from qgis.PyQt.QtGui import QIcon

from qgis.core import QgsApplication

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
from processing.core.ProcessingLog import ProcessingLog
@@ -88,7 +90,7 @@ def __init__(self, descriptionFile, script=None):

def getIcon(self):
if self._icon is None:
self._icon = QIcon(os.path.join(pluginPath, 'images', 'r.svg'))
self._icon = QgsApplication.getThemeIcon("/providerR.svg")
return self._icon

def defineCharacteristicsFromScript(self):
@@ -29,7 +29,7 @@
import os

from qgis.PyQt.QtGui import QIcon

from qgis.core import QgsApplication
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.ProcessingLog import ProcessingLog
from processing.core.AlgorithmProvider import AlgorithmProvider
@@ -87,7 +87,10 @@ def unload(self):
ProcessingConfig.removeSetting(RUtils.R_USE64)

def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'r.svg'))
return QgsApplication.getThemeIcon("/providerR.svg")

def svgIconPath(self):
return QgsApplication.iconPath("providerR.svg")

def name(self):
return 'R scripts'
@@ -31,7 +31,7 @@
import os
import codecs

from qgis.PyQt.QtGui import QIcon
from qgis.core import QgsApplication

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.ProcessingLog import ProcessingLog
@@ -68,7 +68,7 @@ def getCopy(self):

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

def defineCharacteristicsFromFile(self):
@@ -30,6 +30,8 @@

from qgis.PyQt.QtGui import QIcon

from qgis.core import QgsApplication

from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.ProcessingLog import ProcessingLog
@@ -64,7 +66,10 @@ def id(self):
return 'taudem'

def icon(self):
return QIcon(os.path.join(pluginPath, 'images', 'taudem.svg'))
return QgsApplication.getThemeIcon("/providerTaudem.svg")

def svgIconPath(self):
return QgsApplication.iconPath("providerTaudem.svg")

def initializeSettings(self):
AlgorithmProvider.initializeSettings(self)
@@ -32,6 +32,8 @@

from qgis.PyQt.QtGui import QIcon

from qgis.core import QgsApplication

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
@@ -68,7 +70,7 @@ class DinfDistDown(GeoAlgorithm):
}

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/taudem.svg')
return QgsApplication.getThemeIcon("/providerTaudem.svg")

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('D-Infinity Distance Down')
@@ -32,6 +32,8 @@

from qgis.PyQt.QtGui import QIcon

from qgis.core import QgsApplication

from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.core.ProcessingConfig import ProcessingConfig
from processing.core.GeoAlgorithmExecutionException import GeoAlgorithmExecutionException
@@ -69,7 +71,7 @@ class DinfDistUp(GeoAlgorithm):
}

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/taudem.svg')
return QgsApplication.getThemeIcon("/providerTaudem.svg")

def defineCharacteristics(self):
self.name, self.i18n_name = self.trAlgorithm('D-Infinity Distance Up')

0 comments on commit 04eb293

Please sign in to comment.
You can’t perform that action at this time.