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