Skip to content

Commit

Permalink
chore(deps): support PyQt6
Browse files Browse the repository at this point in the history
  • Loading branch information
jeertmans committed Jan 19, 2024
1 parent 08b4839 commit 3182487
Show file tree
Hide file tree
Showing 3 changed files with 104 additions and 38 deletions.
16 changes: 7 additions & 9 deletions manim_slides/present/player.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ def __init__(

def media_status_changed(status: QMediaPlayer.MediaStatus) -> None:
self.media_player.setLoops(1) # Otherwise looping slides never end
if status == QMediaPlayer.EndOfMedia:
if status == QMediaPlayer.MediaStatus.EndOfMedia:
self.load_next_slide()

self.media_player.mediaStatusChanged.connect(media_status_changed)
Expand All @@ -280,7 +280,7 @@ def media_status_changed(status: QMediaPlayer.MediaStatus) -> None:

def media_status_changed(status: QMediaPlayer.MediaStatus) -> None:
if (
status == QMediaPlayer.EndOfMedia
status == QMediaPlayer.MediaStatus.EndOfMedia
and self.current_slide_config.auto_next
):
self.load_next_slide()
Expand Down Expand Up @@ -390,7 +390,7 @@ def playing_reversed_slide(self, playing_reversed_slide: bool) -> None:
"""

def load_current_media(self, start_paused: bool = False) -> None:
url = QUrl.fromLocalFile(self.current_file)
url = QUrl.fromLocalFile(str(self.current_file))
self.media_player.setSource(url)

if self.playing_reversed_slide:
Expand Down Expand Up @@ -475,7 +475,7 @@ def slide_changed_callback(self) -> None:

def preview_next_slide(self) -> None:
if slide_config := self.next_slide_config:
url = QUrl.fromLocalFile(slide_config.file)
url = QUrl.fromLocalFile(str(slide_config.file))
self.info.next_media_player.setSource(url)
self.info.next_media_player.play()

Expand All @@ -493,7 +493,7 @@ def close(self) -> None:

@Slot()
def next(self) -> None:
if self.media_player.playbackState() == QMediaPlayer.PausedState:
if self.media_player.playbackState() == QMediaPlayer.PlaybackState.PausedState:
self.media_player.play()
elif self.next_terminates_loop and self.media_player.loops() != 1:
position = self.media_player.position()
Expand Down Expand Up @@ -521,9 +521,9 @@ def replay(self) -> None:
@Slot()
def play_pause(self) -> None:
state = self.media_player.playbackState()
if state == QMediaPlayer.PausedState:
if state == QMediaPlayer.PlaybackState.PausedState:
self.media_player.play()
elif state == QMediaPlayer.PlayingState:
elif state == QMediaPlayer.PlaybackState.PlayingState:
self.media_player.pause()

@Slot()
Expand All @@ -540,11 +540,9 @@ def hide_mouse(self) -> None:
else:
self.setCursor(Qt.BlankCursor)

@Slot()
def closeEvent(self, event: QCloseEvent) -> None: # noqa: N802
self.close()

@Slot()
def keyPressEvent(self, event: QKeyEvent) -> None: # noqa: N802
key = event.key()
self.dispatch(key)
Expand Down
123 changes: 95 additions & 28 deletions pdm.lock

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

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ all = [
magic = ["manim-slides[manim]", "ipython>=8.12.2"]
manim = ["manim>=0.17.3"]
manimgl = ["manimgl>=1.6.1"]
pyside6 = ["pyside6>=6.5.1,<6.6.0;python_version<'3.12'"]
pyqt6 = ["pyqt6>=6.6.1"]
pyside6 = ["pyside6>=6.5.1,<6.5.3;python_version<'3.12'"]
sphinx-directive = ["docutils>=0.20.1", "manim-slides[manim]"]

[project.scripts]
Expand Down

0 comments on commit 3182487

Please sign in to comment.