Improved extension selector

git-svn-id: http://sextante.googlecode.com/svn/trunk/soft/bindings/qgis-plugin@84 881b9c09-3ef8-f3c2-ec3d-21d735c97f4d
This commit is contained in:
volayaf@gmail.com 2012-04-13 13:48:29 +00:00
parent c4d21719df
commit 23bf222239
5 changed files with 35 additions and 9 deletions

View File

@ -34,7 +34,7 @@ class SextantePlugin:
self.toolbox.setVisible(False)
Sextante.addAlgListListener(self.toolbox)
self.menu = QMenu()
self.menu = QMenu(self.iface.mainWindow())
self.menu.setTitle("SEXTANTE")
icon = QIcon(os.path.dirname(__file__) + "/images/toolbox.png")

View File

@ -7,8 +7,9 @@ from sextante.core.QGisLayers import QGisLayers
class ExtentSelectionPanel(QtGui.QWidget):
def __init__(self, default):
def __init__(self, dialog, default):
super(ExtentSelectionPanel, self).__init__(None)
self.dialog = dialog
self.setObjectName("ESPanel")
self.horizontalLayout = QtGui.QHBoxLayout(self)
self.horizontalLayout.setSpacing(2)
@ -46,11 +47,19 @@ class ExtentSelectionPanel(QtGui.QWidget):
def selectOnCanvas(self):
canvas = QGisLayers.iface.mapCanvas()
canvas.setMapTool(self.tool)
self.dialog.showMinimized()
def fillCoords(self):
self.text.setText(str(self.tool.rectangle()))
r = self.tool.rectangle()
s = str(r.xMinimum()) + "," + str(r.xMaximum()) + "," + str(r.yMinimum()) + "," + str(r.yMaximum())
self.text.setText(s)
self.tool.reset()
canvas = QGisLayers.iface.mapCanvas()
canvas.setMapTool(self.prevMapTool)
self.dialog.showNormal()
self.dialog.raise_()
self.dialog.activateWindow()
def getValue(self):
return str(self.text.text())

View File

@ -12,10 +12,14 @@ class HistoryDialog(QtGui.QDialog):
def setupUi(self):
self.setObjectName("HistoryDialog")
self.resize(650, 505)
self.tree = QtGui.QTreeWidget(self)
self.tree.setGeometry(QtCore.QRect(5, 5, 640, 245))
self.verticalLayout = QtGui.QVBoxLayout()
self.verticalLayout.setSpacing(2)
self.verticalLayout.setMargin(0)
self.verticalLayout.setObjectName("verticalLayout")
self.tree = QtGui.QTreeWidget()
self.tree.setHeaderHidden(True)
self.tree.doubleClicked.connect(self.executeAlgorithm)
self.verticalLayout.addWidget(self.tree)
QObject.connect(self.tree, QtCore.SIGNAL("itemClicked(QTreeWidgetItem*, int)"), self.changeText)
self.groupIcon = QtGui.QIcon()
self.groupIcon.addPixmap(self.style().standardPixmap(QtGui.QStyle.SP_DirClosedIcon),
@ -25,11 +29,12 @@ class HistoryDialog(QtGui.QDialog):
self.keyIcon = QtGui.QIcon()
self.keyIcon.addPixmap(self.style().standardPixmap(QtGui.QStyle.SP_FileIcon))
self.fillTree()
self.text = QtGui.QTextEdit(self)
self.text.setGeometry(QtCore.QRect(5, 260, 640, 245))
self.text = QtGui.QTextEdit()
self.verticalLayout.addWidget(self.text)
self.text.setObjectName("text")
self.text.setReadOnly(True)
self.setWindowTitle("History")
self.setLayout(self.verticalLayout)
QtCore.QMetaObject.connectSlotsByName(self)
def fillTree(self):

View File

@ -35,7 +35,7 @@ class ParametersDialog(QtGui.QDialog):
'''the default parameters dialog, to be used when an algorithm is called from the toolbox'''
def __init__(self, alg):
QtGui.QDialog.__init__(self)
self.setModal(False)
#self.setModal(False)
self.ui = Ui_ParametersDialog()
self.ui.setupUi(self, alg)
self.executed = False
@ -188,7 +188,7 @@ class Ui_ParametersDialog(object):
elif isinstance(param, ParameterNumber):
item = NumberInputPanel(param.default)
elif isinstance(param, ParameterExtent):
item = ExtentSelectionPanel(param.default)
item = ExtentSelectionPanel(self.dialog, param.default)
else:
item = QtGui.QLineEdit()
item.setText(str(param.default))

View File

@ -8,6 +8,7 @@ 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
try:
_fromUtf8 = QtCore.QString.fromUtf8
@ -105,7 +106,18 @@ class SextanteToolbox(QtGui.QDockWidget):
dlg = alg.getCustomParametersDialog()
if not dlg:
dlg = ParametersDialog(alg)
#dlg.setWindowModality(Qt.WindowModal)
#dlg.setWindowFlags(dlg.windowFlags() | Qt.WindowStaysOnTopHint)
canvas = QGisLayers.iface.mapCanvas()
prevMapTool = canvas.mapTool()
dlg.show()
dlg.exec_()
if canvas.mapTool()!=prevMapTool:
try:
canvas.mapTool().reset()
except:
pass
canvas.setMapTool(prevMapTool)
if dlg.executed:
showRecent = SextanteConfig.getSetting(SextanteConfig.SHOW_RECENT_ALGORITHMS)
if showRecent: