Skip to content

Commit 3eb9fa0

Browse files
authored
refactor(lib): change PyQT5 to PySide6 (#62)
* refactor(lib): change PyQT5 to PySide6 This, hopefully, should now add support for M1 chips * chore: update README and change imports
1 parent 8f519ed commit 3eb9fa0

File tree

5 files changed

+19
-22
lines changed

5 files changed

+19
-22
lines changed

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ Tool for live presentations using either [Manim (community edition)](https://www
2626

2727
While installing Manim Slides and its dependencies on your global Python is fine, I recommend using a [virtualenv](https://docs.python.org/3/tutorial/venv.html) for a local installation.
2828

29-
> **_NOTE:_** Startin with version 4.2, Manim Slides seems to have **troubles installing on mac M1 chips**. An issue has been created [#53](https://github.com/jeertmans/manim-slides/issues/53), and we recommend following its evolution for any update.
30-
3129
### Dependencies
3230

3331
Manim Slides requires either Manim or ManimGL to be installed. Having both packages installed is fine too.
@@ -90,7 +88,7 @@ class Example(Slide):
9088
self.play(dot.animate.move_to(ORIGIN))
9189
self.pause() # Waits user to press continue to go to the next slide
9290

93-
self.wait() # The presentation directly exits after last animation
91+
self.wait()
9492
```
9593

9694
You **must** end your `Slide` with a `self.play(...)` or a `self.wait(...)`.

manim_slides/config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from typing import List, Optional, Set
44

55
from pydantic import BaseModel, root_validator, validator
6-
from PyQt5.QtCore import Qt
6+
from PySide6.QtCore import Qt
77

88
from .manim import logger
99

manim_slides/present.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@
99
import cv2
1010
import numpy as np
1111
from pydantic import ValidationError
12-
from PyQt5 import QtGui
13-
from PyQt5.QtCore import Qt, QThread, pyqtSignal, pyqtSlot
14-
from PyQt5.QtGui import QPixmap
15-
from PyQt5.QtWidgets import QApplication, QGridLayout, QLabel, QWidget
12+
from PySide6 import QtGui
13+
from PySide6.QtCore import Qt, QThread, Signal, Slot
14+
from PySide6.QtGui import QPixmap
15+
from PySide6.QtWidgets import QApplication, QGridLayout, QLabel, QWidget
1616
from tqdm import tqdm
1717

1818
from .commons import config_path_option, verbosity_option
@@ -282,9 +282,9 @@ def update_state(self, state) -> Tuple[np.ndarray, State]:
282282
class Display(QThread):
283283
"""Displays one or more presentations one after each other."""
284284

285-
change_video_signal = pyqtSignal(np.ndarray)
286-
change_info_signal = pyqtSignal(dict)
287-
finished = pyqtSignal()
285+
change_video_signal = Signal(np.ndarray)
286+
change_info_signal = Signal(dict)
287+
finished = Signal()
288288

289289
def __init__(
290290
self,
@@ -409,7 +409,7 @@ def show_info(self) -> None:
409409
}
410410
)
411411

412-
@pyqtSlot(int)
412+
@Slot(int)
413413
def set_key(self, key: int) -> None:
414414
"""Sets the next key to be handled."""
415415
self.key = key
@@ -484,7 +484,7 @@ def __init__(self):
484484

485485
self.update_info({})
486486

487-
@pyqtSlot(dict)
487+
@Slot(dict)
488488
def update_info(self, info: dict):
489489
self.animationLabel.setText("Animation: {}".format(info.get("animation", "na")))
490490
self.stateLabel.setText("State: {}".format(info.get("state", "unknown")))
@@ -517,7 +517,7 @@ def stop(self):
517517

518518

519519
class App(QWidget):
520-
send_key_signal = pyqtSignal(int)
520+
send_key_signal = Signal(int)
521521

522522
def __init__(
523523
self,
@@ -603,13 +603,13 @@ def closeEvent(self, event):
603603
self.closeAll()
604604
event.accept()
605605

606-
@pyqtSlot(np.ndarray)
606+
@Slot(np.ndarray)
607607
def update_image(self, cv_img: dict):
608608
"""Updates the image_label with a new opencv image"""
609609
self.pixmap = self.convert_cv_qt(cv_img)
610610
self.label.setPixmap(self.pixmap)
611611

612-
@pyqtSlot(dict)
612+
@Slot(dict)
613613
def update_info(self, info: dict):
614614
"""Updates the image_label with a new opencv image"""
615615
pass

manim_slides/wizard.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
from typing import Any
55

66
import click
7-
from PyQt5.QtCore import Qt
8-
from PyQt5.QtWidgets import (
7+
from PySide6.QtCore import Qt
8+
from PySide6.QtWidgets import (
99
QApplication,
1010
QDialog,
1111
QDialogButtonBox,
@@ -25,9 +25,8 @@
2525
WINDOW_NAME: str = "Configuration Wizard"
2626

2727
keymap = {}
28-
for key, value in vars(Qt).items():
29-
if isinstance(value, Qt.Key):
30-
keymap[value] = key.partition("_")[2]
28+
for key in Qt.Key:
29+
keymap[key.value] = key.name.partition("_")[2]
3130

3231

3332
class KeyInput(QDialog):

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"click-default-group>=1.2",
4040
"numpy>=1.19.3",
4141
"pydantic>=1.9.1",
42-
"pyqt5>=5.15",
42+
"pyside6>=6.4",
4343
"opencv-python>=4.6",
4444
"tqdm>=4.62.3",
4545
],

0 commit comments

Comments
 (0)