mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-14 00:07:35 -04:00
[processing] use QtDesigner .ui for Autofill dialog
This commit is contained in:
parent
a763e28ea5
commit
60bf80c3f3
@ -25,63 +25,41 @@ __copyright__ = '(C) 2012, Victor Olaya'
|
||||
|
||||
__revision__ = '$Format:%H$'
|
||||
|
||||
from PyQt4 import QtGui, QtCore
|
||||
from PyQt4.QtCore import *
|
||||
from PyQt4.QtGui import *
|
||||
|
||||
from processing.ui.ui_DlgAutofill import Ui_DlgAutofill
|
||||
|
||||
class AutofillDialog(QtGui.QDialog):
|
||||
|
||||
class AutofillDialog(QDialog, Ui_DlgAutofill):
|
||||
|
||||
DO_NOT_AUTOFILL = 0
|
||||
FILL_WITH_NUMBERS = 1
|
||||
FILL_WITH_PARAMETER = 2
|
||||
|
||||
def __init__(self, alg):
|
||||
QtGui.QDialog.__init__(self)
|
||||
QDialog.__init__(self)
|
||||
self.setupUi(self)
|
||||
|
||||
self.cmbFillType.currentIndexChanged.connect(self.toggleParameters)
|
||||
|
||||
self.verticalLayout = QtGui.QVBoxLayout(self)
|
||||
self.verticalLayout.setSpacing(40)
|
||||
self.verticalLayout.setMargin(20)
|
||||
self.horizontalLayout = QtGui.QHBoxLayout(self)
|
||||
self.horizontalLayout.setSpacing(2)
|
||||
self.horizontalLayout.setMargin(0)
|
||||
self.label = QtGui.QLabel('Autofill mode')
|
||||
self.horizontalLayout.addWidget(self.label)
|
||||
self.typeCombo = QtGui.QComboBox()
|
||||
self.typeCombo.addItem('Do not autofill')
|
||||
self.typeCombo.addItem('Fill with numbers')
|
||||
self.typeCombo.addItem('Fill with parameter values')
|
||||
self.horizontalLayout.addWidget(self.typeCombo)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout)
|
||||
self.horizontalLayout2 = QtGui.QHBoxLayout(self)
|
||||
self.horizontalLayout2.setSpacing(2)
|
||||
self.horizontalLayout2.setMargin(0)
|
||||
self.label2 = QtGui.QLabel('Parameter to use')
|
||||
self.horizontalLayout2.addWidget(self.label2)
|
||||
self.fieldCombo = QtGui.QComboBox()
|
||||
for param in alg.parameters:
|
||||
self.fieldCombo.addItem(param.description)
|
||||
self.horizontalLayout2.addWidget(self.fieldCombo)
|
||||
self.verticalLayout.addLayout(self.horizontalLayout2)
|
||||
self.cmbParameters.addItem(param.description)
|
||||
|
||||
self.buttonBox = QtGui.QDialogButtonBox(self)
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel
|
||||
| QtGui.QDialogButtonBox.Ok)
|
||||
QObject.connect(self.buttonBox, QtCore.SIGNAL('accepted()'),
|
||||
self.okPressed)
|
||||
QObject.connect(self.buttonBox, QtCore.SIGNAL('rejected()'),
|
||||
self.cancelPressed)
|
||||
self.verticalLayout.addWidget(self.buttonBox)
|
||||
def toggleParameters(self, index):
|
||||
if index == self.FILL_WITH_PARAMETER:
|
||||
self.lblParameters.setEnabled(True)
|
||||
self.cmbParameters.setEnabled(True)
|
||||
else:
|
||||
self.lblParameters.setEnabled(False)
|
||||
self.cmbParameters.setEnabled(False)
|
||||
|
||||
self.setLayout(self.verticalLayout)
|
||||
def accept(self):
|
||||
self.mode = self.cmbFillType.currentIndex()
|
||||
self.param = self.cmbParameters.currentIndex()
|
||||
QDialog.accept(self)
|
||||
|
||||
def okPressed(self):
|
||||
self.mode = self.typeCombo.currentIndex()
|
||||
self.param = self.fieldCombo.currentIndex()
|
||||
self.close()
|
||||
|
||||
def cancelPressed(self):
|
||||
def reject(self):
|
||||
self.mode = None
|
||||
self.param = None
|
||||
self.close()
|
||||
QDialog.reject(self)
|
||||
|
113
python/plugins/processing/ui/DlgAutofill.ui
Normal file
113
python/plugins/processing/ui/DlgAutofill.ui
Normal file
@ -0,0 +1,113 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>DlgAutofill</class>
|
||||
<widget class="QDialog" name="DlgAutofill">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>400</width>
|
||||
<height>104</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Autofill settings</string>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout">
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>Autofill mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QComboBox" name="cmbFillType">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Do not autofill</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fill with numbers</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Fill with parameter values</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="lblParameters">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Parameter to use</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QComboBox" name="cmbParameters">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>DlgAutofill</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>248</x>
|
||||
<y>254</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>157</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>DlgAutofill</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>316</x>
|
||||
<y>260</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>286</x>
|
||||
<y>274</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
63
python/plugins/processing/ui/ui_DlgAutofill.py
Normal file
63
python/plugins/processing/ui/ui_DlgAutofill.py
Normal file
@ -0,0 +1,63 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Form implementation generated from reading ui file 'python/plugins/processing/ui/DlgAutofill.ui'
|
||||
#
|
||||
# Created: Wed Oct 2 20:49:45 2013
|
||||
# by: PyQt4 UI code generator 4.9.1
|
||||
#
|
||||
# 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 Ui_DlgAutofill(object):
|
||||
def setupUi(self, DlgAutofill):
|
||||
DlgAutofill.setObjectName(_fromUtf8("DlgAutofill"))
|
||||
DlgAutofill.resize(400, 104)
|
||||
self.gridLayout = QtGui.QGridLayout(DlgAutofill)
|
||||
self.gridLayout.setObjectName(_fromUtf8("gridLayout"))
|
||||
self.label = QtGui.QLabel(DlgAutofill)
|
||||
self.label.setObjectName(_fromUtf8("label"))
|
||||
self.gridLayout.addWidget(self.label, 0, 0, 1, 1)
|
||||
self.cmbFillType = QtGui.QComboBox(DlgAutofill)
|
||||
self.cmbFillType.setObjectName(_fromUtf8("cmbFillType"))
|
||||
self.cmbFillType.addItem(_fromUtf8(""))
|
||||
self.cmbFillType.addItem(_fromUtf8(""))
|
||||
self.cmbFillType.addItem(_fromUtf8(""))
|
||||
self.gridLayout.addWidget(self.cmbFillType, 0, 1, 1, 1)
|
||||
self.lblParameters = QtGui.QLabel(DlgAutofill)
|
||||
self.lblParameters.setEnabled(False)
|
||||
self.lblParameters.setObjectName(_fromUtf8("lblParameters"))
|
||||
self.gridLayout.addWidget(self.lblParameters, 1, 0, 1, 1)
|
||||
self.cmbParameters = QtGui.QComboBox(DlgAutofill)
|
||||
self.cmbParameters.setEnabled(False)
|
||||
sizePolicy = QtGui.QSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Fixed)
|
||||
sizePolicy.setHorizontalStretch(0)
|
||||
sizePolicy.setVerticalStretch(0)
|
||||
sizePolicy.setHeightForWidth(self.cmbParameters.sizePolicy().hasHeightForWidth())
|
||||
self.cmbParameters.setSizePolicy(sizePolicy)
|
||||
self.cmbParameters.setObjectName(_fromUtf8("cmbParameters"))
|
||||
self.gridLayout.addWidget(self.cmbParameters, 1, 1, 1, 1)
|
||||
self.buttonBox = QtGui.QDialogButtonBox(DlgAutofill)
|
||||
self.buttonBox.setOrientation(QtCore.Qt.Horizontal)
|
||||
self.buttonBox.setStandardButtons(QtGui.QDialogButtonBox.Cancel|QtGui.QDialogButtonBox.Ok)
|
||||
self.buttonBox.setObjectName(_fromUtf8("buttonBox"))
|
||||
self.gridLayout.addWidget(self.buttonBox, 2, 0, 1, 2)
|
||||
|
||||
self.retranslateUi(DlgAutofill)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), DlgAutofill.accept)
|
||||
QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("rejected()")), DlgAutofill.reject)
|
||||
QtCore.QMetaObject.connectSlotsByName(DlgAutofill)
|
||||
|
||||
def retranslateUi(self, DlgAutofill):
|
||||
DlgAutofill.setWindowTitle(QtGui.QApplication.translate("DlgAutofill", "Autofill settings", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.label.setText(QtGui.QApplication.translate("DlgAutofill", "Autofill mode", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.cmbFillType.setItemText(0, QtGui.QApplication.translate("DlgAutofill", "Do not autofill", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.cmbFillType.setItemText(1, QtGui.QApplication.translate("DlgAutofill", "Fill with numbers", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.cmbFillType.setItemText(2, QtGui.QApplication.translate("DlgAutofill", "Fill with parameter values", None, QtGui.QApplication.UnicodeUTF8))
|
||||
self.lblParameters.setText(QtGui.QApplication.translate("DlgAutofill", "Parameter to use", None, QtGui.QApplication.UnicodeUTF8))
|
||||
|
Loading…
x
Reference in New Issue
Block a user