本文整理汇总了Python中processing.gui.MultipleInputDialog.MultipleInputDialog.exec_方法的典型用法代码示例。如果您正苦于以下问题:Python MultipleInputDialog.exec_方法的具体用法?Python MultipleInputDialog.exec_怎么用?Python MultipleInputDialog.exec_使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.gui.MultipleInputDialog.MultipleInputDialog
的用法示例。
在下文中一共展示了MultipleInputDialog.exec_方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: showSelectionDialog
# 需要导入模块: from processing.gui.MultipleInputDialog import MultipleInputDialog [as 别名]
# 或者: from processing.gui.MultipleInputDialog.MultipleInputDialog import exec_ [as 别名]
def showSelectionDialog(self):
dlg = MultipleInputDialog(self.options, self.selectedoptions)
dlg.exec_()
if dlg.selectedoptions is not None:
self.selectedoptions = dlg.selectedoptions
self.label.setText(str(len(self.selectedoptions))
+ ' elements selected')
示例2: showSelectionDialog
# 需要导入模块: from processing.gui.MultipleInputDialog import MultipleInputDialog [as 别名]
# 或者: from processing.gui.MultipleInputDialog.MultipleInputDialog import exec_ [as 别名]
def showSelectionDialog(self):
if self.datatype is None:
dlg = MultipleInputDialog(self.options, self.selectedoptions)
else:
dlg = MultipleFileInputDialog(self.selectedoptions)
dlg.exec_()
if dlg.selectedoptions is not None:
self.selectedoptions = dlg.selectedoptions
self.leText.setText(self.tr("%d elements selected") % len(self.selectedoptions))
self.selectionChanged.emit()
示例3: showLayerSelectionDialog
# 需要导入模块: from processing.gui.MultipleInputDialog import MultipleInputDialog [as 别名]
# 或者: from processing.gui.MultipleInputDialog.MultipleInputDialog import exec_ [as 别名]
def showLayerSelectionDialog(self):
layers = []
if (isinstance(self.param, QgsProcessingParameterRasterLayer) or
(isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType() == QgsProcessing.TypeRaster)):
layers = QgsProcessingUtils.compatibleRasterLayers(QgsProject.instance())
elif isinstance(self.param, QgsProcessingParameterVectorLayer):
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())
elif (isinstance(self.param, QgsProcessingParameterMeshLayer) or
(isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType() == QgsProcessing.TypeMesh)):
layers = QgsProcessingUtils.compatibleMeshLayers(QgsProject.instance())
else:
datatypes = [QgsProcessing.TypeVectorAnyGeometry]
if isinstance(self.param, QgsProcessingParameterFeatureSource):
datatypes = self.param.dataTypes()
elif isinstance(self.param, QgsProcessingParameterMultipleLayers):
datatypes = [self.param.layerType()]
if QgsProcessing.TypeVectorAnyGeometry not in datatypes:
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), datatypes)
else:
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())
dlg = MultipleInputDialog([layer.name() for layer in layers])
dlg.exec_()
def generate_layer_id(layer):
# prefer layer name if unique
if len([l for l in layers if l.name().lower() == layer.name().lower()]) == 1:
return layer.name()
else:
# otherwise fall back to layer id
return layer.id()
if dlg.selectedoptions is not None:
selected = dlg.selectedoptions
if len(selected) == 1:
self.setValue(generate_layer_id(layers[selected[0]]))
else:
if isinstance(self.param, QgsProcessingParameterMultipleLayers):
self.text.setText(';'.join(layers[idx].id() for idx in selected))
else:
rowdif = len(selected) - (self._table().rowCount() - self.row)
for i in range(rowdif):
self._panel().addRow()
for i, layeridx in enumerate(selected):
self._table().cellWidget(i + self.row,
self.col).setValue(generate_layer_id(layers[layeridx]))
示例4: showSelectionDialog
# 需要导入模块: from processing.gui.MultipleInputDialog import MultipleInputDialog [as 别名]
# 或者: from processing.gui.MultipleInputDialog.MultipleInputDialog import exec_ [as 别名]
def showSelectionDialog(self):
#=======================================================================
# #If there is a datatype, we use it to create the list of options
# if self.datatype is not None:
# if self.datatype == ParameterMultipleInput.TYPE_RASTER:
# options = QGisLayers.getRasterLayers()
# elif self.datatype == ParameterMultipleInput.TYPE_VECTOR_ANY:
# options = QGisLayers.getVectorLayers()
# else:
# options = QGisLayers.getVectorLayers(self.datatype)
# opts = []
# for opt in options:
# opts.append(opt.name())
# self.options = opts
#=======================================================================
dlg = MultipleInputDialog(self.options, self.selectedoptions)
dlg.exec_()
if dlg.selectedoptions != None:
self.selectedoptions = dlg.selectedoptions
self.label.setText(str(len(self.selectedoptions)) + " elements selected")
示例5: showLayerSelectionDialog
# 需要导入模块: from processing.gui.MultipleInputDialog import MultipleInputDialog [as 别名]
# 或者: from processing.gui.MultipleInputDialog.MultipleInputDialog import exec_ [as 别名]
def showLayerSelectionDialog(self):
layers = []
if (isinstance(self.param, QgsProcessingParameterRasterLayer) or
(isinstance(self.param, QgsProcessingParameterMultipleLayers) and
self.param.layerType() == QgsProcessingParameterDefinition.TypeRaster)):
layers = QgsProcessingUtils.compatibleRasterLayers(QgsProject.instance())
elif isinstance(self.param, QgsProcessingParameterVectorLayer):
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())
else:
datatypes = [QgsProcessingParameterDefinition.TypeVectorAny]
if isinstance(self.param, QgsProcessingParameterFeatureSource):
datatypes = self.param.dataTypes()
elif isinstance(self.param, QgsProcessingParameterMultipleLayers):
datatypes = [self.param.layerType()]
if QgsProcessingParameterDefinition.TypeVectorAny not in datatypes:
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance(), datatypes)
else:
layers = QgsProcessingUtils.compatibleVectorLayers(QgsProject.instance())
dlg = MultipleInputDialog([layer.name() for layer in layers])
dlg.exec_()
if dlg.selectedoptions is not None:
selected = dlg.selectedoptions
if len(selected) == 1:
self.setValue(layers[selected[0]].id())
else:
if isinstance(self.param, QgsProcessingParameterMultipleLayers):
self.text.setText(';'.join(layers[idx].id() for idx in selected))
else:
rowdif = len(selected) - (self._table().rowCount() - self.row)
for i in range(rowdif):
self._panel().addRow()
for i, layeridx in enumerate(selected):
self._table().cellWidget(i + self.row,
self.col).setValue(layers[layeridx].id())