Compare commits

...

9 Commits

Author SHA1 Message Date
bba05cce16 chore(version): update version 2022-10-24 09:27:14 +02:00
ad02c8296b feat(cli): add resize mode option (#59)
This adds a new option that allows to control how the video is going to be scaled. By default, we now use a smooth rescaling, but fast mode with no interpolation can be used (previously default).
2022-10-24 09:26:48 +02:00
0778cebef7 chore(README): update key bindings documentation 2022-10-24 09:20:14 +02:00
163260415b Mouse Show/Hide feature (#56)
* Mouse Show/Hide feature

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Mouse Hide/Show Fix

Applied requested changes for PR

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
2022-10-21 12:57:53 +02:00
241419a781 Support template (#57)
* PATCH: Docs template enhacement

* FEAT: Template drafted for Support

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* Update .github/ISSUE_TEMPLATE/documentation.yml

Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>

* Update .github/ISSUE_TEMPLATE/support.yml

Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>

Co-authored-by: Harisai <Harisaipravin_SV@intuit.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Jérome Eertmans <jeertmans@icloud.com>
2022-10-21 10:55:39 +02:00
bac21815b2 chore(README): add note for M1 chips and doc. feat 2022-10-20 08:55:00 +02:00
2f8f7561a6 Issue more templates (#54)
* FEAT: Git template for documentation

* PATCH: Space keys updated

* PATCH: Spaccing update

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

* UPDATE: Code of conduct removed

* PATCH: Retry CI

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

Co-authored-by: Harisai <Harisaipravin_SV@intuit.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-10-19 18:27:41 +02:00
a489dfd0e8 feat: set application name 2022-10-19 14:32:16 +02:00
76ef16d98b fix(docs): typo 2022-10-19 11:51:43 +02:00
8 changed files with 122 additions and 19 deletions

View 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
View 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

View File

@ -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 |
![manim-wizard](https://user-images.githubusercontent.com/27275099/197468787-19c83a81-d757-47b9-8f68-218427d30298.png)
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

View File

@ -1 +1 @@
__version__ = "4.2.0"
__version__ = "4.3.0"

View File

@ -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()

View File

@ -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

View File

@ -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_())

View File

@ -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()