Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[processing] drop resources.qrc and load images dynamically. Also remove
unused images
  • Loading branch information
alexbruy committed May 19, 2015
1 parent fd7568a commit 30dbd8f
Show file tree
Hide file tree
Showing 44 changed files with 177 additions and 1,482 deletions.
4 changes: 1 addition & 3 deletions python/plugins/processing/CMakeLists.txt
Expand Up @@ -15,7 +15,5 @@ PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
FILE(GLOB OTHER_FILES metadata.txt)
FILE(GLOB PY_FILES *.py)

PYQT4_ADD_RESOURCES(PYRC_FILES resources.qrc)

PLUGIN_INSTALL(processing . ${PY_FILES} ${OTHER_FILES} ${PYRC_FILES})
PLUGIN_INSTALL(processing . ${PY_FILES} ${OTHER_FILES})
PLUGIN_INSTALL(processing ui ${PYUI_FILES} ui/__init__.py)
18 changes: 11 additions & 7 deletions python/plugins/processing/ProcessingPlugin.py
Expand Up @@ -42,7 +42,6 @@
from processing.modeler.ModelerDialog import ModelerDialog
from processing.tools.system import tempFolder

import processing.resources_rc

cmd_folder = os.path.split(inspect.getfile(inspect.currentframe()))[0]
if cmd_folder not in sys.path:
Expand All @@ -68,29 +67,34 @@ def initGui(self):

self.toolboxAction = self.toolbox.toggleViewAction()
self.toolboxAction.setObjectName('toolboxAction')
self.toolboxAction.setIcon(QIcon(':/processing/images/alg.png'))
self.toolboxAction.setIcon(
QIcon(os.path.join(cmd_folder, 'images', 'alg.png')))
self.toolboxAction.setText(self.tr('&Toolbox'))
self.menu.addAction(self.toolboxAction)

self.modelerAction = QAction(QIcon(':/processing/images/model.png'),
self.modelerAction = QAction(
QIcon(os.path.join(cmd_folder, 'images', 'model.png')),
self.tr('Graphical &Modeler...'), self.iface.mainWindow())
self.modelerAction.setObjectName('modelerAction')
self.modelerAction.triggered.connect(self.openModeler)
self.menu.addAction(self.modelerAction)

self.historyAction = QAction(QIcon(':/processing/images/history.gif'),
self.historyAction = QAction(
QIcon(os.path.join(cmd_folder, 'images', 'history.gif')),
self.tr('&History and Log...'), self.iface.mainWindow())
self.historyAction.setObjectName('historyAction')
self.historyAction.triggered.connect(self.openHistory)
self.menu.addAction(self.historyAction)

self.configAction = QAction(QIcon(':/processing/images/config.png'),
self.configAction = QAction(
QIcon(os.path.join(cmd_folder, 'images', 'config.png')),
self.tr('&Options...'), self.iface.mainWindow())
self.configAction.setObjectName('configAction')
self.configAction.triggered.connect(self.openConfig)
self.menu.addAction(self.configAction)

self.resultsAction = QAction(QIcon(':/processing/images/results.png'),
self.resultsAction = QAction(
QIcon(os.path.join(cmd_folder, 'images', 'results.png')),
self.tr('&Results Viewer...'), self.iface.mainWindow())
self.resultsAction.setObjectName('resultsAction')
self.resultsAction.triggered.connect(self.openResults)
Expand All @@ -101,7 +105,7 @@ def initGui(self):
self.iface.firstRightStandardMenu().menuAction(), self.menu)

self.commanderAction = QAction(
QIcon(':/processing/images/commander.png'),
QIcon(os.path.join(cmd_folder, 'images', 'commander.png')),
self.tr('&Commander'), self.iface.mainWindow())
self.commanderAction.setObjectName('commanderAction')
self.commanderAction.triggered.connect(self.openCommander)
Expand Down
10 changes: 7 additions & 3 deletions python/plugins/processing/algs/gdal/GdalAlgorithm.py
Expand Up @@ -27,28 +27,32 @@
__revision__ = '$Format:%H$'

import os
from PyQt4 import QtGui
from PyQt4.QtGui import QIcon
from processing.script.ScriptAlgorithm import ScriptAlgorithm
from processing.core.GeoAlgorithm import GeoAlgorithm
from processing.algs.gdal.GdalAlgorithmDialog import GdalAlgorithmDialog
from processing.algs.gdal.GdalUtils import GdalUtils

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


class GdalAlgorithm(GeoAlgorithm):

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + '/../../images/gdal.png')
return QIcon(os.path.join(pluginPath, 'images', 'gdal.png'))

def getCustomParametersDialog(self):
return GdalAlgorithmDialog(self)

def processAlgorithm(self, progress):
GdalUtils.runGdal(self.getConsoleCommands(), progress)


class GdalScriptAlgorithm(ScriptAlgorithm):

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + '/../../images/gdal.png')
return QIcon(os.path.join(pluginPath, 'images', 'gdal.png'))

def getCustomParametersDialog(self):
return GdalAlgorithmDialog(self)
Expand Up @@ -84,6 +84,9 @@
from ogrinfo import OgrInfo
from ogrsql import OgrSql

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


class GdalOgrAlgorithmProvider(AlgorithmProvider):
"""This provider incorporates GDAL-based algorithms into the
Expand Down Expand Up @@ -117,7 +120,7 @@ def getName(self):
return 'gdalogr'

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/gdal.png')
return QIcon(os.path.join(pluginPath, 'images', 'gdal.png'))

def _loadAlgorithms(self):
self.algs = self.preloadedAlgs
Expand Down
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/grass/GrassAlgorithm.py
Expand Up @@ -48,6 +48,9 @@

from processing.tools import dataobjects, system

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


class GrassAlgorithm(GeoAlgorithm):

Expand Down Expand Up @@ -76,7 +79,7 @@ def getCopy(self):
return newone

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/grass.png')
return QIcon(os.path.join(pluginPath, 'images', 'grass.png'))

def help(self):
return False, 'http://grass.osgeo.org/grass64/manuals/' + self.grassName + '.html'
Expand Down
Expand Up @@ -36,6 +36,9 @@
from nviz import nviz
from processing.tools.system import isMac, isWindows

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


class GrassAlgorithmProvider(AlgorithmProvider):

Expand Down Expand Up @@ -94,7 +97,7 @@ def getName(self):
return 'grass'

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/grass.png')
return QIcon(os.path.join(pluginPath, 'images', 'grass.png'))

def getSupportedOutputVectorLayerExtensions(self):
return ['shp']
Expand Down
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/grass/nviz.py
Expand Up @@ -40,6 +40,9 @@
from processing.tools.system import getNumExportedLayers
from processing.tools import dataobjects

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


class nviz(GeoAlgorithm):

Expand All @@ -50,7 +53,7 @@ class nviz(GeoAlgorithm):
GRASS_REGION_CELLSIZE_PARAMETER = 'GRASS_REGION_CELLSIZE_PARAMETER'

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../images/grass.png')
return QIcon(os.path.join(pluginPath, 'images', 'grass.png'))

def defineCharacteristics(self):
self.name = 'nviz'
Expand Down
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/grass7/Grass7Algorithm.py
Expand Up @@ -47,6 +47,9 @@

from processing.tools import dataobjects, system

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


class Grass7Algorithm(GeoAlgorithm):

Expand Down Expand Up @@ -75,7 +78,7 @@ def getCopy(self):
return newone

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/grass.png')
return QIcon(os.path.join(pluginPath, 'images', 'grass.png'))

def help(self):
return False, 'http://grass.osgeo.org/grass70/manuals/' + self.grassName \
Expand Down
Expand Up @@ -35,6 +35,10 @@
from processing.tools.system import isWindows, isMac
from nviz7 import nviz7

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


class Grass7AlgorithmProvider(AlgorithmProvider):

def __init__(self):
Expand Down Expand Up @@ -99,7 +103,7 @@ def getName(self):
return 'grass70'

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/grass.png')
return QIcon(os.path.join(pluginPath, 'images', 'grass.png'))

def getSupportedOutputVectorLayerExtensions(self):
return ['shp']
Expand Down
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/grass7/nviz7.py
Expand Up @@ -40,6 +40,9 @@
from processing.tools.system import getNumExportedLayers
from processing.tools import dataobjects

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


class nviz7(GeoAlgorithm):

Expand All @@ -50,7 +53,7 @@ class nviz7(GeoAlgorithm):
GRASS_REGION_CELLSIZE_PARAMETER = 'GRASS_REGION_CELLSIZE_PARAMETER'

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + '/../images/grass.png')
return QtGui.QIcon(os.path.join(pluginPath, 'images', 'grass.png'))

def defineCharacteristics(self):
self.name = 'nviz7'
Expand Down
7 changes: 5 additions & 2 deletions python/plugins/processing/algs/otb/OTBAlgorithm.py
Expand Up @@ -47,7 +47,10 @@
from processing.tools.system import getTempFilename
import xml.etree.ElementTree as ET
import traceback
#import inspect

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


class OTBAlgorithm(GeoAlgorithm):

Expand All @@ -71,7 +74,7 @@ def getCopy(self):
return newone

def getIcon(self):
return QIcon(os.path.dirname(__file__) + "/../../images/otb.png")
return QIcon(os.path.join(pluginPath, 'images', 'otb.png'))

def help(self):
folder = os.path.join( OTBUtils.otbDescriptionPath(), 'doc' )
Expand Down
8 changes: 6 additions & 2 deletions python/plugins/processing/algs/otb/OTBAlgorithmProvider.py
Expand Up @@ -29,13 +29,17 @@
__revision__ = '$Format:%H$'

import os
import PyQt4.QtGui
from PyQt4.QtGui import QIcon
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.core.ProcessingConfig import ProcessingConfig, Setting
from OTBUtils import OTBUtils
from OTBAlgorithm import OTBAlgorithm
from processing.core.ProcessingLog import ProcessingLog

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


class OTBAlgorithmProvider(AlgorithmProvider):

def __init__(self):
Expand All @@ -51,7 +55,7 @@ def getName(self):
return "otb"

def getIcon(self):
return PyQt4.QtGui.QIcon(os.path.dirname(__file__) + "/../../images/otb.png")
return QIcon(os.path.join(pluginPath, 'images', 'otb.png'))

def _loadAlgorithms(self):
self.algs = self.preloadedAlgs
Expand Down
6 changes: 4 additions & 2 deletions python/plugins/processing/algs/qgis/QGISAlgorithmProvider.py
Expand Up @@ -129,12 +129,14 @@
from SplitLinesWithLines import SplitLinesWithLines
from processing.algs.qgis.FieldsMapper import FieldsMapper

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


class QGISAlgorithmProvider(AlgorithmProvider):

_icon = QIcon(':/processing/images/qgis.png')
_icon = QIcon(os.path.join(pluginPath, 'images', 'qgis.png'))
print '***** ICON', pluginPath

def __init__(self):
AlgorithmProvider.__init__(self)
Expand Down
13 changes: 9 additions & 4 deletions python/plugins/processing/algs/r/RAlgorithmProvider.py
Expand Up @@ -28,17 +28,22 @@
import os

from PyQt4.QtGui import QIcon

from processing.core.ProcessingConfig import ProcessingConfig, Setting
from processing.core.ProcessingLog import ProcessingLog
from processing.core.AlgorithmProvider import AlgorithmProvider
from processing.gui.EditScriptAction import EditScriptAction
from processing.gui.DeleteScriptAction import DeleteScriptAction
from processing.gui.CreateNewScriptAction import CreateNewScriptAction
from RUtils import RUtils
from RAlgorithm import RAlgorithm
from processing.script.WrongScriptException import WrongScriptException

from processing.tools.system import isWindows
#import processing.resources_rc

from RUtils import RUtils
from RAlgorithm import RAlgorithm

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


class RAlgorithmProvider(AlgorithmProvider):
Expand Down Expand Up @@ -77,7 +82,7 @@ def unload(self):
ProcessingConfig.removeSetting(RUtils.R_USE64)

def getIcon(self):
return QIcon(':/processing/images/r.png')
return QIcon(os.path.join(pluginPath, 'images', 'r.png'))

def getDescription(self):
return 'R scripts'
Expand Down
7 changes: 5 additions & 2 deletions python/plugins/processing/algs/saga/SagaAlgorithm212.py
Expand Up @@ -41,6 +41,9 @@
from processing.tools import dataobjects
from processing.tools.system import getTempFilename, isWindows, getTempFilenameInTempFolder

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

sessionExportedLayers = {}


Expand All @@ -61,7 +64,7 @@ def getCopy(self):
return newone

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/saga.png')
return QIcon(os.path.join(pluginPath, 'images', 'saga.png'))

def defineCharacteristicsFromFile(self):
lines = open(self.descriptionFile)
Expand Down Expand Up @@ -357,6 +360,6 @@ def help(self):
name + '.rst'))
if html is None:
return True, None
imgpath = os.path.join(os.path.dirname(__file__),os.pardir, os.pardir, 'images', 'saga100x100.jpg')
imgpath = os.path.join(pluginPath, 'images', 'saga.png')
html = ('<img src="%s"/>' % imgpath) + html
return True, html
6 changes: 5 additions & 1 deletion python/plugins/processing/algs/saga/SagaAlgorithmProvider.py
Expand Up @@ -37,6 +37,10 @@
import SagaUtils
from processing.tools.system import isWindows, isMac

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


class SagaAlgorithmProvider(AlgorithmProvider):

supportedVersions = {"2.1.2": ("2.1.2", SagaAlgorithm212),
Expand Down Expand Up @@ -121,4 +125,4 @@ def getSupportedOutputTableLayerExtensions(self):
return ['dbf']

def getIcon(self):
return QIcon(os.path.dirname(__file__) + '/../../images/saga.png')
return QIcon(os.path.join(pluginPath, 'images', 'saga.png'))
5 changes: 4 additions & 1 deletion python/plugins/processing/algs/saga/SplitRGBBands.py
Expand Up @@ -33,6 +33,9 @@
from processing.tools.system import getTempFilename, isWindows
import SagaUtils

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


class SplitRGBBands(GeoAlgorithm):

Expand All @@ -42,7 +45,7 @@ class SplitRGBBands(GeoAlgorithm):
B = 'B'

def getIcon(self):
return QtGui.QIcon(os.path.dirname(__file__) + '/../../images/saga.png')
return QtGui.QIcon(os.path.join(pluginPath, 'images', 'saga.png'))

def defineCharacteristics(self):
self.name = 'Split RGB bands'
Expand Down

0 comments on commit 30dbd8f

Please sign in to comment.