fix(palette): auto-focus input via set_next_window_focus + apply(theme) + try/except for actions
Added imgui.set_next_window_focus() on open so the palette window itself gets focus. The input field then gets focus on the next drawn widget. Wrapped action calls in try/except so a buggy command does not break the imgui.end_child/end pairing (was causing IM_ASSERT crash). Fixed theme_2 calls: apply_dark_theme and apply_light_theme do not exist; use theme_2.apply(palette_name). switch_to_dark_theme uses apply 10x Dark. switch_to_light_theme uses apply ImGui Light. switch_to_nerv_theme uses apply NERV instead of apply_nerv() from src.theme_nerv.
This commit is contained in:
+6
-6
@@ -69,20 +69,20 @@ def show_documentation(app: "App") -> None:
|
||||
|
||||
@registry.register
|
||||
def switch_to_dark_theme(app: "App") -> None:
|
||||
"""Switch to Dark Theme."""
|
||||
"""Switch to Dark Theme (10x Dark palette)."""
|
||||
from src import theme_2
|
||||
theme_2.apply_dark_theme()
|
||||
theme_2.apply("10x Dark")
|
||||
|
||||
|
||||
@registry.register
|
||||
def switch_to_light_theme(app: "App") -> None:
|
||||
"""Switch to Light Theme."""
|
||||
"""Switch to Light Theme (ImGui Light palette)."""
|
||||
from src import theme_2
|
||||
theme_2.apply_light_theme()
|
||||
theme_2.apply("ImGui Light")
|
||||
|
||||
|
||||
@registry.register
|
||||
def switch_to_nerv_theme(app: "App") -> None:
|
||||
"""Switch to NERV Theme."""
|
||||
from src.theme_nerv import apply_nerv
|
||||
apply_nerv()
|
||||
from src import theme_2
|
||||
theme_2.apply("NERV")
|
||||
|
||||
Reference in New Issue
Block a user