本文整理汇总了Python中processing.gui.matrixmodelerwidget.MatrixModelerWidget.allowMultiple方法的典型用法代码示例。如果您正苦于以下问题:Python MatrixModelerWidget.allowMultiple方法的具体用法?Python MatrixModelerWidget.allowMultiple怎么用?Python MatrixModelerWidget.allowMultiple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.gui.matrixmodelerwidget.MatrixModelerWidget
的用法示例。
在下文中一共展示了MatrixModelerWidget.allowMultiple方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ModelerParameterDefinitionDialog
# 需要导入模块: from processing.gui.matrixmodelerwidget import MatrixModelerWidget [as 别名]
# 或者: from processing.gui.matrixmodelerwidget.MatrixModelerWidget import allowMultiple [as 别名]
class ModelerParameterDefinitionDialog(QDialog):
def __init__(self, alg, paramType=None, param=None):
self.alg = alg
self.paramType = paramType
self.param = param
QDialog.__init__(self)
self.setModal(True)
self.setupUi()
settings = QgsSettings()
self.restoreGeometry(settings.value("/Processing/modelParametersDefinitionDialogGeometry", QByteArray()))
def closeEvent(self, event):
settings = QgsSettings()
settings.setValue("/Processing/modelParametersDefinitionDialogGeometry", self.saveGeometry())
super(ModelerParameterDefinitionDialog, self).closeEvent(event)
def setupUi(self):
self.setWindowTitle(self.tr('Parameter Definition'))
self.setMinimumWidth(300)
self.verticalLayout = QVBoxLayout(self)
self.verticalLayout.setMargin(20)
self.label = QLabel(self.tr('Parameter name'))
self.verticalLayout.addWidget(self.label)
self.nameTextBox = QLineEdit()
self.verticalLayout.addWidget(self.nameTextBox)
if isinstance(self.param, QgsProcessingParameterDefinition):
self.nameTextBox.setText(self.param.description())
if self.paramType == parameters.PARAMETER_BOOLEAN or \
isinstance(self.param, QgsProcessingParameterBoolean):
self.state = QCheckBox()
self.state.setText(self.tr('Checked'))
self.state.setChecked(False)
if self.param is not None:
self.state.setChecked(bool(self.param.defaultValue()))
self.verticalLayout.addWidget(self.state)
elif self.paramType == parameters.PARAMETER_TABLE_FIELD or \
isinstance(self.param, QgsProcessingParameterField):
self.verticalLayout.addWidget(QLabel(self.tr('Parent layer')))
self.parentCombo = QComboBox()
idx = 0
for param in list(self.alg.parameterComponents().values()):
definition = self.alg.parameterDefinition(param.parameterName())
if isinstance(definition, (QgsProcessingParameterFeatureSource, QgsProcessingParameterVectorLayer)):
self.parentCombo.addItem(definition.description(), definition.name())
if self.param is not None:
if self.param.parentLayerParameterName() == definition.name():
self.parentCombo.setCurrentIndex(idx)
idx += 1
self.verticalLayout.addWidget(self.parentCombo)
# add the datatype selector
self.verticalLayout.addWidget(QLabel(self.tr('Allowed data type')))
self.datatypeCombo = QComboBox()
self.datatypeCombo.addItem(self.tr('Any'), -1)
self.datatypeCombo.addItem(self.tr('Number'), 0)
self.datatypeCombo.addItem(self.tr('String'), 1)
self.datatypeCombo.addItem(self.tr('Date/time'), 2)
self.verticalLayout.addWidget(self.datatypeCombo)
if self.param is not None and self.param.dataType() is not None:
# QComboBoxes indexes start at 0,
# self.param.datatype start with -1 that is why I need to do +1
datatypeIndex = self.param.dataType() + 1
self.datatypeCombo.setCurrentIndex(datatypeIndex)
self.multipleCheck = QCheckBox()
self.multipleCheck.setText(self.tr('Accept multiple fields'))
self.multipleCheck.setChecked(False)
if self.param is not None:
self.multipleCheck.setChecked(self.param.allowMultiple())
self.verticalLayout.addWidget(self.multipleCheck)
self.verticalLayout.addWidget(QLabel(self.tr('Default value')))
self.defaultTextBox = QLineEdit()
self.defaultTextBox.setToolTip(
self.tr('Default field name, or ; separated list of field names for multiple field parameters'))
if self.param is not None:
default = self.param.defaultValue()
if default is not None:
self.defaultTextBox.setText(str(default))
self.verticalLayout.addWidget(self.defaultTextBox)
elif self.paramType == parameters.PARAMETER_BAND or \
isinstance(self.param, QgsProcessingParameterBand):
self.verticalLayout.addWidget(QLabel(self.tr('Parent layer')))
self.parentCombo = QComboBox()
idx = 0
for param in list(self.alg.parameterComponents().values()):
definition = self.alg.parameterDefinition(param.parameterName())
if isinstance(definition, (QgsProcessingParameterRasterLayer)):
self.parentCombo.addItem(definition.description(), definition.name())
if self.param is not None:
if self.param.parentLayerParameterName() == definition.name():
self.parentCombo.setCurrentIndex(idx)
idx += 1
#.........这里部分代码省略.........