# Part of ImGui Bundle - MIT License - Copyright (c) 2022-2026 Pascal Thomet - https://github.com/pthom/imgui_bundle
import os.path
import subprocess
import sys
from imgui_bundle import imgui, immapp, imgui_md
from imgui_bundle.demos_python import demo_utils


def demo_gui():
    imgui_md.render_unindented(
        """
        [ImGuizmo](https://github.com/CedricGuillemet/ImGuizmo) provides an immediate mode 3D gizmo for scene editing and other controls based on Dear Imgui.
        """
    )

    imgui.text(
        "Click the button below to launch the demo (below the button is a screenshot of the app that will be launched)"
    )
    if demo_utils.can_run_subprocess():
        if imgui.button("Run gizmo demo"):
            this_dir = os.path.dirname(__file__)
            subprocess.Popen(
                [sys.executable, this_dir + "/demos_imguizmo/demo_gizmo.py"]
            )
    demo_utils.show_python_vs_cpp_file("demos_imguizmo/demo_gizmo", nb_lines=30)


def main():
    immapp.run(demo_gui, window_size=(1000, 800), with_markdown=True)


if __name__ == "__main__":
    main()
