当前位置: 首页>>代码示例>>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;未经允许,请勿转载。