當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。