Skip to content

Commit fbb4af7

Browse files
committed
adjust metadata.txt and __init__.py files
initial i18n support
1 parent 777ce59 commit fbb4af7

File tree

6 files changed

+163
-60
lines changed

6 files changed

+163
-60
lines changed

python/plugins/sextante/SextantePlugin.py

+28-18
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,24 @@
1+
import os, sys
2+
import inspect
3+
import subprocess
4+
15
from PyQt4.QtCore import *
26
from PyQt4.QtGui import *
7+
38
from qgis.core import *
4-
import os, sys
5-
import inspect
9+
610
from sextante.core.Sextante import Sextante
7-
from sextante.gui.SextanteToolbox import SextanteToolbox
811
from sextante.core.QGisLayers import QGisLayers
9-
from sextante.gui.HistoryDialog import HistoryDialog
1012
from sextante.core.SextanteUtils import SextanteUtils
13+
14+
from sextante.gui.SextanteToolbox import SextanteToolbox
15+
from sextante.gui.HistoryDialog import HistoryDialog
1116
from sextante.gui.ConfigDialog import ConfigDialog
12-
from sextante.modeler.ModelerDialog import ModelerDialog
1317
from sextante.gui.ResultsDialog import ResultsDialog
18+
19+
from sextante.modeler.ModelerDialog import ModelerDialog
20+
1421
from sextante.about.AboutDialog import AboutDialog
15-
import subprocess
1622

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

3440
self.menu = QMenu(self.iface.mainWindow())
35-
self.menu.setTitle("Analysis")
41+
self.menu.setTitle(QCoreApplication.translate("SEXTANTE", "Analysis"))
3642

3743
icon = QIcon(os.path.dirname(__file__) + "/images/toolbox.png")
3844
self.toolboxAction = QAction(icon, \
39-
"&SEXTANTE Toolbox", self.iface.mainWindow())
45+
QCoreApplication.translate("SEXTANTE", "&SEXTANTE Toolbox"),
46+
self.iface.mainWindow())
4047
QObject.connect(self.toolboxAction, SIGNAL("triggered()"), self.openToolbox)
4148
self.menu.addAction(self.toolboxAction)
4249

4350
icon = QIcon(os.path.dirname(__file__) + "/images/model.png")
4451
self.modelerAction = QAction(icon, \
45-
"&SEXTANTE Modeler", self.iface.mainWindow())
52+
QCoreApplication.translate("SEXTANTE", "&SEXTANTE Modeler"),
53+
self.iface.mainWindow())
4654
QObject.connect(self.modelerAction, SIGNAL("triggered()"), self.openModeler)
4755
self.menu.addAction(self.modelerAction)
4856

4957
icon = QIcon(os.path.dirname(__file__) + "/images/history.gif")
5058
self.historyAction = QAction(icon, \
51-
"&SEXTANTE History and log", self.iface.mainWindow())
59+
QCoreApplication.translate("SEXTANTE", "&SEXTANTE History and log"),
60+
self.iface.mainWindow())
5261
QObject.connect(self.historyAction, SIGNAL("triggered()"), self.openHistory)
5362
self.menu.addAction(self.historyAction)
5463

5564
icon = QIcon(os.path.dirname(__file__) + "/images/config.png")
5665
self.configAction = QAction(icon, \
57-
"&SEXTANTE options and configuration", self.iface.mainWindow())
66+
QCoreApplication.translate("SEXTANTE", "&SEXTANTE options and configuration"),
67+
self.iface.mainWindow())
5868
QObject.connect(self.configAction, SIGNAL("triggered()"), self.openConfig)
5969
self.menu.addAction(self.configAction)
6070

6171
icon = QIcon(os.path.dirname(__file__) + "/images/results.png")
6272
self.resultsAction = QAction(icon, \
63-
"&SEXTANTE results viewer", self.iface.mainWindow())
73+
QCoreApplication.translate("SEXTANTE", "&SEXTANTE results viewer"),
74+
self.iface.mainWindow())
6475
QObject.connect(self.resultsAction, SIGNAL("triggered()"), self.openResults)
6576
self.menu.addAction(self.resultsAction)
6677

6778
icon = QIcon(os.path.dirname(__file__) + "/images/help.png")
6879
self.helpAction = QAction(icon, \
69-
"&SEXTANTE help", self.iface.mainWindow())
80+
QCoreApplication.translate("SEXTANTE", "&SEXTANTE help"),
81+
self.iface.mainWindow())
7082
QObject.connect(self.helpAction, SIGNAL("triggered()"), self.openHelp)
7183
self.menu.addAction(self.helpAction)
7284

7385
icon = QIcon(os.path.dirname(__file__) + "/images/info.png")
7486
self.aboutAction = QAction(icon, \
75-
"&About SEXTANTE", self.iface.mainWindow())
87+
QCoreApplication.translate("SEXTANTE", "&About SEXTANTE"),
88+
self.iface.mainWindow())
7689
QObject.connect(self.aboutAction, SIGNAL("triggered()"), self.openAbout)
7790
self.menu.addAction(self.aboutAction)
7891

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

95-
96108
def openToolbox(self):
97109
self.toolbox.setVisible(True)
98110

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

117129
def openAbout(self):
118-
dlg = AboutDialog()
130+
dlg = AboutDialog(self)
119131
dlg.exec_()
120132

121133
def openHelp(self):
@@ -126,5 +138,3 @@ def openHelp(self):
126138
subprocess.Popen(('open', filename))
127139
else:
128140
subprocess.call(('xdg-open', filename))
129-
130-

python/plugins/sextante/__init__.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,18 @@
11
def name():
22
return "SEXTANTE"
3+
34
def description():
45
return "SEXTANTE Geoprocessing Platform for QGIS"
6+
57
def version():
6-
return "Version 1.0.7"
8+
return "1.0.8"
9+
710
def icon():
8-
return "icon.png"
11+
return "images/toolbox.png"
12+
913
def qgisMinimumVersion():
1014
return "1.0"
15+
1116
def classFactory(iface):
1217
from sextante.SextantePlugin import SextantePlugin
1318
return SextantePlugin(iface)
+32-31
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,38 @@
1-
from PyQt4 import QtCore, QtGui, QtWebKit
1+
import os
2+
23
from PyQt4.QtCore import *
34
from PyQt4.QtGui import *
4-
import os
55

6-
class AboutDialog(QtGui.QDialog):
6+
from sextante.__init__ import version
7+
from ui_aboutdialogbase import Ui_DlgAbout
8+
9+
class AboutDialog(QDialog, Ui_DlgAbout):
710

8-
def __init__(self):
9-
QtGui.QDialog.__init__(self)
10-
self.setModal(True)
11-
self.setupUi()
11+
def __init__(self, parent):
12+
QDialog.__init__(self)
13+
self.setupUi(self)
1214

13-
def setupUi(self):
14-
self.resize(600, 500)
15-
self.webView = QtWebKit.QWebView()
16-
self.setWindowTitle("About SEXTANTE")
17-
self.verticalLayout= QtGui.QVBoxLayout()
18-
self.verticalLayout.setSpacing(2)
19-
self.verticalLayout.setMargin(0)
20-
self.verticalLayout.addWidget(self.webView)
21-
self.closeButton = QtGui.QPushButton()
22-
self.closeButton.setText("Close")
23-
self.closeButton.setMaximumWidth(150)
24-
self.horizontalLayout= QtGui.QHBoxLayout()
25-
self.horizontalLayout.setSpacing(2)
26-
self.horizontalLayout.setMargin(0)
27-
self.horizontalLayout.addStretch(1000)
28-
self.horizontalLayout.addWidget(self.closeButton)
29-
QObject.connect(self.closeButton, QtCore.SIGNAL("clicked()"), self.closeWindow)
30-
self.verticalLayout.addLayout(self.horizontalLayout)
31-
self.setLayout(self.verticalLayout)
32-
filename = os.path.dirname(__file__) + "/about.htm"
33-
url = QtCore.QUrl(filename)
34-
self.webView.load(url)
15+
self.setAboutText()
3516

36-
def closeWindow(self):
37-
self.close()
17+
def setAboutText(self):
18+
imgPath = QDir(os.path.join(os.path.dirname(__file__), "sextante_logo.png")).absolutePath()
19+
strAbout = self.tr("""
20+
<img src="%1" />
21+
<h2>SEXTANTE for QGIS</h2>
22+
<p>SEXTANTE, a geoprocessing platform for QGIS</p>
23+
<p>A development by Victor Olaya (volayaf@gmail.com).</p>
24+
<p>Portions of this software contributed by:
25+
<ul>
26+
<li>Alexander Bruy</li>
27+
<li>Carson Farmer (fTools algorithms)</li>
28+
<li>Julien Malik (Orfeo Toolbox connectors)</li>
29+
<li>Evgeniy Nikulin (Original Field Pyculator code)</li>
30+
<li>Michael Nimm (mmqgis algorithms)</li>
31+
<li>Camilo Polymeris (Threading). Developed as part of Google Summer of Code 2012</li>
32+
</ul>
33+
</p>
34+
<p>You are currently using SEXTANTE v%2</p>
35+
<p>This software is distributed under the terms of the GNU GPL License v2.
36+
<p>For more information, please visit our website at <a href="http://sextantegis.com">http://sextantegis.com</a></p>
37+
""").arg(imgPath).arg(version())
38+
self.webView.setHtml(strAbout, QUrl.fromLocalFile(QDir(os.path.join(os.path.dirname(__file__), "sextante_logo.png")).absolutePath()))
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
FILE(GLOB PY_FILES *.py)
22
FILE(GLOB OTHER_FILES *.htm *.png)
33

4+
FILE(GLOB UI_FILES *.ui)
5+
PYQT4_WRAP_UI(PYUI_FILES ${UI_FILES})
6+
7+
ADD_CUSTOM_TARGET(sextante_about ALL DEPENDS ${PYUI_FILES})
8+
49
INSTALL(FILES ${PY_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR}/about)
510
INSTALL(FILES ${OTHER_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR}/about)
11+
INSTALL(FILES ${PYUI_FILES} DESTINATION ${SEXTANTE_PLUGIN_DIR}/about)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>DlgAbout</class>
4+
<widget class="QDialog" name="DlgAbout">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>492</width>
10+
<height>401</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>About SEXTANTE</string>
15+
</property>
16+
<layout class="QVBoxLayout" name="verticalLayout">
17+
<property name="spacing">
18+
<number>2</number>
19+
</property>
20+
<property name="margin">
21+
<number>0</number>
22+
</property>
23+
<item>
24+
<widget class="QWebView" name="webView">
25+
<property name="url">
26+
<url>
27+
<string>about:blank</string>
28+
</url>
29+
</property>
30+
</widget>
31+
</item>
32+
<item>
33+
<widget class="QDialogButtonBox" name="buttonBox">
34+
<property name="orientation">
35+
<enum>Qt::Horizontal</enum>
36+
</property>
37+
<property name="standardButtons">
38+
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
39+
</property>
40+
</widget>
41+
</item>
42+
</layout>
43+
</widget>
44+
<customwidgets>
45+
<customwidget>
46+
<class>QWebView</class>
47+
<extends>QWidget</extends>
48+
<header>QtWebKit/QWebView</header>
49+
</customwidget>
50+
</customwidgets>
51+
<resources/>
52+
<connections>
53+
<connection>
54+
<sender>buttonBox</sender>
55+
<signal>accepted()</signal>
56+
<receiver>DlgAbout</receiver>
57+
<slot>accept()</slot>
58+
<hints>
59+
<hint type="sourcelabel">
60+
<x>248</x>
61+
<y>254</y>
62+
</hint>
63+
<hint type="destinationlabel">
64+
<x>157</x>
65+
<y>274</y>
66+
</hint>
67+
</hints>
68+
</connection>
69+
<connection>
70+
<sender>buttonBox</sender>
71+
<signal>rejected()</signal>
72+
<receiver>DlgAbout</receiver>
73+
<slot>reject()</slot>
74+
<hints>
75+
<hint type="sourcelabel">
76+
<x>316</x>
77+
<y>260</y>
78+
</hint>
79+
<hint type="destinationlabel">
80+
<x>286</x>
81+
<y>274</y>
82+
</hint>
83+
</hints>
84+
</connection>
85+
</connections>
86+
</ui>

python/plugins/sextante/metadata.txt

+4-9
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
1-
# This file contains metadata for your plugin. Beginning
2-
# with version 1.8 this is the preferred way to supply information about a
3-
# plugin. The current method of embedding metadata in __init__.py will
4-
# be supported until version 2.0
5-
6-
# This file should be included when you package your plugin.
7-
81
[general]
92
name=SEXTANTE
10-
description=SEXTANTE for QGIS
11-
version=1.0.7
3+
description=SEXTANTE Geoprocessing Platform for QGIS
4+
version=1.0.8
5+
icon=images/toolbox.png
126
qgisMinimumVersion=1.0
137
class_name=SextantePlugin
148
website=www.sextantegis.com
9+
1510
[author]
1611
name=Victor Olaya
1712
email=volayaf@gmail.com

0 commit comments

Comments
 (0)