当前位置: 首页>>代码示例>>Python>>正文


Python MultipleInputDialog.exec_方法代码示例

本文整理汇总了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')
开发者ID:ACorradini,项目名称:QGIS,代码行数:10,代码来源:MultipleInputPanel.py

示例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()
开发者ID:ndavid,项目名称:QGIS,代码行数:12,代码来源:MultipleInputPanel.py

示例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]))
开发者ID:mbernasocchi,项目名称:QGIS,代码行数:51,代码来源:BatchInputSelectionPanel.py

示例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")
开发者ID:alextheleritis,项目名称:QGIS,代码行数:22,代码来源:MultipleInputPanel.py

示例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())
开发者ID:ndavid,项目名称:QGIS,代码行数:38,代码来源:BatchInputSelectionPanel.py


注:本文中的processing.gui.MultipleInputDialog.MultipleInputDialog.exec_方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。