Skip to content

Commit

Permalink
adjust metadata.txt and __init__.py files
Browse files Browse the repository at this point in the history
initial i18n support
  • Loading branch information
alexbruy committed Oct 4, 2012
1 parent 777ce59 commit fbb4af7
Show file tree
Hide file tree
Showing 6 changed files with 163 additions and 60 deletions.
46 changes: 28 additions & 18 deletions python/plugins/sextante/SextantePlugin.py
@@ -1,18 +1,24 @@
import os, sys
import inspect
import subprocess

from PyQt4.QtCore import *
from PyQt4.QtGui import *

from qgis.core import *
import os, sys
import inspect

from sextante.core.Sextante import Sextante
from sextante.gui.SextanteToolbox import SextanteToolbox
from sextante.core.QGisLayers import QGisLayers
from sextante.gui.HistoryDialog import HistoryDialog
from sextante.core.SextanteUtils import SextanteUtils

from sextante.gui.SextanteToolbox import SextanteToolbox
from sextante.gui.HistoryDialog import HistoryDialog
from sextante.gui.ConfigDialog import ConfigDialog
from sextante.modeler.ModelerDialog import ModelerDialog
from sextante.gui.ResultsDialog import ResultsDialog

from sextante.modeler.ModelerDialog import ModelerDialog

from sextante.about.AboutDialog import AboutDialog
import subprocess

cmd_folder = os.path.split(inspect.getfile( inspect.currentframe() ))[0]
if cmd_folder not in sys.path:
Expand All @@ -32,47 +38,54 @@ def initGui(self):
Sextante.addAlgListListener(self.toolbox)

self.menu = QMenu(self.iface.mainWindow())
self.menu.setTitle("Analysis")
self.menu.setTitle(QCoreApplication.translate("SEXTANTE", "Analysis"))

icon = QIcon(os.path.dirname(__file__) + "/images/toolbox.png")
self.toolboxAction = QAction(icon, \
"&SEXTANTE Toolbox", self.iface.mainWindow())
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, \
"&SEXTANTE Modeler", self.iface.mainWindow())
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, \
"&SEXTANTE History and log", self.iface.mainWindow())
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, \
"&SEXTANTE options and configuration", self.iface.mainWindow())
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, \
"&SEXTANTE results viewer", self.iface.mainWindow())
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, \
"&SEXTANTE help", self.iface.mainWindow())
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, \
"&About SEXTANTE", self.iface.mainWindow())
QCoreApplication.translate("SEXTANTE", "&About SEXTANTE"),
self.iface.mainWindow())
QObject.connect(self.aboutAction, SIGNAL("triggered()"), self.openAbout)
self.menu.addAction(self.aboutAction)

Expand All @@ -92,7 +105,6 @@ def unload(self):
#leave files that could not be deleted
pass


def openToolbox(self):
self.toolbox.setVisible(True)

Expand All @@ -115,7 +127,7 @@ def openConfig(self):
dlg.exec_()

def openAbout(self):
dlg = AboutDialog()
dlg = AboutDialog(self)
dlg.exec_()

def openHelp(self):
Expand All @@ -126,5 +138,3 @@ def openHelp(self):
subprocess.Popen(('open', filename))
else:
subprocess.call(('xdg-open', filename))


9 changes: 7 additions & 2 deletions python/plugins/sextante/__init__.py
@@ -1,13 +1,18 @@
def name():
return "SEXTANTE"

def description():
return "SEXTANTE Geoprocessing Platform for QGIS"

def version():
return "Version 1.0.7"
return "1.0.8"

def icon():
return "icon.png"
return "images/toolbox.png"

def qgisMinimumVersion():
return "1.0"

def classFactory(iface):
from sextante.SextantePlugin import SextantePlugin
return SextantePlugin(iface)
63 changes: 32 additions & 31 deletions python/plugins/sextante/about/AboutDialog.py
@@ -1,37 +1,38 @@
from PyQt4 import QtCore, QtGui, QtWebKit
import os

from PyQt4.QtCore import *
from PyQt4.QtGui import *
import os

class AboutDialog(QtGui.QDialog):
from sextante.__init__ import version
from ui_aboutdialogbase import Ui_DlgAbout

class AboutDialog(QDialog, Ui_DlgAbout):

def __init__(self):
QtGui.QDialog.__init__(self)
self.setModal(True)
self.setupUi()
def __init__(self, parent):
QDialog.__init__(self)
self.setupUi(self)

def setupUi(self):
self.resize(600, 500)
self.webView = QtWebKit.QWebView()
self.setWindowTitle("About SEXTANTE")
self.verticalLayout= QtGui.QVBoxLayout()
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
self.verticalLayout.addWidget(self.webView)
self.closeButton = QtGui.QPushButton()
self.closeButton.setText("Close")
self.closeButton.setMaximumWidth(150)
self.horizontalLayout= QtGui.QHBoxLayout()
self.horizontalLayout.setSpacing(2)
self.horizontalLayout.setMargin(0)
self.horizontalLayout.addStretch(1000)
self.horizontalLayout.addWidget(self.closeButton)
QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.closeWindow)
self.verticalLayout.addLayout(self.horizontalLayout)
self.setLayout(self.verticalLayout)
filename = os.path.dirname(__file__) + "/about.htm"
url = QtCore.QUrl(filename)
self.webView.load(url)
self.setAboutText()

def closeWindow(self):
self.close()
def setAboutText(self):
imgPath = QDir(os.path.join(os.path.dirname(__file__), "sextante_logo.png")).absolutePath()
strAbout = self.tr("""
<img src="%1" />
<h2>SEXTANTE for QGIS</h2>
<p>SEXTANTE, a geoprocessing platform for QGIS</p>
<p>A development by Victor Olaya (volayaf@gmail.com).</p>
<p>Portions of this software contributed by:
<ul>
<li>Alexander Bruy</li>
<li>Carson Farmer (fTools algorithms)</li>
<li>Julien Malik (Orfeo Toolbox connectors)</li>
<li>Evgeniy Nikulin (Original Field Pyculator code)</li>
<li>Michael Nimm (mmqgis algorithms)</li>
<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>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()))
6 changes: 6 additions & 0 deletions python/plugins/sextante/about/CMakeLists.txt
@@ -1,5 +1,11 @@
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)
86 changes: 86 additions & 0 deletions python/plugins/sextante/about/aboutdialogbase.ui
@@ -0,0 +1,86 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>DlgAbout</class>
<widget class="QDialog" name="DlgAbout">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>492</width>
<height>401</height>
</rect>
</property>
<property name="windowTitle">
<string>About SEXTANTE</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>2</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QWebView" name="webView">
<property name="url">
<url>
<string>about:blank</string>
</url>
</property>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
</property>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>QWebView</class>
<extends>QWidget</extends>
<header>QtWebKit/QWebView</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>DlgAbout</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>DlgAbout</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
13 changes: 4 additions & 9 deletions python/plugins/sextante/metadata.txt
@@ -1,17 +1,12 @@
# This file contains metadata for your plugin. Beginning
# with version 1.8 this is the preferred way to supply information about a
# plugin. The current method of embedding metadata in __init__.py will
# be supported until version 2.0

# This file should be included when you package your plugin.

[general]
name=SEXTANTE
description=SEXTANTE for QGIS
version=1.0.7
description=SEXTANTE Geoprocessing Platform for QGIS
version=1.0.8
icon=images/toolbox.png
qgisMinimumVersion=1.0
class_name=SextantePlugin
website=www.sextantegis.com

[author]
name=Victor Olaya
email=volayaf@gmail.com

0 comments on commit fbb4af7

Please sign in to comment.