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