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


Python QFileDialog.ShowDirsOnly方法代碼示例

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


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

示例1: test_Window_get_microbit_path

# 需要導入模塊: from PyQt5.QtWidgets import QFileDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QFileDialog import ShowDirsOnly [as 別名]
def test_Window_get_microbit_path(qtapp):
    """
    Ensures the QFileDialog is called with the expected arguments and the
    resulting path is returned.
    """
    mock_fd = mock.MagicMock()
    path = "/foo"
    ShowDirsOnly = QFileDialog.ShowDirsOnly
    mock_fd.getExistingDirectory = mock.MagicMock(return_value=path)
    mock_fd.ShowDirsOnly = ShowDirsOnly
    w = mu.interface.main.Window()
    w.widget = mock.MagicMock()
    with mock.patch("mu.interface.main.QFileDialog", mock_fd):
        assert w.get_microbit_path("micropython") == path
    title = "Locate BBC micro:bit"
    mock_fd.getExistingDirectory.assert_called_once_with(
        w.widget, title, "micropython", ShowDirsOnly
    ) 
開發者ID:mu-editor,項目名稱:mu,代碼行數:20,代碼來源:test_main.py

示例2: choose_folder_dialog

# 需要導入模塊: from PyQt5.QtWidgets import QFileDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QFileDialog import ShowDirsOnly [as 別名]
def choose_folder_dialog(parent, title):
    options = QFileDialog.Options()
    options |= QFileDialog.ShowDirsOnly
    dialog = QFileDialog(parent, title, os.path.expanduser("~"), options=options)
    dialog.setFileMode(QFileDialog.Directory)
    dialog.setParent(parent, QtCore.Qt.Sheet)
    return dialog 
開發者ID:Mebus,項目名稱:restatic,代碼行數:9,代碼來源:utils.py

示例3: browse_external_transfer_files

# 需要導入模塊: from PyQt5.QtWidgets import QFileDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QFileDialog import ShowDirsOnly [as 別名]
def browse_external_transfer_files(self):
        path = QFileDialog().getExistingDirectory(
            caption="Select transfer files folder",
            directory=QDir().homePath(),
            options=QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)

        if path:
            self.transferFilesPathLineEdit.setText(path) 
開發者ID:BetaRavener,項目名稱:uPyLoader,代碼行數:10,代碼來源:settings_dialog.py

示例4: choose_file_dialog

# 需要導入模塊: from PyQt5.QtWidgets import QFileDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QFileDialog import ShowDirsOnly [as 別名]
def choose_file_dialog(parent, title, want_folder=True):
    options = QFileDialog.Options()
    if want_folder:
        options |= QFileDialog.ShowDirsOnly
    dialog = QFileDialog(parent, title, os.path.expanduser('~'), options=options)
    dialog.setFileMode(QFileDialog.Directory if want_folder else QFileDialog.AnyFile)
    dialog.setParent(parent, QtCore.Qt.Sheet)
    return dialog 
開發者ID:borgbase,項目名稱:vorta,代碼行數:10,代碼來源:utils.py

示例5: _select_output_directory

# 需要導入模塊: from PyQt5.QtWidgets import QFileDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QFileDialog import ShowDirsOnly [as 別名]
def _select_output_directory(self):
        dir_name = QFileDialog.getExistingDirectory(directory=self.last_output_live_dir,
                                                    options=QFileDialog.ShowDirsOnly)
        self._set_output_directory(dir_name) 
開發者ID:andrewzwicky,項目名稱:PUBGIS,代碼行數:6,代碼來源:gui.py

示例6: on_dictDirButton_clicked

# 需要導入模塊: from PyQt5.QtWidgets import QFileDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QFileDialog import ShowDirsOnly [as 別名]
def on_dictDirButton_clicked(self):
        dictDir = QFileDialog.getExistingDirectory(self,
                  self.tr("Choose your dictionary directory..."),
                  self.ui.directoryLine.text(),
                  QFileDialog.DontResolveSymlinks | QFileDialog.ShowDirsOnly)

        if not dictDir.isEmpty():
            self.ui.directoryLine.setText(dictDir)
            self.langList(dictDir) 
開發者ID:zdenop,項目名稱:lector,代碼行數:11,代碼來源:settingsdialog.py

示例7: on_pbTessData_clicked

# 需要導入模塊: from PyQt5.QtWidgets import QFileDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QFileDialog import ShowDirsOnly [as 別名]
def on_pbTessData_clicked(self):
        dictDir = QFileDialog.getExistingDirectory(self,
                  self.tr("Select Path Prefix To tessdata Directory..."),
                  self.ui.lnTessData.text(),
                  QFileDialog.DontResolveSymlinks | QFileDialog.ShowDirsOnly)

        if not dictDir.isEmpty():
            self.ui.lnTessData.setText(dictDir) 
開發者ID:zdenop,項目名稱:lector,代碼行數:10,代碼來源:settingsdialog.py

示例8: get_directory

# 需要導入模塊: from PyQt5.QtWidgets import QFileDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QFileDialog import ShowDirsOnly [as 別名]
def get_directory():
    directory = QFileDialog.getExistingDirectory(None, "Choose Directory", QDir.homePath(),
                                                 QFileDialog.ShowDirsOnly | QFileDialog.DontResolveSymlinks)
    return directory 
開發者ID:jopohl,項目名稱:urh,代碼行數:6,代碼來源:FileOperator.py

示例9: on_file_dialog

# 需要導入模塊: from PyQt5.QtWidgets import QFileDialog [as 別名]
# 或者: from PyQt5.QtWidgets.QFileDialog import ShowDirsOnly [as 別名]
def on_file_dialog(self, dialog_type, directory, allow_multiple, save_filename, file_filter):
        if dialog_type == FOLDER_DIALOG:
            self._file_name = QFileDialog.getExistingDirectory(self, localization['linux.openFolder'], options=QFileDialog.ShowDirsOnly)
        elif dialog_type == OPEN_DIALOG:
            if allow_multiple:
                self._file_name = QFileDialog.getOpenFileNames(self, localization['linux.openFiles'], directory, file_filter)
            else:
                self._file_name = QFileDialog.getOpenFileName(self, localization['linux.openFile'], directory, file_filter)
        elif dialog_type == SAVE_DIALOG:
            if directory:
                save_filename = os.path.join(str(directory), str(save_filename))

            self._file_name = QFileDialog.getSaveFileName(self, localization['global.saveFile'], save_filename)

        self._file_name_semaphore.release() 
開發者ID:r0x0r,項目名稱:pywebview,代碼行數:17,代碼來源:qt.py


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