mirror of
https://github.com/jeertmans/manim-slides.git
synced 2025-05-18 11:05:54 +08:00
Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
bba05cce16 | |||
ad02c8296b | |||
0778cebef7 | |||
163260415b | |||
241419a781 | |||
bac21815b2 | |||
2f8f7561a6 | |||
a489dfd0e8 | |||
76ef16d98b |
59
.github/ISSUE_TEMPLATE/documentation.yml
vendored
Normal file
59
.github/ISSUE_TEMPLATE/documentation.yml
vendored
Normal file
@ -0,0 +1,59 @@
|
||||
name: Documentation
|
||||
description: Ask / Report an issue related to the documentation.
|
||||
title: "DOC: <description>"
|
||||
labels: ['bug', 'docs']
|
||||
|
||||
body:
|
||||
- type: markdown
|
||||
attributes:
|
||||
value: >
|
||||
**Thank you for wanting to report a problem with manim-slides docs!**
|
||||
|
||||
|
||||
If the problem seems straightforward, feel free to submit a PR instead!
|
||||
|
||||
|
||||
⚠
|
||||
Verify first that your issue is not already reported on GitHub [Issues].
|
||||
|
||||
|
||||
[Issues]:
|
||||
https://github.com/jeertmans/manim-slides/issues
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Describe the Issue
|
||||
description: A clear and concise description of the issue you encountered.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: input
|
||||
attributes:
|
||||
label: Affected Page
|
||||
description: Add a link to page with the problem.
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
attributes:
|
||||
label: Issue Type
|
||||
description: >
|
||||
Please select the option in the drop-down.
|
||||
|
||||
<details>
|
||||
<summary>
|
||||
<em>Issue?</em>
|
||||
</summary>
|
||||
</details>
|
||||
options:
|
||||
- Documentation Enhancement
|
||||
- Documentation Report
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: Recommended fix or suggestions
|
||||
description: A clear and concise description of how you want to update it.
|
||||
validations:
|
||||
required: false
|
14
.github/ISSUE_TEMPLATE/support.yml
vendored
Normal file
14
.github/ISSUE_TEMPLATE/support.yml
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
name: Question/Help/Support
|
||||
description: Ask us about Manim Slides
|
||||
title: "Support: Ask us anything"
|
||||
labels: ['help', 'question']
|
||||
|
||||
body:
|
||||
- type: textarea
|
||||
attributes:
|
||||
label: "Please explain the issue you're experiencing (with as much detail as possible):"
|
||||
description: >
|
||||
Please make sure to leave a reference to the document/code you're
|
||||
referring to.
|
||||
validations:
|
||||
required: true
|
17
README.md
17
README.md
@ -26,6 +26,8 @@ Tool for live presentations using either [Manim (community edition)](https://www
|
||||
|
||||
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.
|
||||
|
||||
> **_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.
|
||||
|
||||
### Dependencies
|
||||
|
||||
Manim Slides requires either Manim or ManimGL to be installed. Having both packages installed is fine too.
|
||||
@ -117,14 +119,8 @@ manim-slides Example
|
||||
|
||||
The default key bindings to control the presentation are:
|
||||
|
||||
| Keybinding | Action |
|
||||
|:-----------:|:------------------------:|
|
||||
| Right Arrow | Continue/Next Slide |
|
||||
| Left Arrow | Previous Slide |
|
||||
| R | Replay Current Slide |
|
||||
| V | Reverse Current Slide |
|
||||
| Spacebar | Play/Pause |
|
||||
| Q | Quit |
|
||||

|
||||
|
||||
|
||||
You can run the **configuration wizard** to change those key bindings:
|
||||
|
||||
@ -132,15 +128,13 @@ You can run the **configuration wizard** to change those key bindings:
|
||||
manim-slides wizard
|
||||
```
|
||||
|
||||
Alternatively you can specify different key bindings creating a file named `.manim-slides.json` with the keys: `QUIT` `CONTINUE` `BACK` `REVERSE` `REWIND` and `PLAY_PAUSE`.
|
||||
|
||||
A default file can be created with:
|
||||
|
||||
```bash
|
||||
manim-slides init
|
||||
```
|
||||
|
||||
> **_NOTE:_** `manim-slides` uses `cv2.waitKeyEx()` to wait for keypresses, and directly registers the key code.
|
||||
> **_NOTE:_** `manim-slides` uses key codes, which are platform dependent. Using the configuration wizard is therefore highly recommended.
|
||||
|
||||
## Other Examples
|
||||
|
||||
@ -171,6 +165,7 @@ Below is a non-exhaustive list of features:
|
||||
| Support for 3D Scenes | :heavy_check_mark: | :heavy_multiplication_x: |
|
||||
| Documented code | :heavy_check_mark: | :heavy_multiplication_x: |
|
||||
| Tested on Unix, macOS, and Windows | :heavy_check_mark: | :heavy_multiplication_x: |
|
||||
| Hide mouse cursor | :heavy_check_mark: | :heavy_multiplication_x: |
|
||||
|
||||
## F.A.Q
|
||||
|
||||
|
@ -1 +1 @@
|
||||
__version__ = "4.2.0"
|
||||
__version__ = "4.3.0"
|
||||
|
@ -41,6 +41,7 @@ class Config(BaseModel):
|
||||
REVERSE: Key = Key(ids=[Qt.Key_V], name="REVERSE")
|
||||
REWIND: Key = Key(ids=[Qt.Key_R], name="REWIND")
|
||||
PLAY_PAUSE: Key = Key(ids=[Qt.Key_Space], name="PLAY / PAUSE")
|
||||
HIDE_MOUSE: Key = Key(ids=[Qt.Key_H], name="HIDE / SHOW MOUSE")
|
||||
|
||||
@root_validator
|
||||
def ids_are_unique_across_keys(cls, values):
|
||||
@ -147,3 +148,6 @@ class PresentationConfig(BaseModel):
|
||||
)
|
||||
|
||||
return values
|
||||
|
||||
|
||||
DEFAULT_CONFIG = Config()
|
||||
|
@ -13,7 +13,7 @@ def cli() -> None:
|
||||
"""
|
||||
Manim Slides command-line utilities.
|
||||
|
||||
If not command is specified, defaults to `present`.
|
||||
If no command is specified, defaults to `present`.
|
||||
"""
|
||||
pass
|
||||
|
||||
|
@ -16,7 +16,7 @@ from PyQt5.QtWidgets import QApplication, QGridLayout, QLabel, QWidget
|
||||
from tqdm import tqdm
|
||||
|
||||
from .commons import config_path_option, verbosity_option
|
||||
from .config import Config, PresentationConfig, SlideConfig, SlideType
|
||||
from .config import DEFAULT_CONFIG, Config, PresentationConfig, SlideConfig, SlideType
|
||||
from .defaults import FOLDER_PATH
|
||||
from .manim import logger
|
||||
|
||||
@ -33,6 +33,11 @@ ASPECT_RATIO_MODES = {
|
||||
"keep": Qt.KeepAspectRatio,
|
||||
}
|
||||
|
||||
RESIZE_MODES = {
|
||||
"fast": Qt.FastTransformation,
|
||||
"smooth": Qt.SmoothTransformation,
|
||||
}
|
||||
|
||||
|
||||
@unique
|
||||
class State(IntEnum):
|
||||
@ -284,7 +289,7 @@ class Display(QThread):
|
||||
def __init__(
|
||||
self,
|
||||
presentations,
|
||||
config,
|
||||
config: Config = DEFAULT_CONFIG,
|
||||
start_paused=False,
|
||||
skip_all=False,
|
||||
record_to=None,
|
||||
@ -517,10 +522,12 @@ class App(QWidget):
|
||||
def __init__(
|
||||
self,
|
||||
*args,
|
||||
config: Config = DEFAULT_CONFIG,
|
||||
fullscreen: bool = False,
|
||||
resolution: Tuple[int, int] = (1980, 1080),
|
||||
hide_mouse: bool = False,
|
||||
aspect_ratio: Qt.AspectRatioMode = Qt.IgnoreAspectRatio,
|
||||
resize_mode: Qt.TransformationMode = Qt.SmoothTransformation,
|
||||
**kwargs,
|
||||
):
|
||||
super().__init__()
|
||||
@ -528,8 +535,10 @@ class App(QWidget):
|
||||
self.setWindowTitle(WINDOW_NAME)
|
||||
self.display_width, self.display_height = resolution
|
||||
self.aspect_ratio = aspect_ratio
|
||||
|
||||
if hide_mouse:
|
||||
self.resize_mode = resize_mode
|
||||
self.hide_mouse = hide_mouse
|
||||
self.config = config
|
||||
if self.hide_mouse:
|
||||
self.setCursor(Qt.BlankCursor)
|
||||
|
||||
self.label = QLabel(self)
|
||||
@ -541,7 +550,7 @@ class App(QWidget):
|
||||
self.label.setMinimumSize(1, 1)
|
||||
|
||||
# create the video capture thread
|
||||
self.thread = Display(*args, **kwargs)
|
||||
self.thread = Display(*args, config=config, **kwargs)
|
||||
# create the info dialog
|
||||
self.info = Info()
|
||||
self.info.show()
|
||||
@ -562,7 +571,15 @@ class App(QWidget):
|
||||
self.thread.start()
|
||||
|
||||
def keyPressEvent(self, event):
|
||||
|
||||
key = event.key()
|
||||
if self.config.HIDE_MOUSE.match(key):
|
||||
if self.hide_mouse:
|
||||
self.setCursor(Qt.ArrowCursor)
|
||||
self.hide_mouse = False
|
||||
else:
|
||||
self.setCursor(Qt.BlankCursor)
|
||||
self.hide_mouse = True
|
||||
# We send key to be handled by video display
|
||||
self.send_key_signal.emit(key)
|
||||
event.accept()
|
||||
@ -574,7 +591,9 @@ class App(QWidget):
|
||||
self.deleteLater()
|
||||
|
||||
def resizeEvent(self, event):
|
||||
self.pixmap = self.pixmap.scaled(self.width(), self.height(), self.aspect_ratio)
|
||||
self.pixmap = self.pixmap.scaled(
|
||||
self.width(), self.height(), self.aspect_ratio, self.resize_mode
|
||||
)
|
||||
self.label.setPixmap(self.pixmap)
|
||||
self.label.resize(self.width(), self.height())
|
||||
|
||||
@ -605,6 +624,7 @@ class App(QWidget):
|
||||
self.width(),
|
||||
self.height(),
|
||||
self.aspect_ratio,
|
||||
self.resize_mode,
|
||||
)
|
||||
return QPixmap.fromImage(p)
|
||||
|
||||
@ -698,6 +718,13 @@ def _list_scenes(folder) -> List[str]:
|
||||
help="Set the aspect ratio mode to be used when rescaling video.",
|
||||
show_default=True,
|
||||
)
|
||||
@click.option(
|
||||
"--resize-mode",
|
||||
type=click.Choice(RESIZE_MODES.keys(), case_sensitive=False),
|
||||
default="smooth",
|
||||
help="Set the resize (i.e., transformation) mode to be used when rescaling video.",
|
||||
show_default=True,
|
||||
)
|
||||
@click.help_option("-h", "--help")
|
||||
@verbosity_option
|
||||
def present(
|
||||
@ -712,6 +739,7 @@ def present(
|
||||
exit_after_last_slide,
|
||||
hide_mouse,
|
||||
aspect_ratio,
|
||||
resize_mode,
|
||||
) -> None:
|
||||
"""
|
||||
Present SCENE(s), one at a time, in order.
|
||||
@ -791,6 +819,7 @@ def present(
|
||||
)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setApplicationName("Manim Slides")
|
||||
a = App(
|
||||
presentations,
|
||||
config=config,
|
||||
@ -802,6 +831,7 @@ def present(
|
||||
exit_after_last_slide=exit_after_last_slide,
|
||||
hide_mouse=hide_mouse,
|
||||
aspect_ratio=ASPECT_RATIO_MODES[aspect_ratio],
|
||||
resize_mode=RESIZE_MODES[resize_mode],
|
||||
)
|
||||
a.show()
|
||||
sys.exit(app.exec_())
|
||||
|
@ -173,6 +173,7 @@ def _init(config_path, force, merge, skip_interactive=False):
|
||||
config = Config.parse_file(config_path)
|
||||
|
||||
app = QApplication(sys.argv)
|
||||
app.setApplicationName("Manim Slides Wizard")
|
||||
window = Wizard(config)
|
||||
window.show()
|
||||
app.exec()
|
||||
|
Reference in New Issue
Block a user