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


Python QFileDialog.getExistingDirectory方法代码示例

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


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

示例1: show_selection_dialog

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def show_selection_dialog(self):
        # Find the file dialog's working directory
        settings = QSettings()
        text = self.leText.text()
        if os.path.isdir(text):
            path = text
        elif os.path.isdir(os.path.dirname(text)):
            path = os.path.dirname(text)
        else:
            path = PluginSettings.last_icon_path()

        if self.is_folder:
            folder = QFileDialog.getExistingDirectory(self, self.dialog_title, path)
            if folder:
                self.leText.setText(folder)
                PluginSettings.set_last_icon_path(os.path.dirname(folder))
        else:
            filename = getOpenFileName(self, self.dialog_title, path, self.ext)
            if filename:
                self.leText.setText(filename)
                PluginSettings.set_last_icon_path(os.path.dirname(filename)) 
开发者ID:nextgis,项目名称:quickmapservices,代码行数:23,代码来源:file_selection_widget.py

示例2: askForFolder

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def askForFolder(parent, msg=None, options=QFileDialog.ShowDirsOnly):
    ''' dialog for save or load folder '''
    msg = msg or 'Select folder'
    caller = _callerName().split(".")
    name = "/".join(["LAST_PATH", caller[-1]])
    namespace = caller[0]
    path = pluginSetting(name, namespace)
    folder = QFileDialog.getExistingDirectory(parent, msg, path, options)
    if folder:
        setPluginSetting(name, folder, namespace)
    return folder 
开发者ID:All4Gis,项目名称:QGISFMV,代码行数:13,代码来源:QgsFmvUtils.py

示例3: __import_data

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def __import_data(self):
        assert(self.project)
        dir_ = QFileDialog.getExistingDirectory(
            None,
            u"Data directory",
            QgsProject.instance().readEntry("albion", "last_dir", "")[0],
            QFileDialog.ShowDirsOnly | QFileDialog.DontUseNativeDialog
        )
        if not dir_:
            return
        QgsProject.instance().writeEntry("albion", "last_dir", dir_),

        progressMessageBar = self.__iface.messageBar().createMessage(
            "Loading {}...".format(dir_)
        )
        progress = QProgressBar()
        progress.setAlignment(Qt.AlignLeft | Qt.AlignVCenter)
        progressMessageBar.layout().addWidget(progress)
        self.__iface.messageBar().pushWidget(progressMessageBar)

        self.project.import_data(dir_, ProgressBar(progress))
        #self.project.triangulate()
        self.project.create_section_view_0_90(4)

        self.__iface.messageBar().clearWidgets()

        collar = QgsProject.instance().mapLayersByName("collar")
        if len(collar):
            collar[0].reload()
            collar[0].updateExtents()
            self.__iface.setActiveLayer(collar[0])
            QApplication.instance().processEvents()
            while self.__iface.mapCanvas().isDrawing():
                QApplication.instance().processEvents()
            self.__iface.zoomToActiveLayer()

        self.__iface.actionSaveProject().trigger()

        self.__viewer3d.widget().resetScene(self.project)
        self.__current_section.clear()
        self.__current_section.addItems(self.project.sections()) 
开发者ID:Oslandia,项目名称:albion,代码行数:43,代码来源:plugin.py

示例4: askForFolder

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def askForFolder(parent, name="HeatmapPath"):
    path = getSetting(LAST_PATH, name)
    folder =  QFileDialog.getExistingDirectory(parent, "Select folder to store chart", path)
    if folder:
        setSetting(LAST_PATH, name, folder)
    return folder 
开发者ID:NationalSecurityAgency,项目名称:qgis-d3datavis-plugin,代码行数:8,代码来源:heatmapDialog.py

示例5: on_parentFolderButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def on_parentFolderButton_clicked(self):
        '''
        Opens the dialog to select the folder
        '''
        folder = QFileDialog.getExistingDirectory(self, self.tr('Select Directory'))
        self.parentFolderEdit.setText(folder) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:8,代码来源:inventoryTools.py

示例6: on_copyFilesButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def on_copyFilesButton_clicked(self):
        '''
        Opens the dialog to define the copy destination folder
        '''
        folder = QFileDialog.getExistingDirectory(self, self.tr('Select Directory'))
        self.destinationFolderEdit.setText(folder) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:8,代码来源:inventoryTools.py

示例7: on_addFolderButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def on_addFolderButton_clicked(self):
        '''
        Adds a folder to be processed
        '''
        folder = QFileDialog.getExistingDirectory(self, self.tr("Select Directory"))
        for dirName, subdirList, fileList in os.walk(folder):
            for fileName in fileList:
                if fileName.split(".")[-1] == 'tif':
                    self.fileListWidget.addItem(os.path.join(dirName,fileName)) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:11,代码来源:processingTools.py

示例8: on_outputFolderButton_clicked

# 需要导入模块: from qgis.PyQt.QtWidgets import QFileDialog [as 别名]
# 或者: from qgis.PyQt.QtWidgets.QFileDialog import getExistingDirectory [as 别名]
def on_outputFolderButton_clicked(self):
        '''
        Defines the output folder
        '''
        folder = QFileDialog.getExistingDirectory(self, self.tr("Select Directory"))
        self.outputFolderEdit.setText(folder) 
开发者ID:dsgoficial,项目名称:DsgTools,代码行数:8,代码来源:processingTools.py


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