Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
volayaf@gmail.com
committed
Jan 11, 2012
1 parent
398e2a3
commit 21dd387
Showing
5 changed files
with
188 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |