本文整理汇总了Python中qgis.PyQt.QtWidgets.QFileDialog.getSaveFileName方法的典型用法代码示例。如果您正苦于以下问题:Python QFileDialog.getSaveFileName方法的具体用法?Python QFileDialog.getSaveFileName怎么用?Python QFileDialog.getSaveFileName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qgis.PyQt.QtWidgets.QFileDialog
的用法示例。
在下文中一共展示了QFileDialog.getSaveFileName方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __export_volume
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def __export_volume(self):
assert(self.project)
fil, __ = QFileDialog.getSaveFileName(
None,
u"Export volume for current graph",
QgsProject.instance().readEntry("albion", "last_dir", "")[0],
"File formats (*.dxf *.obj)",
)
if not fil:
return
QgsProject.instance().writeEntry("albion", "last_dir", os.path.dirname(fil))
if fil[-4:] == ".obj":
self.project.export_obj(self.__current_graph.currentText(), fil)
elif fil[-4:] == ".dxf":
self.project.export_dxf(self.__current_graph.currentText(), fil)
else:
self.__iface.messageBar().pushWarning(
"Albion", "unsupported extension for volume export"
)
示例2: __export_sections
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def __export_sections(self):
assert(self.project)
fil, __ = QFileDialog.getSaveFileName(
None,
u"Export named sections for current graph",
QgsProject.instance().readEntry("albion", "last_dir", "")[0],
"File formats (*.dxf *.obj)",
)
if not fil:
return
QgsProject.instance().writeEntry("albion", "last_dir", os.path.dirname(fil))
if fil[-4:] == ".obj":
self.project.export_sections_obj(self.__current_graph.currentText(), fil)
elif fil[-4:] == ".dxf":
self.project.export_sections_dxf(self.__current_graph.currentText(), fil)
else:
self.__iface.messageBar().pushWarning(
"Albion", "unsupported extension for section export"
)
示例3: __export_holes
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def __export_holes(self):
assert(self.project)
fil, __ = QFileDialog.getSaveFileName(
None,
u"Export holes",
QgsProject.instance().readEntry("albion", "last_dir", "")[0],
"File formats (*.dxf *.vtk)",
)
if not fil:
return
QgsProject.instance().writeEntry("albion", "last_dir", os.path.dirname(fil))
if fil[-4:] == ".vtk":
self.project.export_holes_vtk(fil)
elif fil[-4:] == ".dxf":
self.project.export_holes_dxf(fil)
else:
self.__iface.messageBar().pushWarning("Albion", "unsupported extension for hole export")
示例4: pyratToLayer
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def pyratToLayer(layerid=None):
"""Exports a PyRAT-layer into QGIS"""
if type(layerid) is str:
pyrat.data.activateLayer(layerid)
annotation = pyrat.data.getAnnotation()
if 'info' in annotation:
filename = path.join(pyrat.data.tmpdir, annotation['info'] +
".rat")
else:
filename = path.join(pyrat.data.tmpdir, "PyRAT.rat")
filename, s = QFileDialog.getSaveFileName(
iface.mainWindow(),
"Save the PyRAT-Layer",
filename,
"RAT-File (*.rat)")
if not s or filename == "":
return
pyrat.save.rat((filename, "rat"), geo_envi_hdr=True)
iface.addRasterLayer(filename, path.basename(filename).split(".")[0])
示例5: saveDialog
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def saveDialog(self):
filename = QFileDialog.getSaveFileName(None, "Save File", self.dirname, "Text CSV (*.csv)")[0]
if filename:
self.dirname = os.path.dirname(filename)
self.saveFile(filename)
示例6: download
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def download(self,key):
res = requests.get(DOWNLOAD_ENDPOINT % key, proxies=getProxiesConf())
if res.status_code == 200:
fileName = QFileDialog.getSaveFileName(None,'Save mapillary Image',key+'.jpg',"JPG (*.jpg)")
if fileName:
with open(fileName[0], 'wb') as f:
f.write(res.content)
示例7: __export_layer
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def __export_layer(self):
assert(self.project)
table = None
for l in self.__iface.layerTreeView().selectedLayers():
uri = QgsDataSourceUri(l.dataProvider().dataSourceUri())
table = uri.table()
if table.endswith('_section'):
table = table[:-8]
break
if table is None:
self.__iface.messageBar().pushWarning("Albion", "you must select a layer")
return
fil, __ = QFileDialog.getSaveFileName(
None,
u"Export layer",
QgsProject.instance().readEntry("albion", "last_dir", "")[0],
"File formats (*.dxf *.vtk)",
)
if not fil:
return
QgsProject.instance().writeEntry("albion", "last_dir", os.path.dirname(fil))
if fil.endswith('.vtk'):
self.project.export_layer_vtk(table, fil)
elif fil.endswith('.dxf'):
self.project.export_layer_dxf(table, fil)
else:
self.__iface.messageBar().pushWarning("Albion", "unsupported extension for hole export")
示例8: __export_project
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def __export_project(self):
if self.project is None:
return
fil, __ = QFileDialog.getSaveFileName(
None,
u"Export project",
QgsProject.instance().readEntry("albion", "last_dir", "")[0],
"Data files(*.zip)",
)
if not fil:
return
QgsProject.instance().writeEntry("albion", "last_dir", os.path.dirname(fil)),
if os.path.exists(fil):
os.remove(fil)
with zipfile.ZipFile(fil, "w") as project:
dump = tempfile.mkstemp()[1]
self.project.export(dump)
project.write(dump, self.project.name + ".dump")
project.write(
QgsProject.instance().fileName(),
os.path.split(QgsProject.instance().fileName())[1],
)
示例9: on_outputFileButton_clicked
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def on_outputFileButton_clicked(self):
'''
Inventory output file selection
'''
if self.onlyGeoCheckBox.isChecked():
fileName, __ = QFileDialog.getSaveFileName(parent=self, caption=self.tr('Save Output File'), filter='Shapefile (*.shp)')
else:
fileName, __ = QFileDialog.getSaveFileName(parent=self, caption=self.tr('Save Output File'), filter='CSV (*.csv)')
self.outputFileEdit.setText(fileName)
示例10: outFile_rays
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def outFile_rays(self):
self.rays_layer_lineEdit.clear()
shapefileName, __ = QFileDialog.getSaveFileName(None,'Open file', on_Settings.getOneSetting('directory_last') , "Shapefile (*.shp);;All files (*)")
if shapefileName is None or shapefileName == "":
return
if str.find(shapefileName,".shp") == -1 and str.find(shapefileName,".SHP") == -1:
self.rays_layer_lineEdit.setText( shapefileName + ".shp")
else:
self.rays_layer_lineEdit.setText( shapefileName)
on_Settings.setOneSetting('directory_last',os.path.dirname(self.rays_layer_lineEdit.text()))
示例11: outFile_diff_rays
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def outFile_diff_rays(self):
self.diff_rays_layer_lineEdit.clear()
shapefileName, __ = QFileDialog.getSaveFileName(None,'Open file', on_Settings.getOneSetting('directory_last') , "Shapefile (*.shp);;All files (*)")
if shapefileName is None or shapefileName == "":
return
if str.find(shapefileName,".shp") == -1 and str.find(shapefileName,".SHP") == -1:
self.diff_rays_layer_lineEdit.setText( shapefileName + ".shp")
else:
self.diff_rays_layer_lineEdit.setText( shapefileName)
on_Settings.setOneSetting('directory_last',os.path.dirname(self.diff_rays_layer_lineEdit.text()))
示例12: outFile_save_settings
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def outFile_save_settings(self):
self.save_settings_lineEdit.clear()
save_settings_path, __ = QFileDialog.getSaveFileName(None,'Open file', on_Settings.getOneSetting('directory_last') , "Settings (*.xml);;All files (*)")
if save_settings_path is None or save_settings_path == "":
return
if str.find(save_settings_path,".xml") == -1 and str.find(save_settings_path,".XML") == -1:
self.save_settings_lineEdit.setText( save_settings_path + ".xml")
else:
self.save_settings_lineEdit.setText( save_settings_path )
on_Settings.setOneSetting('directory_last',os.path.dirname(self.save_settings_lineEdit.text()))
示例13: outFile
# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getSaveFileName [as 别名]
def outFile(self):
self.receiver_layer_lineEdit.clear()
self.shapefileName = QFileDialog.getSaveFileName(None,'Open file', on_Settings.getOneSetting('directory_last') , "Shapefile (*.shp);;All files (*)")
if self.shapefileName is None or self.shapefileName == "":
return
if str.find(self.shapefileName[0],".shp") == -1 and str.find(self.shapefileName[0],".SHP") == -1:
self.receiver_layer_lineEdit.setText( self.shapefileName[0] + ".shp")
else:
self.receiver_layer_lineEdit.setText( self.shapefileName[0])
on_Settings.setOneSetting('directory_last',os.path.dirname(self.receiver_layer_lineEdit.text()))