mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-27 00:33:48 -05:00
added multiple input dialgo and panel
git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@13 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
This commit is contained in:
parent
398e2a32e0
commit
21dd387f5d
82
src/sextante/gui/MultipleInputDialog.py
Normal file
82
src/sextante/gui/MultipleInputDialog.py
Normal file
@ -0,0 +1,82 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'D:\projects\sextante\workspaces\qgis-plugin\sextante\src\sextante\gui\MultipleSelectionDialog.ui'
|
||||
#
|
||||
# Created: Wed Jan 11 17:48:49 2012
|
||||
# by: PyQt4 UI code generator 4.9
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
from PyQt4 import QtCore, QtGui
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
_fromUtf8 = lambda s: s
|
||||
|
||||
|
||||
class MultipleInputDialog(QtGui.QDialog):
|
||||
def __init__(self, options, selectedoptions):
|
||||
self.options = options
|
||||
self.selectedoptions = selectedoptions
|
||||
QtGui.QDialog.__init__(self)
|
||||
self.setModal(True)
|
||||
self.ui = Ui_MultipleInputDialog()
|
||||
self.ui.setupUi(self)
|
||||
|
||||
class Ui_MultipleInputDialog(object):
|
||||
def setupUi(self, dialog):
|
||||
self.dialog = dialog
|
||||
dialog.setObjectName(_fromUtf8("Dialog"))
|
||||
dialog.resize(381, 320)
|
||||
dialog.setWindowTitle("Multiple selection")
|
||||
self.buttonBox = QtGui.QDialogButtonBox(dialog)
|
||||
self.buttonBox.setGeometry(QtCore.QRect(290, 10, 81, 61))
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Vertical)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
|
||||
self.table = QtGui.QTableWidget(dialog)
|
||||
self.table.setGeometry(QtCore.QRect(10, 10, 271, 301))
|
||||
self.table.setObjectName(_fromUtf8("table"))
|
||||
self.table.setColumnCount(1)
|
||||
self.table.verticalHeader().setVisible(True)
|
||||
self.table.horizontalHeader().setVisible(True)
|
||||
self.selectAllButton = QtGui.QPushButton(dialog)
|
||||
self.selectAllButton.setGeometry(QtCore.QRect(290, 290, 81, 23))
|
||||
self.selectAllButton.setObjectName(_fromUtf8("selectAllButton"))
|
||||
self.selectAllButton.setText("(de)Select all")
|
||||
self.setTableContent()
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), self.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), self.reject)
|
||||
QtCore.QObject.connect(self.selectAllButton, QtCore.SIGNAL(_fromUtf8("clicked()")), self.selectAll)
|
||||
QtCore.QMetaObject.connectSlotsByName(dialog)
|
||||
|
||||
def setTableContent(self):
|
||||
for i in range(len(self.dialog.options)):
|
||||
item = QtGui.QCheckBox()
|
||||
item.setText(self.dialog.options[i])
|
||||
self.table.setCellWidget(i,0, item)
|
||||
|
||||
|
||||
def accept(self):
|
||||
self.dialog.selectedoptions = []
|
||||
for i in range(len(self.dialog.options)):
|
||||
widget = self.table.cellWidget(i, 0)
|
||||
if widget.isChecked():
|
||||
self.dialog.selectedoptions.append(i)
|
||||
|
||||
|
||||
def reject(self):
|
||||
self.dialog.selectedoptions = None
|
||||
self.dialog.close()
|
||||
|
||||
def selectAll(self):
|
||||
checked = False
|
||||
for i in range(len(self.dialog.options)):
|
||||
widget = self.table.cellWidget(i, 0)
|
||||
if not widget.isChecked():
|
||||
checked = True
|
||||
break
|
||||
for i in range(len(self.dialog.options)):
|
||||
widget = self.table.cellWidget(i, 0)
|
||||
widget.setChecked(checked)
|
33
src/sextante/gui/MultipleInputPanel.py
Normal file
33
src/sextante/gui/MultipleInputPanel.py
Normal file
@ -0,0 +1,33 @@
|
||||
from PyQt4 import QtCore, QtGui
|
||||
from sextante.gui.MultipleInputDialog import MultipleInputDialog
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
except AttributeError:
|
||||
_fromUtf8 = lambda s: s
|
||||
|
||||
class MultipleInputPanel(QtGui.QWidget):
|
||||
|
||||
def __init__(self, options, parent = None):
|
||||
self.options = options
|
||||
self.selectedoptions = []
|
||||
super(MultipleInputPanel, self).__init__(parent)
|
||||
self.setObjectName(_fromUtf8("MSPanel"))
|
||||
self.resize(266, 30)
|
||||
self.pushButton = QtGui.QPushButton(self)
|
||||
self.pushButton.setGeometry(QtCore.QRect(220, 0, 40, 30))
|
||||
self.pushButton.setObjectName(_fromUtf8("pushButton"))
|
||||
self.label = QtGui.QLabel(self)
|
||||
self.label.setGeometry(QtCore.QRect(0, 0, 220, 30))
|
||||
self.label.setObjectName(_fromUtf8("label"))
|
||||
self.pushButton.setText("...")
|
||||
self.label.setText("0 elements selected")
|
||||
self.pushButton.clicked.connect(self.showSelectionDialog)
|
||||
#QtCore.QMetaObject.connectSlotsByName(Form)
|
||||
|
||||
def showSelectionDialog(self):
|
||||
dlg = MultipleInputDialog(self.options, self.selectedoptions)
|
||||
dlg.exec_()
|
||||
if dlg.selected != None:
|
||||
self.selectedoptions = dlg.selectedOptions
|
||||
self.label.setText(str(len(self.selectedoptions)) + " elements selected")
|
@ -6,6 +6,8 @@ from sextante.parameters.ParameterRaster import ParameterRaster
|
||||
from sextante.parameters.ParameterVector import ParameterVector
|
||||
from sextante.parameters.ParameterBoolean import ParameterBoolean
|
||||
from sextante.parameters.ParameterSelection import ParameterSelection
|
||||
from sextante.parameters.ParameterMultipleInput import ParameterMultipleInput
|
||||
from sextante.gui.MultipleInputPanel import MultipleInputPanel
|
||||
|
||||
try:
|
||||
_fromUtf8 = QtCore.QString.fromUtf8
|
||||
@ -71,6 +73,12 @@ class Ui_ParametersDialog(object):
|
||||
elif isinstance(param, ParameterSelection):
|
||||
item = QtGui.QComboBox()
|
||||
item.addItems(param.options)
|
||||
elif isinstance(param, ParameterMultipleInput):
|
||||
if param.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
|
||||
options = QGisLayers.getVectorLayers()
|
||||
else:
|
||||
options = QGisLayers.getRasterLayers()
|
||||
item = MultipleInputPanel(options)
|
||||
else:
|
||||
item = QtGui.QLineEdit()
|
||||
|
||||
|
@ -27,6 +27,7 @@ class Ui_SextanteToolbox(object):
|
||||
self.toolbox = SextanteToolbox
|
||||
SextanteToolbox.setObjectName(_fromUtf8("SextanteToolbox"))
|
||||
SextanteToolbox.resize(400, 300)
|
||||
SextanteToolbox.setWindowTitle("SEXTANTE Toolbox")
|
||||
self.verticalLayoutWidget = QtGui.QWidget(SextanteToolbox)
|
||||
self.verticalLayoutWidget.setGeometry(QtCore.QRect(10, 9, 381, 281))
|
||||
self.verticalLayoutWidget.setObjectName(_fromUtf8("verticalLayoutWidget"))
|
||||
@ -43,8 +44,6 @@ class Ui_SextanteToolbox(object):
|
||||
self.verticalLayout.addWidget(self.searchBox)
|
||||
self.algorithmTree.doubleClicked.connect(self.executeAlgorithm)
|
||||
self.fillTree()
|
||||
|
||||
self.retranslateUi(SextanteToolbox)
|
||||
QtCore.QMetaObject.connectSlotsByName(SextanteToolbox)
|
||||
|
||||
def executeAlgorithm(self):
|
||||
@ -88,9 +87,6 @@ class Ui_SextanteToolbox(object):
|
||||
groupItem.setExpanded(True)
|
||||
|
||||
|
||||
def retranslateUi(self, SextantePlugin):
|
||||
SextantePlugin.setWindowTitle("SEXTANTE Toolbox")
|
||||
|
||||
class TreeAlgorithmItem(QtGui.QTreeWidgetItem):
|
||||
|
||||
def __init__(self, alg, layersCount):
|
||||
|
64
src/sextante/saga/SagaGroupNameDecorator.py
Normal file
64
src/sextante/saga/SagaGroupNameDecorator.py
Normal file
@ -0,0 +1,64 @@
|
||||
class SagaGroupNameDecorator():
|
||||
|
||||
groups = {}
|
||||
groups["contrib_a_perego"] = "Contributions"
|
||||
groups["geostatistics_grid"]= "Geostatistics"
|
||||
groups["geostatistics_kriging"]= "Kriging"
|
||||
groups["geostatistics_points"]= "Geostatistics"
|
||||
groups["geostatistics_regression"]= "Geostatistics"
|
||||
groups["grid_analysis"]= "Grid - Analysis"
|
||||
groups["grid_calculus"]= "Grid - Calculus"
|
||||
groups["grid_calculus_bsl"]= "Grid - Calculus"
|
||||
groups["grid_discretisation"]= "Grid - Discretisation"
|
||||
groups["grid_filter"]= "Grid - Filter"
|
||||
groups["grid_gridding"]= "Grid - Gridding"
|
||||
groups["grid_spline"]= "Grid - Spline"
|
||||
groups["grid_tools"]= "Grid - Tools"
|
||||
groups["grid_visualisation"]= "Grid - Visualization"
|
||||
groups["hacres"]= "Hacres"
|
||||
groups["imagery_segmentation"]= "Imagery - Segmentation"
|
||||
groups["imagery_classification"]= "Imagery - Classification"
|
||||
groups["imagery_rga"]= "Imagery - RGA"
|
||||
groups["io_esri_e00"]= "I/O"
|
||||
groups["io_gdal"]= "I/O"
|
||||
groups["io_gps"]= "I/O"
|
||||
groups["io_grid"]= "I/O"
|
||||
groups["io_grid_grib2"]= "I/O"
|
||||
groups["io_grid_image"]= "I/O"
|
||||
groups["io_odbc"]= "I/O"
|
||||
groups["io_shapes"]= "I/O"
|
||||
groups["io_shapes_dxf"]= "I/O"
|
||||
groups["io_shapes_las"]= "I/O"
|
||||
groups["io_table"]= "I/O"
|
||||
groups["lectures_introduction"]= "Lectures"
|
||||
groups["pj_georeference"]= "Georeferencing"
|
||||
groups["pj_geotrans"]= "Projections and Transformations"
|
||||
groups["pj_proj4"]= "Projections and Transformations"
|
||||
groups["pointcloud_tools"]= "Point clouds"
|
||||
groups["recreations_fractals"]= "Recreations"
|
||||
groups["recreations_games"]= "Diversiones"
|
||||
groups["shapes_grid"]= "Shapes - Grid"
|
||||
groups["shapes_lines"]= "Shapes - Lines"
|
||||
groups["shapes_points"]= "Shapes - Points"
|
||||
groups["shapes_polygons"]= "Shapes - Polygons"
|
||||
groups["shapes_tools"]= "Shapes - Tools"
|
||||
groups["shapes_transect"]= "Shapes - Transect"
|
||||
groups["sim_cellular_automata"]= "Simulation - CA"
|
||||
groups["sim_ecosystems_hugget"]= "Simulation - Ecosystems"
|
||||
groups["sim_fire_spreading"]= "Simulation - Fire Spreading"
|
||||
groups["sim_hydrology"]= "Simulation - Hydrology"
|
||||
groups["table_calculus"]= "Table - Calculus"
|
||||
groups["table_tools"]= "Table - Tools"
|
||||
groups["ta_channels"]= "Terrain Analysis - Channels"
|
||||
groups["ta_compound"]= "Terrain Analysis - Morphometry"
|
||||
groups["ta_hydrology"]= "Terrain Analysis - Hydrology"
|
||||
groups["ta_lighting"]= "Terrain Analysis - Lighting"
|
||||
groups["ta_morphometry"]= "Terrain Analysis - Morphometry"
|
||||
groups["ta_preprocessor"]= "Terrain Analysis - Hydrology"
|
||||
groups["ta_profiles"]= "Terrain Analysis - Profiles"
|
||||
groups["tin_tools"]= "TIN"
|
||||
groups["vigra"]= "Vigra"
|
||||
|
||||
@staticmethod
|
||||
def getDecoratedName(groupName):
|
||||
return SagaGroupNameDecorator.groups[groupName]
|
Loading…
x
Reference in New Issue
Block a user