mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
more translatable strings and cleanup
This commit is contained in:
parent
4e02cfbab7
commit
109525f7a3
@ -1,26 +1,27 @@
|
||||
import os
|
||||
import sys
|
||||
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
from sextante.core.Sextante import Sextante
|
||||
from sextante.gui.ParametersDialog import ParametersDialog
|
||||
from sextante.gui.BatchProcessingDialog import BatchProcessingDialog
|
||||
from sextante.gui.EditRenderingStylesDialog import EditRenderingStylesDialog
|
||||
from sextante.core.SextanteLog import SextanteLog
|
||||
from sextante.core.SextanteConfig import SextanteConfig
|
||||
from sextante.core.QGisLayers import QGisLayers
|
||||
import os
|
||||
import sys
|
||||
import subprocess
|
||||
|
||||
from sextante.gui.ParametersDialog import ParametersDialog
|
||||
from sextante.gui.BatchProcessingDialog import BatchProcessingDialog
|
||||
from sextante.gui.EditRenderingStylesDialog import EditRenderingStylesDialog
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
_fromUtf8 = QString.fromUtf8
|
||||
except AttributeError:
|
||||
_fromUtf8 = lambda s: s
|
||||
|
||||
|
||||
class SextanteToolbox(QtGui.QDockWidget):
|
||||
class SextanteToolbox(QDockWidget):
|
||||
def __init__(self, iface):
|
||||
QtGui.QDialog.__init__(self)
|
||||
QDialog.__init__(self)
|
||||
self.iface=iface
|
||||
self.setupUi()
|
||||
|
||||
@ -34,19 +35,19 @@ class SextanteToolbox(QtGui.QDockWidget):
|
||||
self.setObjectName("SEXTANTE_Toolbox")
|
||||
self.setFloating(False)
|
||||
self.resize(400, 500)
|
||||
self.setWindowTitle("SEXTANTE Toolbox")
|
||||
self.contents = QtGui.QWidget()
|
||||
self.verticalLayout = QtGui.QVBoxLayout(self.contents)
|
||||
self.setWindowTitle(self.tr("SEXTANTE Toolbox"))
|
||||
self.contents = QWidget()
|
||||
self.verticalLayout = QVBoxLayout(self.contents)
|
||||
self.verticalLayout.setSpacing(2)
|
||||
self.verticalLayout.setMargin(0)
|
||||
self.externalAppsButton = QtGui.QPushButton()
|
||||
self.externalAppsButton.setText("Click here to configure\nadditional algorithm providers")
|
||||
QObject.connect(self.externalAppsButton, QtCore.SIGNAL("clicked()"), self.configureProviders)
|
||||
self.externalAppsButton = QPushButton()
|
||||
self.externalAppsButton.setText(self.tr("Click here to configure\nadditional algorithm providers"))
|
||||
QObject.connect(self.externalAppsButton, SIGNAL("clicked()"), self.configureProviders)
|
||||
self.verticalLayout.addWidget(self.externalAppsButton)
|
||||
self.searchBox = QtGui.QLineEdit(self.contents)
|
||||
self.searchBox = QLineEdit(self.contents)
|
||||
self.searchBox.textChanged.connect(self.fillTree)
|
||||
self.verticalLayout.addWidget(self.searchBox)
|
||||
self.algorithmTree = QtGui.QTreeWidget(self.contents)
|
||||
self.algorithmTree = QTreeWidget(self.contents)
|
||||
self.algorithmTree.setHeaderHidden(True)
|
||||
self.algorithmTree.setContextMenuPolicy(Qt.CustomContextMenu)
|
||||
self.fillTree()
|
||||
@ -56,36 +57,30 @@ class SextanteToolbox(QtGui.QDockWidget):
|
||||
self.algorithmTree.doubleClicked.connect(self.executeAlgorithm)
|
||||
self.setWidget(self.contents)
|
||||
self.iface.addDockWidget(Qt.RightDockWidgetArea, self)
|
||||
QtCore.QMetaObject.connectSlotsByName(self)
|
||||
QMetaObject.connectSlotsByName(self)
|
||||
|
||||
def configureProviders(self):
|
||||
filename = os.path.join(os.path.dirname(__file__), "..", "help", "3rdParty.html")
|
||||
if os.name == "nt":
|
||||
os.startfile(filename)
|
||||
elif sys.platform == "darwin":
|
||||
subprocess.Popen(('open', filename))
|
||||
else:
|
||||
subprocess.call(('xdg-open', filename))
|
||||
QDesktopServices.openUrl(QUrl(os.path.join(os.path.dirname(__file__), os.path.pardir) + "/help/3rdParty.html"))
|
||||
|
||||
def showPopupMenu(self,point):
|
||||
item = self.algorithmTree.itemAt(point)
|
||||
if isinstance(item, TreeAlgorithmItem):
|
||||
alg = item.alg
|
||||
popupmenu = QMenu()
|
||||
executeAction = QtGui.QAction("Execute", self.algorithmTree)
|
||||
executeAction = QAction(self.tr("Execute"), self.algorithmTree)
|
||||
executeAction.triggered.connect(self.executeAlgorithm)
|
||||
popupmenu.addAction(executeAction)
|
||||
executeBatchAction = QtGui.QAction("Execute as batch process", self.algorithmTree)
|
||||
executeBatchAction = QAction(self.tr("Execute as batch process"), self.algorithmTree)
|
||||
executeBatchAction.triggered.connect(self.executeAlgorithmAsBatchProcess)
|
||||
popupmenu.addAction(executeBatchAction)
|
||||
editRenderingStylesAction = QtGui.QAction("Edit rendering styles for outputs", self.algorithmTree)
|
||||
editRenderingStylesAction = QAction(self.tr("Edit rendering styles for outputs"), self.algorithmTree)
|
||||
editRenderingStylesAction.triggered.connect(self.editRenderingStyles)
|
||||
popupmenu.addAction(editRenderingStylesAction)
|
||||
actions = Sextante.contextMenuActions
|
||||
for action in actions:
|
||||
action.setData(alg,self)
|
||||
if action.isEnabled():
|
||||
contextMenuAction = QtGui.QAction(action.name, self.algorithmTree)
|
||||
contextMenuAction = QAction(action.name, self.algorithmTree)
|
||||
contextMenuAction.triggered.connect(action.execute)
|
||||
popupmenu.addAction(contextMenuAction)
|
||||
|
||||
@ -111,7 +106,7 @@ class SextanteToolbox(QtGui.QDockWidget):
|
||||
alg = Sextante.getAlgorithm(item.alg.commandLineName())
|
||||
message = alg.checkBeforeOpeningParametersDialog()
|
||||
if message:
|
||||
QtGui.QMessageBox.warning(self, "Warning", message)
|
||||
QMessageBox.warning(self, self.tr("Warning"), message)
|
||||
return
|
||||
alg = alg.getCopy()#copy.deepcopy(alg)
|
||||
dlg = alg.getCustomParametersDialog()
|
||||
@ -154,7 +149,7 @@ class SextanteToolbox(QtGui.QDockWidget):
|
||||
if alg.group in groups:
|
||||
groupItem = groups[alg.group]
|
||||
else:
|
||||
groupItem = QtGui.QTreeWidgetItem()
|
||||
groupItem = QTreeWidgetItem()
|
||||
groupItem.setText(0,alg.group)
|
||||
groups[alg.group] = groupItem
|
||||
algItem = TreeAlgorithmItem(alg)
|
||||
@ -166,7 +161,7 @@ class SextanteToolbox(QtGui.QDockWidget):
|
||||
if action.group in groups:
|
||||
groupItem = groups[action.group]
|
||||
else:
|
||||
groupItem = QtGui.QTreeWidgetItem()
|
||||
groupItem = QTreeWidgetItem()
|
||||
groupItem.setText(0,action.group)
|
||||
groups[action.group] = groupItem
|
||||
algItem = TreeActionItem(action)
|
||||
@ -174,7 +169,7 @@ class SextanteToolbox(QtGui.QDockWidget):
|
||||
|
||||
|
||||
if len(groups) > 0:
|
||||
providerItem = QtGui.QTreeWidgetItem()
|
||||
providerItem = QTreeWidgetItem()
|
||||
providerItem.setText(0, Sextante.getProviderFromName(providerName).getDescription()
|
||||
+ " [" + str(len(provider)) + " geoalgorithms]")
|
||||
providerItem.setIcon(0, Sextante.getProviderFromName(providerName).getIcon())
|
||||
@ -193,8 +188,8 @@ class SextanteToolbox(QtGui.QDockWidget):
|
||||
recent = SextanteLog.getRecentAlgorithms()
|
||||
if len(recent) != 0:
|
||||
found = False
|
||||
recentItem = QtGui.QTreeWidgetItem()
|
||||
recentItem.setText(0,"Recently used algorithms")
|
||||
recentItem = QTreeWidgetItem()
|
||||
recentItem.setText(0, self.tr("Recently used algorithms"))
|
||||
for algname in recent:
|
||||
alg = Sextante.getAlgorithm(algname)
|
||||
if alg is not None:
|
||||
@ -207,9 +202,7 @@ class SextanteToolbox(QtGui.QDockWidget):
|
||||
|
||||
self.algorithmTree.setWordWrap(True)
|
||||
|
||||
|
||||
|
||||
class TreeAlgorithmItem(QtGui.QTreeWidgetItem):
|
||||
class TreeAlgorithmItem(QTreeWidgetItem):
|
||||
|
||||
def __init__(self, alg):
|
||||
QTreeWidgetItem.__init__(self)
|
||||
@ -218,12 +211,10 @@ class TreeAlgorithmItem(QtGui.QTreeWidgetItem):
|
||||
self.setIcon(0, alg.getIcon())
|
||||
self.setToolTip(0, alg.name)
|
||||
|
||||
|
||||
class TreeActionItem(QtGui.QTreeWidgetItem):
|
||||
class TreeActionItem(QTreeWidgetItem):
|
||||
|
||||
def __init__(self, action):
|
||||
QTreeWidgetItem.__init__(self)
|
||||
self.action = action
|
||||
self.setText(0, action.name)
|
||||
self.setIcon(0, action.getIcon())
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user