-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Add dearpygui integration #1553
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
eulertour
merged 28 commits into
ManimCommunity:main
from
eulertour:dearpygui-integration
Jun 13, 2021
Merged
Changes from 16 commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
6d69cd3
Add dearpygui integration
eulertour 7004574
Merge remote-tracking branch 'origin/master' into dearpygui-integration
eulertour 937054c
Rename MobjectTest -> GuiTest
eulertour 94efb35
flake8
eulertour 0b9c8aa
Guard against dearpygui import
eulertour b0292f2
Add manim.gui
eulertour 47da92b
Guard against dearpygui import in gui.py
eulertour 07aa3d7
Add __init__.py
eulertour ecd1593
Add flag for GUI
eulertour 4edade5
Default to boolean
eulertour 4b003bf
Fix problem when scene isn't specified
eulertour 853c892
Add gui_location flag
eulertour cd5a529
poetry lock
eulertour a8bc4c6
Merge branch 'master' into dearpygui-integration
eulertour 8485ccd
Fix test
eulertour dc2a6bb
Merge branch 'dearpygui-integration' of github.com:eulertour/manim-1 …
eulertour 83429ed
Update manim/gui/gui.py
eulertour 42a12be
Update manim/_config/default.cfg
eulertour 6d958ff
Update manim/cli/render/global_options.py
eulertour 369e549
Merge branch 'master' into dearpygui-integration
eulertour 2dcd28f
Merge branch 'main' into dearpygui-integration
Darylgolden 3b989b3
Review comments
eulertour 978989c
Update pyproject.toml
eulertour 09a4b79
Add __all__ to shader.py
eulertour 34aa29e
Merge branch 'dearpygui-integration' of github.com:eulertour/manim-1 …
eulertour 9866318
Merge branch 'main' into dearpygui-integration
eulertour d7c4464
Add utils import to opengl/__init__.py
eulertour cfb8f71
Merge branch 'dearpygui-integration' of github.com:eulertour/manim-1 …
eulertour File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| from pathlib import Path | ||
|
|
||
| try: | ||
| import dearpygui.core | ||
| import dearpygui.demo | ||
| import dearpygui.simple | ||
|
|
||
| dearpygui_imported = True | ||
| except ImportError: | ||
| dearpygui_imported = False | ||
|
|
||
|
|
||
| from .. import config | ||
| from ..utils.module_ops import scene_classes_from_file | ||
|
|
||
|
|
||
| def configure_pygui(renderer, widgets, update=True): | ||
| if not dearpygui_imported: | ||
| raise RuntimeError("Attempted to use DearPyGUI when it isn't imported.") | ||
naveen521kk marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| if update: | ||
| dearpygui.core.delete_item("Manim GUI") | ||
|
|
||
| def rerun_callback(sender, data): | ||
| renderer.scene.queue.put(("rerun_gui", [], {})) | ||
|
|
||
| def continue_callback(sender, data): | ||
| renderer.scene.queue.put(("exit_gui", [], {})) | ||
|
|
||
| def scene_selection_callback(sender, data): | ||
| config["scene_names"] = (dearpygui.core.get_value(sender),) | ||
| renderer.scene.queue.put(("rerun_gui", [], {})) | ||
|
|
||
| scene_classes = scene_classes_from_file(Path(config["input_file"]), full_list=True) | ||
| scene_names = [scene_class.__name__ for scene_class in scene_classes] | ||
|
|
||
| with dearpygui.simple.window( | ||
| "Manim GUI", | ||
| x_pos=config["gui_location"][0], | ||
| y_pos=config["gui_location"][1], | ||
| width=1000, | ||
| height=500, | ||
| ): | ||
| dearpygui.core.set_global_font_scale(2) | ||
eulertour marked this conversation as resolved.
Show resolved
Hide resolved
hydrobeam marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| dearpygui.core.add_button("Rerun", callback=rerun_callback) | ||
| dearpygui.core.add_button("Continue", callback=continue_callback) | ||
| dearpygui.core.add_combo( | ||
| "Selected scene", | ||
| items=scene_names, | ||
| callback=scene_selection_callback, | ||
| default_value=config["scene_names"][0], | ||
| ) | ||
| dearpygui.core.add_separator() | ||
| if len(widgets) != 0: | ||
| with dearpygui.simple.collapsing_header( | ||
| f"{config['scene_names'][0]} widgets", default_open=True | ||
| ): | ||
| for widget_config in widgets: | ||
| widget_config_copy = widget_config.copy() | ||
| name = widget_config_copy["name"] | ||
| widget = widget_config_copy["widget"] | ||
| if widget != "separator": | ||
| del widget_config_copy["name"] | ||
| del widget_config_copy["widget"] | ||
| getattr(dearpygui.core, f"add_{widget}")( | ||
| name, **widget_config_copy | ||
| ) | ||
| else: | ||
| dearpygui.core.add_separator() | ||
| # dearpygui.demo.show_demo() | ||
| if not update: | ||
| dearpygui.core.start_dearpygui() | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.