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


Python AutofillDialog.AutofillDialog类代码示例

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


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

示例1: showSelectionDialog

    def showSelectionDialog(self):
        if isinstance(self.output, OutputDirectory):
            self.selectDirectory()
            return

        filefilter = self.output.getFileFilter(self.alg)
        settings = QSettings()
        if settings.contains('/Processing/LastBatchOutputPath'):
            path = str(settings.value('/Processing/LastBatchOutputPath'))
        else:
            path = ''
        filename, selectedFileFilter = QFileDialog.getSaveFileName(self,
                                                                   self.tr('Save file'), path, filefilter)
        if filename:
            if not filename.lower().endswith(
                    tuple(re.findall("\*(\.[a-z]{1,10})", filefilter))):
                ext = re.search("\*(\.[a-z]{1,10})", selectedFileFilter)
                if ext:
                    filename += ext.group(1)
            settings.setValue('/Processing/LastBatchOutputPath', os.path.dirname(filename))
            dlg = AutofillDialog(self.alg)
            dlg.exec_()
            if dlg.mode is not None:
                try:
                    if dlg.mode == AutofillDialog.DO_NOT_AUTOFILL:
                        self.table.cellWidget(self.row,
                                              self.col).setValue(filename)
                    elif dlg.mode == AutofillDialog.FILL_WITH_NUMBERS:
                        n = self.table.rowCount() - self.row
                        for i in range(n):
                            name = filename[:filename.rfind('.')] \
                                + str(i + 1) + filename[filename.rfind('.'):]
                            self.table.cellWidget(i + self.row,
                                                  self.col).setValue(name)
                    elif dlg.mode == AutofillDialog.FILL_WITH_PARAMETER:
                        n = self.table.rowCount() - self.row
                        for i in range(n):
                            widget = self.table.cellWidget(i + self.row,
                                                           dlg.param)
                            param = self.alg.parameters[dlg.param]
                            if isinstance(param, (ParameterRaster,
                                                  ParameterVector, ParameterTable,
                                                  ParameterMultipleInput)):
                                s = str(widget.getText())
                                s = os.path.basename(s)
                                s = os.path.splitext(s)[0]
                            elif isinstance(param, ParameterBoolean):
                                s = str(widget.currentIndex() == 0)
                            elif isinstance(param, ParameterSelection):
                                s = str(widget.currentText())
                            elif isinstance(param, ParameterFixedTable):
                                s = str(widget.table)
                            else:
                                s = str(widget.text())
                            name = filename[:filename.rfind('.')] + s \
                                + filename[filename.rfind('.'):]
                            self.table.cellWidget(i + self.row,
                                                  self.col).setValue(name)
                except:
                    pass
开发者ID:liminlu0314,项目名称:QGIS,代码行数:60,代码来源:BatchOutputSelectionPanel.py

示例2: showSelectionDialog

 def showSelectionDialog(self):
     filefilter = self.output.getFileFilter(self.alg)
     filename = QtGui.QFileDialog.getSaveFileName(self, self.tr('Save file'), '',
             filefilter)
     if filename:
         filename = unicode(filename)
         dlg = AutofillDialog(self.alg)
         dlg.exec_()
         if dlg.mode is not None:
             try:
                 if dlg.mode == AutofillDialog.DO_NOT_AUTOFILL:
                     self.table.cellWidget(self.row,
                             self.col).setValue(filename)
                 elif dlg.mode == AutofillDialog.FILL_WITH_NUMBERS:
                     n = self.table.rowCount() - self.row
                     for i in range(n):
                         name = filename[:filename.rfind('.')] \
                             + str(i + 1) + filename[filename.rfind('.'):]
                         self.table.cellWidget(i + self.row,
                                 self.col).setValue(name)
                 elif dlg.mode == AutofillDialog.FILL_WITH_PARAMETER:
                     n = self.table.rowCount() - self.row
                     for i in range(n):
                         widget = self.table.cellWidget(i + self.row,
                                 dlg.param)
                         param = self.alg.parameters[dlg.param]
                         if isinstance(param, (ParameterRaster,
                                 ParameterVector, ParameterTable,
                                 ParameterMultipleInput)):
                             s = unicode(widget.getText())
                             s = os.path.basename(s)
                             s = os.path.splitext()[0]
                         elif isinstance(param, ParameterBoolean):
                             s = str(widget.currentIndex() == 0)
                         elif isinstance(param, ParameterSelection):
                             s = unicode(widget.currentText())
                         elif isinstance(param, ParameterFixedTable):
                             s = unicode(widget.table)
                         else:
                             s = unicode(widget.text())
                         name = filename[:filename.rfind('.')] + s \
                             + filename[filename.rfind('.'):]
                         self.table.cellWidget(i + self.row,
                                 self.col).setValue(name)
             except:
                 pass
开发者ID:cs-ozgur,项目名称:QGIS,代码行数:46,代码来源:BatchOutputSelectionPanel.py


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