File: main.py

package info (click to toggle)
pyside6 6.10.2-2
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 48,184 kB
  • sloc: python: 205,032; cpp: 92,990; xml: 18,587; javascript: 1,182; sh: 163; makefile: 89
file content (31 lines) | stat: -rw-r--r-- 1,113 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# Copyright (C) 2025 The Qt Company Ltd.
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

"""PySide6 Multimedia player example"""

import sys
from argparse import ArgumentParser, RawTextHelpFormatter

from PySide6.QtWidgets import QApplication
from PySide6.QtCore import qVersion, QCoreApplication, QDir, QUrl

from player import Player


if __name__ == "__main__":
    app = QApplication(sys.argv)

    QCoreApplication.setApplicationName("Player Example")
    QCoreApplication.setOrganizationName("QtProject")
    QCoreApplication.setApplicationVersion(qVersion())
    argument_parser = ArgumentParser(description=QCoreApplication.applicationName(),
                                     formatter_class=RawTextHelpFormatter)
    argument_parser.add_argument("file", help="File", nargs='?', type=str)
    options = argument_parser.parse_args()

    player = Player()
    if options.file:
        player.openUrl(QUrl.fromUserInput(options.file, QDir.currentPath(),
                       QUrl.UserInputResolutionOption.AssumeLocalFile))
    player.show()
    sys.exit(QCoreApplication.exec())