Skip to content

Commit

Permalink
chore(deps): make Qt backend optional
Browse files Browse the repository at this point in the history
TODO:
- [ ] Add relevant entry in CHANGELOG
- [ ] Update install documentation
- [ ] Make sure `manim-slides convert` can run without any Qt backend
- [ ] Make sure test suite works (partially) without any Qt backend
- [ ] Make sure we can import `manim_slides` without any Qt backend
  • Loading branch information
jeertmans committed Jan 12, 2024
1 parent de342b3 commit c9f8227
Show file tree
Hide file tree
Showing 11 changed files with 1,004 additions and 998 deletions.
2 changes: 1 addition & 1 deletion manim_slides/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
model_validator,
)
from pydantic_extra_types.color import Color
from PySide6.QtCore import Qt
from qtpy.QtCore import Qt

from .logger import logger

Expand Down
2 changes: 1 addition & 1 deletion manim_slides/present/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import click
from click import Context, Parameter
from pydantic import ValidationError
from PySide6.QtCore import Qt
from qtpy.QtCore import Qt

from ..commons import config_path_option, folder_path_option, verbosity_option
from ..config import Config, PresentationConfig
Expand Down
10 changes: 5 additions & 5 deletions manim_slides/present/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
from pathlib import Path
from typing import List, Optional

from PySide6.QtCore import Qt, QTimer, QUrl, Signal, Slot
from PySide6.QtGui import QCloseEvent, QIcon, QKeyEvent, QScreen
from PySide6.QtMultimedia import QMediaPlayer
from PySide6.QtMultimediaWidgets import QVideoWidget
from PySide6.QtWidgets import (
from qtpy.QtCore import Qt, QTimer, QUrl, Signal, Slot
from qtpy.QtGui import QCloseEvent, QIcon, QKeyEvent, QScreen
from qtpy.QtMultimedia import QMediaPlayer
from qtpy.QtMultimediaWidgets import QVideoWidget
from qtpy.QtWidgets import (
QHBoxLayout,
QLabel,
QMainWindow,
Expand Down
2 changes: 1 addition & 1 deletion manim_slides/qt_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Qt utils."""

from PySide6.QtWidgets import QApplication
from qtpy.QtWidgets import QApplication


def qapp() -> QApplication:
Expand Down
2 changes: 1 addition & 1 deletion manim_slides/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Created by: The Resource Compiler for Qt version 6.4.0
# WARNING! All changes made in this file will be lost!

from PySide6 import QtCore
from qtpy import QtCore

qt_resource_data = b"\
\x00\x00\x08\x1c\
Expand Down
6 changes: 3 additions & 3 deletions manim_slides/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
from typing import Any

import click
from PySide6.QtCore import Qt
from PySide6.QtGui import QIcon, QKeyEvent
from PySide6.QtWidgets import (
from qtpy.QtCore import Qt
from qtpy.QtGui import QIcon, QKeyEvent
from qtpy.QtWidgets import (
QDialog,
QDialogButtonBox,
QGridLayout,
Expand Down
1,966 changes: 985 additions & 981 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,10 @@ opencv-python = "^4.6.0.66"
pillow = "^9.5.0"
pydantic = "^2.0.1"
pydantic-extra-types = "^2.0.0"
pyside6 = "6.5.2"
pyside6 = {version = "6.5.2", optional = true}
python = ">=3.8.1,<3.12"
python-pptx = "^0.6.21"
qtpy = "^2.4.1"
requests = "^2.28.1"
rich = "^13.3.2"
rtoml = "^0.9.0"
Expand All @@ -68,6 +69,7 @@ tqdm = "^4.64.1"
magic = ["manim", "ipython"]
manim = ["manim"]
manimgl = ["manimgl"]
pyside6 = ["PySide6"]
sphinx-directive = ["docutils", "manim"]

[tool.poetry.group.dev]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_present.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import pytest
from click.testing import CliRunner
from PySide6.QtWidgets import QApplication
from qtpy.QtWidgets import QApplication

from manim_slides.present import present

Expand Down
2 changes: 1 addition & 1 deletion tests/test_qt_utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from PySide6.QtWidgets import QApplication
from qtpy.QtWidgets import QApplication

from manim_slides.qt_utils import qapp

Expand Down
4 changes: 2 additions & 2 deletions tests/test_wizard.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from pathlib import Path

from click.testing import CliRunner
from PySide6.QtCore import Qt
from PySide6.QtWidgets import (
from qtpy.QtCore import Qt
from qtpy.QtWidgets import (
QApplication,
QMessageBox,
)
Expand Down

0 comments on commit c9f8227

Please sign in to comment.