本文整理汇总了Python中processing.modeler.ModelerParameterDefinitionDialog.ModelerParameterDefinitionDialog.createAlgorithm方法的典型用法代码示例。如果您正苦于以下问题:Python ModelerParameterDefinitionDialog.createAlgorithm方法的具体用法?Python ModelerParameterDefinitionDialog.createAlgorithm怎么用?Python ModelerParameterDefinitionDialog.createAlgorithm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.modeler.ModelerParameterDefinitionDialog.ModelerParameterDefinitionDialog
的用法示例。
在下文中一共展示了ModelerParameterDefinitionDialog.createAlgorithm方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: editElement
# 需要导入模块: from processing.modeler.ModelerParameterDefinitionDialog import ModelerParameterDefinitionDialog [as 别名]
# 或者: from processing.modeler.ModelerParameterDefinitionDialog.ModelerParameterDefinitionDialog import createAlgorithm [as 别名]
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()
示例2: editElement
# 需要导入模块: from processing.modeler.ModelerParameterDefinitionDialog import ModelerParameterDefinitionDialog [as 别名]
# 或者: from processing.modeler.ModelerParameterDefinitionDialog.ModelerParameterDefinitionDialog import createAlgorithm [as 别名]
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()