Skip to content

Commit

Permalink
use resource file for images
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbruy committed Oct 4, 2012
1 parent fbb4af7 commit 4475854
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 45 deletions.
5 changes: 5 additions & 0 deletions python/plugins/sextante/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ ADD_SUBDIRECTORY(script)
FILE(GLOB OTHER_FILES metadata.txt)
FILE(GLOB PY_FILES *.py)

PYQT4_ADD_RESOURCES(PYRC_FILES resources.qrc)

ADD_CUSTOM_TARGET(sextante ALL DEPENDS ${PYRC_FILES})

INSTALL(FILES ${PY_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR})
INSTALL(FILES ${OTHER_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR})
INSTALL(FILES ${PYRC_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR})
23 changes: 9 additions & 14 deletions python/plugins/sextante/SextantePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@

from sextante.about.AboutDialog import AboutDialog

import resources_rc

cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0]
if cmd_folder not in sys.path:
sys.path.insert(0, cmd_folder)
Expand All @@ -40,50 +42,43 @@ def initGui(self):
self.menu = QMenu(self.iface.mainWindow())
self.menu.setTitle(QCoreApplication.translate("SEXTANTE", "Analysis"))

icon = QIcon(os.path.dirname(__file__) + "/images/toolbox.png")
self.toolboxAction = QAction(icon, \
self.toolboxAction = QAction(QIcon(":/sextante/images/toolbox.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE Toolbox"),
self.iface.mainWindow())
QObject.connect(self.toolboxAction, SIGNAL("triggered()"), self.openToolbox)
self.menu.addAction(self.toolboxAction)

icon = QIcon(os.path.dirname(__file__) + "/images/model.png")
self.modelerAction = QAction(icon, \
self.modelerAction = QAction(QIcon(":/sextante/images/model.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE Modeler"),
self.iface.mainWindow())
QObject.connect(self.modelerAction, SIGNAL("triggered()"), self.openModeler)
self.menu.addAction(self.modelerAction)

icon = QIcon(os.path.dirname(__file__) + "/images/history.gif")
self.historyAction = QAction(icon, \
self.historyAction = QAction(QIcon(":/sextante/images/history.gif"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE History and log"),
self.iface.mainWindow())
QObject.connect(self.historyAction, SIGNAL("triggered()"), self.openHistory)
self.menu.addAction(self.historyAction)

icon = QIcon(os.path.dirname(__file__) + "/images/config.png")
self.configAction = QAction(icon, \
self.configAction = QAction(QIcon(":/sextante/images/config.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE options and configuration"),
self.iface.mainWindow())
QObject.connect(self.configAction, SIGNAL("triggered()"), self.openConfig)
self.menu.addAction(self.configAction)

icon = QIcon(os.path.dirname(__file__) + "/images/results.png")
self.resultsAction = QAction(icon, \
self.resultsAction = QAction(QIcon(":/sextante/images/results.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE results viewer"),
self.iface.mainWindow())
QObject.connect(self.resultsAction, SIGNAL("triggered()"), self.openResults)
self.menu.addAction(self.resultsAction)

icon = QIcon(os.path.dirname(__file__) + "/images/help.png")
self.helpAction = QAction(icon, \
self.helpAction = QAction(QIcon(":/sextante/images/help.png"),
QCoreApplication.translate("SEXTANTE", "&SEXTANTE help"),
self.iface.mainWindow())
QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
self.menu.addAction(self.helpAction)

icon = QIcon(os.path.dirname(__file__) + "/images/info.png")
self.aboutAction = QAction(icon, \
self.aboutAction = QAction(QIcon(":/sextante/images/info.png"),
QCoreApplication.translate("SEXTANTE", "&About SEXTANTE"),
self.iface.mainWindow())
QObject.connect(self.aboutAction, SIGNAL("triggered()"), self.openAbout)
Expand Down
11 changes: 6 additions & 5 deletions python/plugins/sextante/about/AboutDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from sextante.__init__ import version
from ui_aboutdialogbase import Ui_DlgAbout

import sextante.resources_rc

class AboutDialog(QDialog, Ui_DlgAbout):

def __init__(self, parent):
Expand All @@ -15,9 +17,8 @@ def __init__(self, parent):
self.setAboutText()

def setAboutText(self):
imgPath = QDir(os.path.join(os.path.dirname(__file__), "sextante_logo.png")).absolutePath()
strAbout = self.tr("""
<img src="%1" />
<img src="qrc:/sextante/images/sextante_logo.png" />
<h2>SEXTANTE for QGIS</h2>
<p>SEXTANTE, a geoprocessing platform for QGIS</p>
<p>A development by Victor Olaya (volayaf@gmail.com).</p>
Expand All @@ -31,8 +32,8 @@ def setAboutText(self):
<li>Camilo Polymeris (Threading). Developed as part of Google Summer of Code 2012</li>
</ul>
</p>
<p>You are currently using SEXTANTE v%2</p>
<p>You are currently using SEXTANTE v%1</p>
<p>This software is distributed under the terms of the GNU GPL License v2.
<p>For more information, please visit our website at <a href="http://sextantegis.com">http://sextantegis.com</a></p>
""").arg(imgPath).arg(version())
self.webView.setHtml(strAbout, QUrl.fromLocalFile(QDir(os.path.join(os.path.dirname(__file__), "sextante_logo.png")).absolutePath()))
""").arg(version())
self.webView.setHtml(strAbout)
2 changes: 0 additions & 2 deletions python/plugins/sextante/about/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
FILE(GLOB PY_FILES *.py)
FILE(GLOB OTHER_FILES *.htm *.png)

FILE(GLOB UI_FILES *.ui)
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})

ADD_CUSTOM_TARGET(sextante_about ALL DEPENDS ${PYUI_FILES})

INSTALL(FILES ${PY_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR}/about)
INSTALL(FILES ${OTHER_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR}/about)
INSTALL(FILES ${PYUI_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR}/about)
24 changes: 0 additions & 24 deletions python/plugins/sextante/about/about.htm

This file was deleted.

21 changes: 21 additions & 0 deletions python/plugins/sextante/resources.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<RCC>
<qresource prefix="/sextante">
<file>images/alg.png</file>
<file>images/config.png</file>
<file>images/grass.png</file>
<file>images/help.png</file>
<file>images/history.gif</file>
<file>images/info.png</file>
<file>images/input.png</file>
<file>images/iterate.png</file>
<file>images/model.png</file>
<file>images/otb.png</file>
<file>images/r.png</file>
<file>images/results.png</file>
<file>images/saga.png</file>
<file>images/script.png</file>
<file>images/tool.png</file>
<file>images/toolbox.png</file>
<file>images/sextante_logo.png</file>
</qresource>
</RCC>

0 comments on commit 4475854

Please sign in to comment.