當前位置: 首頁>>代碼示例>>Python>>正文


Python QFileDialog.getExistingDirectory方法代碼示例

本文整理匯總了Python中AnyQt.QtWidgets.QFileDialog.getExistingDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Python QFileDialog.getExistingDirectory方法的具體用法?Python QFileDialog.getExistingDirectory怎麽用?Python QFileDialog.getExistingDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在AnyQt.QtWidgets.QFileDialog的用法示例。


在下文中一共展示了QFileDialog.getExistingDirectory方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __runOpenDialog

# 需要導入模塊: from AnyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from AnyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
    def __runOpenDialog(self):
        startdir = os.path.expanduser("~/")
        if self.recent_paths:
            startdir = os.path.dirname(self.recent_paths[0].abspath)

        if OWImportImages.Modality == Qt.WindowModal:
            dlg = QFileDialog(
                self, "Select Top Level Directory", startdir,
                acceptMode=QFileDialog.AcceptOpen,
                modal=True,
            )
            dlg.setFileMode(QFileDialog.Directory)
            dlg.setOption(QFileDialog.ShowDirsOnly)
            dlg.setDirectory(startdir)
            dlg.setAttribute(Qt.WA_DeleteOnClose)

            @dlg.accepted.connect
            def on_accepted():
                dirpath = dlg.selectedFiles()
                if dirpath:
                    self.setCurrentPath(dirpath[0])
                    self.start()
            dlg.open()
        else:
            dirpath = QFileDialog.getExistingDirectory(
                self, "Select Top Level Directory", startdir
            )
            if dirpath:
                self.setCurrentPath(dirpath)
                self.start()
開發者ID:biolab,項目名稱:orange3-imageanalytics,代碼行數:32,代碼來源:owimageimport.py

示例2: save_project

# 需要導入模塊: from AnyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from AnyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
    def save_project(self, project_path=None):
        try:
            if project_path is None:
                project_path = QFileDialog.getExistingDirectory(self, "Select the project directory")

            if project_path is not None and str(project_path)!='':
                project_path = str(project_path)
                self.save({}, project_path)
        except Exception as e:
            QMessageBox.critical(self, "Error", str(e))
開發者ID:UmSenhorQualquer,項目名稱:pythonVideoAnnotator,代碼行數:12,代碼來源:base_module.py

示例3: load_project

# 需要導入模塊: from AnyQt.QtWidgets import QFileDialog [as 別名]
# 或者: from AnyQt.QtWidgets.QFileDialog import getExistingDirectory [as 別名]
 def load_project(self, project_path=None):
     if project_path is None:
         project_path = QFileDialog.getExistingDirectory(self, "Select the project directory")
     if project_path is not None and str(project_path)!='':
         self.load({}, str(project_path) )
開發者ID:UmSenhorQualquer,項目名稱:pythonVideoAnnotator,代碼行數:7,代碼來源:base_module.py


注:本文中的AnyQt.QtWidgets.QFileDialog.getExistingDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。