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


Python QFileDialog.getOpenFileNames方法代码示例

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


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

示例1: _handle_multiple_files

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getOpenFileNames [as 别名]
def _handle_multiple_files(self, info, files):
        """Handle uploading of multiple files.

        Loosely based on Helpviewer/HelpBrowserWV.py from eric5.

        Args:
            info: The ChooseMultipleFilesExtensionOption instance.
            files: The ChooseMultipleFilesExtensionReturn instance to write
                   return values to.

        Return:
            True on success, the superclass return value on failure.
        """
        suggested_file = ""
        if info.suggestedFileNames:
            suggested_file = info.suggestedFileNames[0]

        files.fileNames, _ = QFileDialog.getOpenFileNames(
            None, None, suggested_file)  # type: ignore[arg-type]

        return True 
开发者ID:qutebrowser,项目名称:qutebrowser,代码行数:23,代码来源:webpage.py

示例2: prompt_extractor

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getOpenFileNames [as 别名]
def prompt_extractor(self, item):
        extractor = extractors[item.data(Qt.UserRole)]
        inputs = []
        if not assert_installed(self.view, **extractor.get('depends', {})):
            return
        
        if not extractor.get('pick_url', False):
            files, mime = QFileDialog.getOpenFileNames()
            for path in files:
                inputs.append((path, Path(path).stem))
        else:
            text, good = QInputDialog.getText(self.view, ' ', 'Input an URL:')
            if text:
                url = urlparse(text)
                inputs.append((url.geturl(), url.netloc))
        
        if inputs:
            wait = QProgressDialog('Extracting .proto structures...', None, 0, 0)
            wait.setWindowTitle(' ')
            self.set_view(wait)
            
            self.worker = Worker(inputs, extractor)
            self.worker.progress.connect(self.extraction_progress)
            self.worker.finished.connect(self.extraction_done)
            self.worker.start() 
开发者ID:marin-m,项目名称:pbtk,代码行数:27,代码来源:gui.py

示例3: addSongFile

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getOpenFileNames [as 别名]
def addSongFile(self):
        urls, _ = QFileDialog.getOpenFileNames(
            caption="Select one or more files to open",
            directory="/home",
            filter="music(*mp2 *.mp3 *.mp4 *.m4a *wma *wav)")
        if urls:
            self.addSongFiles(urls) 
开发者ID:dragondjf,项目名称:QMusic,代码行数:9,代码来源:muscimanageworker.py

示例4: add_uri_audio_media_cue

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getOpenFileNames [as 别名]
def add_uri_audio_media_cue():
        """Add audio MediaCue(s) form user-selected files"""

        if get_backend() is None:
            QMessageBox.critical(MainWindow(), 'Error', 'Backend not loaded')
            return

        # Default path to system "music" folder
        path = QStandardPaths.writableLocation(QStandardPaths.MusicLocation)

        # Get the backend extensions and create a filter for the Qt file-dialog
        extensions = get_backend().supported_extensions()
        filters = qfile_filters(extensions, anyfile=False)
        # Display a file-dialog for the user to choose the media-files
        files, _ = QFileDialog.getOpenFileNames(MainWindow(),
                                                translate('MediaCueMenus',
                                                          'Select media files'),
                                                path, filters)

        QApplication.setOverrideCursor(QCursor(Qt.WaitCursor))

        # Create media cues, and add them to the Application cue_model
        for file in files:
            cue = CueFactory.create_cue('URIAudioCue', uri='file://' + file)
            # Use the filename without extension as cue name
            cue.name = os.path.splitext(os.path.basename(file))[0]
            Application().cue_model.add(cue)

        QApplication.restoreOverrideCursor() 
开发者ID:FrancescoCeruti,项目名称:linux-show-player,代码行数:31,代码来源:media_cue_menus.py

示例5: import_files_clicked

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getOpenFileNames [as 别名]
def import_files_clicked(self):
        paths, x = QFileDialog.getOpenFileNames(
            self, _("TEXT_FILE_IMPORT_FILES"), self.default_import_path
        )
        if not paths:
            return
        files, total_size = self.get_files(paths)
        f = files[0][0]
        self.default_import_path = str(f.parent)
        self.import_all(files, total_size) 
开发者ID:Scille,项目名称:parsec-cloud,代码行数:12,代码来源:files_widget.py

示例6: onAddSongs

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getOpenFileNames [as 别名]
def onAddSongs(self):
        file_names, a = self.gui.getOpenFileName('Add Songs',
                                                 'Super Boucle Song (*.sbs)',
                                                 self,
                                                 QFileDialog.getOpenFileNames)
        self.gui.playlist += file_names  # getSongs(file_names)
        self.updateList() 
开发者ID:Vampouille,项目名称:superboucle,代码行数:9,代码来源:playlist.py

示例7: select_files

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getOpenFileNames [as 别名]
def select_files(directory_location=None):
	qtapp = QApplication([directory_location])
	qtwgt = QtWidgets.QWidget()
	filenames, _ = QFileDialog.getOpenFileNames(qtwgt)
	return filenames 
开发者ID:hastagAB,项目名称:Awesome-Python-Scripts,代码行数:7,代码来源:select_file_pyqt.py

示例8: on_file_dialog

# 需要导入模块: from PyQt5.QtWidgets import QFileDialog [as 别名]
# 或者: from PyQt5.QtWidgets.QFileDialog import getOpenFileNames [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.getOpenFileNames方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。