本文整理汇总了Python中processing.gui.matrixmodelerwidget.MatrixModelerWidget.setHeaders方法的典型用法代码示例。如果您正苦于以下问题:Python MatrixModelerWidget.setHeaders方法的具体用法?Python MatrixModelerWidget.setHeaders怎么用?Python MatrixModelerWidget.setHeaders使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.gui.matrixmodelerwidget.MatrixModelerWidget
的用法示例。
在下文中一共展示了MatrixModelerWidget.setHeaders方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ModelerParameterDefinitionDialog
# 需要导入模块: from processing.gui.matrixmodelerwidget import MatrixModelerWidget [as 别名]
# 或者: from processing.gui.matrixmodelerwidget.MatrixModelerWidget import setHeaders [as 别名]
#.........这里部分代码省略.........
if self.param is not None:
self.fileFolderCombo.setCurrentIndex(
1 if self.param.behavior() == QgsProcessingParameterFile.Folder else 0)
self.verticalLayout.addWidget(self.fileFolderCombo)
elif (self.paramType == parameters.PARAMETER_POINT or
isinstance(self.param, QgsProcessingParameterPoint)):
self.verticalLayout.addWidget(QLabel(self.tr('Default value')))
self.defaultTextBox = QLineEdit()
if self.param is not None:
self.defaultTextBox.setText(self.param.defaultValue())
self.verticalLayout.addWidget(self.defaultTextBox)
elif (self.paramType == parameters.PARAMETER_CRS or
isinstance(self.param, QgsProcessingParameterCrs)):
self.verticalLayout.addWidget(QLabel(self.tr('Default value')))
self.selector = QgsProjectionSelectionWidget()
if self.param is not None:
self.selector.setCrs(QgsCoordinateReferenceSystem(self.param.defaultValue()))
else:
self.selector.setCrs(QgsCoordinateReferenceSystem('EPSG:4326'))
self.verticalLayout.addWidget(self.selector)
elif self.paramType == parameters.PARAMETER_ENUM or \
isinstance(self.param, QgsProcessingParameterEnum):
self.widget = EnumModelerWidget(self)
if self.param is not None:
self.widget.setAllowMultiple(bool(self.param.allowMultiple()))
self.widget.setOptions(self.param.options())
self.widget.setDefault(self.param.defaultValue())
self.verticalLayout.addWidget(self.widget)
elif self.paramType == parameters.PARAMETER_MATRIX or \
isinstance(self.param, QgsProcessingParameterMatrix):
self.widget = MatrixModelerWidget(self)
if self.param is not None:
self.widget.setValue(self.param.defaultValue())
self.widget.setHeaders(self.param.headers())
self.widget.setFixedRows(self.param.hasFixedNumberRows())
self.verticalLayout.addWidget(self.widget)
self.verticalLayout.addSpacing(20)
self.requiredCheck = QCheckBox()
self.requiredCheck.setText(self.tr('Mandatory'))
self.requiredCheck.setChecked(True)
if self.param is not None:
self.requiredCheck.setChecked(not self.param.flags() & QgsProcessingParameterDefinition.FlagOptional)
self.verticalLayout.addWidget(self.requiredCheck)
self.buttonBox = QDialogButtonBox(self)
self.buttonBox.setOrientation(Qt.Horizontal)
self.buttonBox.setStandardButtons(QDialogButtonBox.Cancel |
QDialogButtonBox.Ok)
self.buttonBox.setObjectName('buttonBox')
self.buttonBox.accepted.connect(self.accept)
self.buttonBox.rejected.connect(self.reject)
self.verticalLayout.addStretch()
self.verticalLayout.addWidget(self.buttonBox)
self.setLayout(self.verticalLayout)
def accept(self):
description = self.nameTextBox.text()
if description.strip() == '':
QMessageBox.warning(self, self.tr('Unable to define parameter'),
self.tr('Invalid parameter name'))
return
if self.param is None:
validChars = \