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


Python MultipleInputDialog.MultipleInputDialog类代码示例

本文整理汇总了Python中processing.gui.MultipleInputDialog.MultipleInputDialog的典型用法代码示例。如果您正苦于以下问题:Python MultipleInputDialog类的具体用法?Python MultipleInputDialog怎么用?Python MultipleInputDialog使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了MultipleInputDialog类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: showSelectionDialog

    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,代码行数:8,代码来源:MultipleInputPanel.py

示例2: showSelectionDialog

 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,代码行数:10,代码来源:MultipleInputPanel.py

示例3: showLayerSelectionDialog

    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,代码行数:49,代码来源:BatchInputSelectionPanel.py

示例4: showSelectionDialog

 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,代码行数:20,代码来源:MultipleInputPanel.py

示例5: showLayerSelectionDialog

    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,代码行数:36,代码来源:BatchInputSelectionPanel.py


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