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


Python QFileDialog.getSaveFileName方法代码示例

本文整理汇总了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"
            ) 
开发者ID:Oslandia,项目名称:albion,代码行数:24,代码来源:plugin.py

示例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"
            ) 
开发者ID:Oslandia,项目名称:albion,代码行数:24,代码来源:plugin.py

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

示例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]) 
开发者ID:birgander2,项目名称:PyRAT,代码行数:24,代码来源:mainPlugin.py

示例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) 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:7,代码来源:multizoom.py

示例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) 
开发者ID:enricofer,项目名称:go2mapillary,代码行数:9,代码来源:mapillary_api.py

示例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") 
开发者ID:Oslandia,项目名称:albion,代码行数:35,代码来源:plugin.py

示例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],
            ) 
开发者ID:Oslandia,项目名称:albion,代码行数:28,代码来源:plugin.py

示例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) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:11,代码来源:inventoryTools.py

示例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())) 
开发者ID:Arpapiemonte,项目名称:openoise-map,代码行数:16,代码来源:do_CalculateNoiseLevels.py

示例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())) 
开发者ID:Arpapiemonte,项目名称:openoise-map,代码行数:16,代码来源:do_CalculateNoiseLevels.py

示例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())) 
开发者ID:Arpapiemonte,项目名称:openoise-map,代码行数:17,代码来源:do_CalculateNoiseLevels.py

示例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())) 
开发者ID:Arpapiemonte,项目名称:openoise-map,代码行数:16,代码来源:do_CreateReceiverPoints.py


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