Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,22 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v5
- name: Install Qt 6.10.*
uses: jurplel/install-qt-action@v4
- name: Install Python 3.13
uses: actions/setup-python@v6
with:
arch: linux_gcc_64
version: 6.10.*
- name: Update Packages
run: sudo apt update -y && sudo apt upgrade -y
- name: Install Dependencies
run: sudo apt install -y qt6-base-dev
python-version: "3.13"
- name: Install just
uses: taiki-e/install-action@just
- name: Install uv
uses: astral-sh/setup-uv@v7
with:
enable-cache: false
- name: Update Packages
run: sudo apt update -y
- name: Install Dependencies
run: sudo apt install -y libegl1
- name: Initialize Project
run: just init
- name: Execute Qml Tests
run: just test-qml

Expand Down
29 changes: 23 additions & 6 deletions Justfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ export QT_QUICK_CONTROLS_STYLE := 'Material'

# Remove ALL generated files
[group('build')]
@clean: _update_pyproject_file
uv run pyside6-project clean
rm -rf build test/rc_project.py project.json project.qrc
@clean:
find i18n -name "*.qm" -type f -delete
rm -rf build pyobjects test/rc_project.py rc_project.py project.json project.qrc

# Add language; pattern: language-region ISO 639-1, ISO 3166-1; example: fr-FR
[group('i18n')]
Expand All @@ -51,15 +51,32 @@ export QT_QUICK_CONTROLS_STYLE := 'Material'

# Run Python tests
[group('test')]
@test-python: build-develop
@test-python: _prepare-tests
rm -f test/rc_project.py
cp rc_project.py test/rc_project.py
uv run pytest build-aux test

# Run QML tests
[group('test')]
@test-qml:
qmltestrunner -silent -input qt/qml
test-qml: _prepare-tests
#!/usr/bin/env bash
uv run python -c '
import sys
from PySide6.QtQuickTest import QUICK_TEST_MAIN_WITH_SETUP
from test.prepare_qml import MyTestSetup

# Pass additional arguments to qmltestrunner:
sys.argv += ["-silent"]
sys.argv += ["-input", "qt/qml"]
# sys.argv += ["-eventdelay", "50"] # Simulate slower systems

ex = QUICK_TEST_MAIN_WITH_SETUP("qmltestrunner", MyTestSetup, argv=sys.argv)
sys.exit(ex)
'

@_prepare-tests: build-develop
rm -f test/rc_project.py
cp rc_project.py test/rc_project.py

@_update_pyproject_file: _generate-qrc-file
uv run python build-aux/update_pyproject_file.py \
Expand Down
5 changes: 3 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ classifiers = [
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Private :: Do Not Upload",
]
dependencies = [
"pyside6-essentials==6.10.0",
"pyside6-essentials==6.10.1",
"pywin32>=311; sys_platform == 'win32'",
]

[dependency-groups]
dev = [
"pytest>=8.4.2",
"pytest>=9.0.1",
]

[project.urls]
Expand Down
58 changes: 26 additions & 32 deletions src/startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,39 @@
import sys


class StartUp:
def perform_startup():
configure_qt_application_data()
configure_environment_variables()
import_bindings()
start_application()

@staticmethod
def configure_qt_application_data():
from PySide6.QtCore import QCoreApplication
QCoreApplication.setApplicationName("my app name")
QCoreApplication.setOrganizationName("my org name")
QCoreApplication.setApplicationVersion("my app version")

@staticmethod
def configure_environment_variables():
# Qt expects "qtquickcontrols2.conf" at root level, but the way we handle resources does not allow that.
# So we need to override the path here
os.environ["QT_QUICK_CONTROLS_CONF"] = ":/data/qtquickcontrols2.conf"
def configure_qt_application_data():
from PySide6.QtCore import QCoreApplication
QCoreApplication.setApplicationName("my app name")
QCoreApplication.setOrganizationName("my org name")
QCoreApplication.setApplicationVersion("my app version")

@staticmethod
def import_bindings():
import src.viewmodels # noqa: F401

@staticmethod
def start_application():
from src.application import MyApplication
app = MyApplication(sys.argv)
def configure_environment_variables():
# Qt expects "qtquickcontrols2.conf" at root level, but the way we handle resources does not allow that.
# So we need to override the path here
os.environ["QT_QUICK_CONTROLS_CONF"] = ":/data/qtquickcontrols2.conf"

app.set_window_icon()
app.set_up_signals()
app.set_up_window_event_filter()
app.start_engine()
app.set_up_window_effects()
app.verify()

sys.exit(app.exec())
def import_bindings():
import src.viewmodels # noqa: F401


def perform_startup():
we = StartUp()
def start_application():
from src.application import MyApplication
app = MyApplication(sys.argv)

we.configure_qt_application_data()
we.configure_environment_variables()
we.import_bindings()
app.set_window_icon()
app.set_up_signals()
app.set_up_window_event_filter()
app.start_engine()
app.set_up_window_effects()
app.verify()

we.start_application()
sys.exit(app.exec())
19 changes: 19 additions & 0 deletions test/prepare_qml.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# SPDX-FileCopyrightText: mpvQC developers
#
# SPDX-License-Identifier: GPL-3.0-or-later

from PySide6.QtCore import QObject, Slot
from PySide6.QtQml import QQmlEngine

from src import startup


# noinspection PyPep8Naming
class MyTestSetup(QObject):
@Slot(QQmlEngine)
def qmlEngineAvailable(self, _: QQmlEngine):
import rc_project # noqa: F401

startup.configure_qt_application_data()
startup.configure_environment_variables()
startup.import_bindings()
46 changes: 23 additions & 23 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.