コード例 #1
0
def choose_images(window, name, title, select_only_single_file=True, formats=None):
    mode = QFileDialog.ExistingFile if select_only_single_file else QFileDialog.ExistingFiles
    if formats is None:
        formats = image_extensions()
    fd = FileDialog(title=title, name=name,
                    filters=[(_('Images'), list(formats))],
                    parent=window, add_all_files_filter=False, mode=mode,
                    )
    fd.setParent(None)
    if fd.accepted:
        return fd.get_files()
    return None
コード例 #2
0
ファイル: qt_file_dialogs.py プロジェクト: MarioJC/calibre
def choose_images(window, name, title, select_only_single_file=True, formats=None):
    mode = QFileDialog.ExistingFile if select_only_single_file else QFileDialog.ExistingFiles
    if formats is None:
        formats = image_extensions()
    fd = FileDialog(title=title, name=name,
                    filters=[(_('Images'), list(formats))],
                    parent=window, add_all_files_filter=False, mode=mode,
                    )
    fd.setParent(None)
    if fd.accepted:
        return fd.get_files()
    return None