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


Python QFileDialog.getOpenFileName方法代码示例

本文整理汇总了Python中qgis.PyQt.QtWidgets.QFileDialog.getOpenFileName方法的典型用法代码示例。如果您正苦于以下问题:Python QFileDialog.getOpenFileName方法的具体用法?Python QFileDialog.getOpenFileName怎么用?Python QFileDialog.getOpenFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qgis.PyQt.QtWidgets.QFileDialog的用法示例。


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

示例1: getOpenFileName

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getOpenFileName [as 别名]
def getOpenFileName(parent, caption, filedir, search_filter):
    result = QFileDialog.getOpenFileName(
        parent,
        caption,
        filedir,
        search_filter
    )

    if type(result) == tuple:
        return result[0]
    return result 
开发者ID:nextgis,项目名称:quickmapservices,代码行数:13,代码来源:compat2qgis.py

示例2: openDialog

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getOpenFileName [as 别名]
def openDialog(self):
        filename = QFileDialog.getOpenFileName(
            None, "Input File", self.dirname,
            "Text, CSV (*.txt *.csv);;All files (*.*)")[0]
        if filename:
            self.dirname = os.path.dirname(filename)
            self.readFile(filename) 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:9,代码来源:multizoom.py

示例3: qmlOpenDialog

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getOpenFileName [as 别名]
def qmlOpenDialog(self):
        filename = QFileDialog.getOpenFileName(
            None, "Input QML Style File",
            self.qmlLineEdit.text(), "QGIS Layer Style File (*.qml)")[0]
        if filename:
            self.qmlStyle = filename
            self.qmlLineEdit.setText(filename)
            self.markerStyleComboBox.setCurrentIndex(2) 
开发者ID:NationalSecurityAgency,项目名称:qgis-latlontools-plugin,代码行数:10,代码来源:settings.py

示例4: setupFromFile

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getOpenFileName [as 别名]
def setupFromFile(self):
        """
        Opens a earth coverage file
        """
        if QMessageBox.question(self, self.tr('Question'), self.tr('Do you want to open an earth coverage file?'), QMessageBox.Ok|QMessageBox.Cancel) == QMessageBox.Cancel:
            return
        filename, __ = QFileDialog.getOpenFileName(self, self.tr('Open Earth Coverage Setup configuration'), '', self.tr('Earth Coverage Files (*.json)'))
        return filename 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:10,代码来源:setupEarthCoverage.py

示例5: loadJson

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getOpenFileName [as 别名]
def loadJson(self, filename):
        """
        Loads a json file
        """
        filename, __ = QFileDialog.getOpenFileName(self, self.tr('Open Field Setup configuration'), self.folder, self.tr('Earth Coverage Setup File (*.dsgearthcov)'))
        if not filename:
            return
        return self.readJsonFile(filename) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:10,代码来源:setupEarthCoverage.py

示例6: reload_saved_settings

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getOpenFileName [as 别名]
def reload_saved_settings(self):

        saved_settings, __ = QFileDialog.getOpenFileName(None,'Open file', on_Settings.getOneSetting('directory_last') , "Settings (*.xml);;All files (*)")

        if saved_settings is None or saved_settings == "":
            return

        try:
            on_Settings.copySavedSettingsToSettings(saved_settings)
            self.reload_settings()

        except:
            QMessageBox.information(self, self.tr("opeNoise - Calculate Noise Levels"), self.tr("Sorry, but somethigs wrong in import saved settings.")) 
开发者ID:Arpapiemonte,项目名称:openoise-map,代码行数:15,代码来源:do_CalculateNoiseLevels.py

示例7: __import_project

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getOpenFileName [as 别名]
def __import_project(self):
        fil, __ = QFileDialog.getOpenFileName(
            None,
            u"Import project from file",
            QgsProject.instance().readEntry("albion", "last_dir", "")[0],
            "File formats (*.zip)",
        )
        if not fil:
            return

        QgsProject.instance().writeEntry("albion", "last_dir", os.path.dirname(fil)),

        if fil[-4:] != ".zip":
            self.__iface.messageBar().pushWarning(
                "Albion", "unsupported extension for import"
            )

        project_name = os.path.split(fil)[1][:-4]
        dir_ = tempfile.mkdtemp()
        with zipfile.ZipFile(fil, "r") as z:
            z.extractall(dir_)

        dump = find_in_dir(dir_, ".dump")
        prj = find_in_dir(dir_, ".qgs")

        self.__iface.messageBar().pushInfo(
            "Albion", "loading {} from {}".format(project_name, dump)
        )

        dbname = os.path.splitext(os.path.basename(dump))[0]

        if Project.exists(dbname):
            if (
                QMessageBox.Yes
                != QMessageBox(
                    QMessageBox.Information,
                    "Delete existing DB",
                    "Database {} exits, to you want to delete it ?".format(
                        dbname
                    ),
                    QMessageBox.Yes | QMessageBox.No,
                ).exec_()
            ):
                return
            Project.delete(dbname)

        project = Project.import_(dbname, dump)

        QgsProject.instance().read(prj) 
开发者ID:Oslandia,项目名称:albion,代码行数:51,代码来源:plugin.py


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