本文整理汇总了Python中processing.modeler.ModelerParameterDefinitionDialog.ModelerParameterDefinitionDialog类的典型用法代码示例。如果您正苦于以下问题:Python ModelerParameterDefinitionDialog类的具体用法?Python ModelerParameterDefinitionDialog怎么用?Python ModelerParameterDefinitionDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModelerParameterDefinitionDialog类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addInputOfType
def addInputOfType(self, paramType, pos=None):
if paramType in ModelerParameterDefinitionDialog.paramTypes:
dlg = ModelerParameterDefinitionDialog(self.alg, paramType)
dlg.exec_()
if dlg.param is not None:
if pos is None:
pos = self.getPositionForParameterItem()
if isinstance(pos, QPoint):
pos = QPointF(pos)
self.alg.addParameter(ModelerParameter(dlg.param, pos))
self.repaintModel()
#self.view.ensureVisible(self.scene.getLastParameterItem())
self.hasChanged = True
示例2: addInputOfType
def addInputOfType(self, paramType, pos=None):
dlg = ModelerParameterDefinitionDialog(self.model, paramType)
dlg.exec_()
if dlg.param is not None:
if pos is None:
pos = self.getPositionForParameterItem()
if isinstance(pos, QPoint):
pos = QPointF(pos)
component = QgsProcessingModelParameter(dlg.param.name())
component.setDescription(dlg.param.name())
component.setPosition(pos)
self.model.addModelParameter(dlg.param, component)
self.repaintModel()
# self.view.ensureVisible(self.scene.getLastParameterItem())
self.hasChanged = True
示例3: editElement
def editElement(self):
if isinstance(self.element, QgsProcessingModelParameter):
dlg = ModelerParameterDefinitionDialog(self.model,
param=self.model.parameterDefinition(self.element.parameterName()))
if dlg.exec_() and dlg.param is not None:
self.model.removeModelParameter(self.element.parameterName())
self.element.setParameterName(dlg.param.name())
self.element.setDescription(dlg.param.name())
self.model.addModelParameter(dlg.param, self.element)
self.text = dlg.param.description()
self.scene.dialog.repaintModel()
elif isinstance(self.element, QgsProcessingModelChildAlgorithm):
elemAlg = self.element.algorithm()
dlg = ModelerParametersDialog(elemAlg, self.model, self.element.childId(), self.element.configuration())
if dlg.exec_():
alg = dlg.createAlgorithm()
alg.setChildId(self.element.childId())
self.updateAlgorithm(alg)
self.scene.dialog.repaintModel()
elif isinstance(self.element, QgsProcessingModelOutput):
child_alg = self.model.childAlgorithm(self.element.childId())
param_name = '{}:{}'.format(self.element.childId(), self.element.name())
dlg = ModelerParameterDefinitionDialog(self.model,
param=self.model.parameterDefinition(param_name))
if dlg.exec_() and dlg.param is not None:
model_output = child_alg.modelOutput(self.element.name())
model_output.setDescription(dlg.param.description())
model_output.setDefaultValue(dlg.param.defaultValue())
model_output.setMandatory(not (dlg.param.flags() & QgsProcessingParameterDefinition.FlagOptional))
self.model.updateDestinationParameters()
示例4: editElement
def editElement(self):
if isinstance(self.element, QgsProcessingModelParameter):
dlg = ModelerParameterDefinitionDialog(self.model,
param=self.model.parameterDefinition(self.element.parameterName()))
if dlg.exec_() and dlg.param is not None:
self.model.removeModelParameter(self.element.parameterName())
self.element.setParameterName(dlg.param.name())
self.element.setDescription(dlg.param.name())
self.model.addModelParameter(dlg.param, self.element)
self.text = dlg.param.description()
self.scene.dialog.repaintModel()
elif isinstance(self.element, QgsProcessingModelChildAlgorithm):
elemAlg = self.element.algorithm()
dlg = ModelerParametersDialog(elemAlg, self.model, self.element.childId(), self.element.configuration())
if dlg.exec_():
alg = dlg.createAlgorithm()
alg.setChildId(self.element.childId())
self.updateAlgorithm(alg)
self.scene.dialog.repaintModel()
示例5: editElement
def editElement(self):
if isinstance(self.element, QgsProcessingModelParameter):
dlg = ModelerParameterDefinitionDialog(self.model,
param=self.model.parameterDefinition(self.element.parameterName()))
dlg.exec_()
if dlg.param is not None:
self.model.removeModelParameter(self.element.parameterName())
self.element.setParameterName(dlg.param.name())
self.element.setDescription(dlg.param.name())
self.model.addModelParameter(dlg.param, self.element)
self.text = dlg.param.description()
self.scene.dialog.repaintModel()
elif isinstance(self.element, QgsProcessingModelChildAlgorithm):
dlg = None
try:
dlg = self.element.algorithm().getCustomModelerParametersDialog(self.model, self.element.childId())
except:
pass
if not dlg:
dlg = ModelerParametersDialog(self.element.algorithm(), self.model, self.element.childId())
dlg.exec_()
if dlg.alg is not None:
dlg.alg.setChildId(self.element.childId())
self.updateAlgorithm(dlg.alg)
self.scene.dialog.repaintModel()
示例6: fillInputsTree
def fillInputsTree(self):
icon = QIcon(os.path.join(pluginPath, 'images', 'input.svg'))
parametersItem = QTreeWidgetItem()
parametersItem.setText(0, self.tr('Parameters'))
for paramType in sorted(ModelerParameterDefinitionDialog.paramTypes):
paramItem = QTreeWidgetItem()
paramItem.setText(0, paramType)
paramItem.setIcon(0, icon)
paramItem.setFlags(Qt.ItemIsEnabled | Qt.ItemIsSelectable | Qt.ItemIsDragEnabled)
paramItem.setToolTip(0, ModelerParameterDefinitionDialog.inputTooltip(paramType))
parametersItem.addChild(paramItem)
self.inputsTree.addTopLevelItem(parametersItem)
parametersItem.setExpanded(True)
示例7: editElement
def editElement(self):
self.model.setPositions(self.scene().getParameterPositions(), self.scene().getAlgorithmPositions(), self.scene().getOutputPositions())
if isinstance(self.element, Parameter):
dlg = ModelerParameterDefinitionDialog(self.model, param = self.element)
dlg.exec_()
if dlg.param != None:
self.model.updateParameter(self.elementIndex, dlg.param)
self.element = dlg.param
self.text = self.element.description
self.update()
elif isinstance(self.element, GeoAlgorithm):
dlg = self.element.getCustomModelerParametersDialog(self.model, self.elementIndex)
if not dlg:
dlg = ModelerParametersDialog(self.element, self.model, self.elementIndex)
dlg.exec_()
if dlg.params != None:
self.model.updateAlgorithm(self.elementIndex, dlg.params, dlg.values, dlg.outputs, dlg.dependencies)
示例8: editElement
def editElement(self):
if isinstance(self.element, ModelerParameter):
dlg = ModelerParameterDefinitionDialog(self.model, param=self.element.param)
dlg.exec_()
if dlg.param is not None:
self.model.updateParameter(dlg.param)
self.element.param = dlg.param
self.text = dlg.param.description
self.update()
elif isinstance(self.element, Algorithm):
dlg = self.element.algorithm.getCustomModelerParametersDialog(self.model, self.element.name)
if not dlg:
dlg = ModelerParametersDialog(self.element.algorithm, self.model, self.element.name)
dlg.exec_()
if dlg.alg is not None:
dlg.alg.name = self.element.name
self.model.updateAlgorithm(dlg.alg)
self.model.updateModelerView()