"""Editor-specific demo step package.
Split from the former flat demo_steps.py into:
- ``steps`` -- all step dataclasses (AddNode, SetProperty, ClickMenu, ...).
- ``handlers`` -- handler functions dispatched per-step by DemoRunner.
- ``_helpers`` -- shared utilities (editor/state lookup, mouse click
animation primitives, world-to-screen projection, colour formatting).
Public API is re-exported so ``from simvx.editor.testing.demo_steps import AddNode,
register_editor_steps`` keeps working.
"""
from simvx.core.scripted_demo import DemoRunner
from . import handlers as _h
from ._helpers import (
_drive_click,
_init_click,
)
# Re-export every handler so tests that reach `from simvx.editor.testing.demo_steps
# import _handle_place_node` keep working.
from .handlers import (
_handle_add_node,
_handle_assert_config,
_handle_assert_property,
_handle_assert_tree,
_handle_click_add_button,
_handle_click_bottom_tab,
_handle_click_code_caret,
_handle_click_game_node,
_handle_click_inspector_button,
_handle_click_menu,
_handle_click_toolbar,
_handle_click_tree_item,
_handle_click_viewport3d,
_handle_configure_node,
_handle_dialog_select,
_handle_double_click_file,
_handle_drag_gizmo_axis,
_handle_inspector_edit,
_handle_inspector_rename,
_handle_inspector_set_anchor_preset,
_handle_inspector_set_colour,
_handle_new_scene_select,
_handle_paste_in_editor,
_handle_place_node,
_handle_play_scene,
_handle_rename_node,
_handle_select_node,
_handle_set_property,
_handle_set_script,
_handle_stop_scene,
_handle_switch_viewport,
)
from .steps import (
AddNode,
AssertConfig,
AssertProperty,
AssertTree,
ClickAddButton,
ClickBottomTab,
ClickCodeCaret,
ClickGameNode,
ClickInspectorButton,
ClickMenu,
ClickToolbar,
ClickTreeItem,
ClickViewport3D,
ConfigureNode,
DialogSelect,
DoubleClickFile,
DragGizmoAxis,
InspectorEdit,
InspectorRename,
InspectorSetAnchorPreset,
InspectorSetColour,
NewSceneSelect,
PasteInEditor,
PlaceNode,
PlayScene,
RenameNode,
SelectNode,
SetProperty,
SetScript,
StopScene,
SwitchViewport,
)
_HANDLERS = {
AddNode: _h._handle_add_node,
PlaceNode: _h._handle_place_node,
RenameNode: _h._handle_rename_node,
SelectNode: _h._handle_select_node,
SetProperty: _h._handle_set_property,
AssertProperty: _h._handle_assert_property,
SetScript: _h._handle_set_script,
PlayScene: _h._handle_play_scene,
StopScene: _h._handle_stop_scene,
SwitchViewport: _h._handle_switch_viewport,
AssertTree: _h._handle_assert_tree,
ConfigureNode: _h._handle_configure_node,
AssertConfig: _h._handle_assert_config,
ClickAddButton: _h._handle_click_add_button,
ClickBottomTab: _h._handle_click_bottom_tab,
DialogSelect: _h._handle_dialog_select,
ClickTreeItem: _h._handle_click_tree_item,
InspectorRename: _h._handle_inspector_rename,
InspectorEdit: _h._handle_inspector_edit,
InspectorSetColour: _h._handle_inspector_set_colour,
InspectorSetAnchorPreset: _h._handle_inspector_set_anchor_preset,
ClickToolbar: _h._handle_click_toolbar,
ClickInspectorButton: _h._handle_click_inspector_button,
PasteInEditor: _h._handle_paste_in_editor,
ClickViewport3D: _h._handle_click_viewport3d,
ClickGameNode: _h._handle_click_game_node,
ClickMenu: _h._handle_click_menu,
NewSceneSelect: _h._handle_new_scene_select,
DragGizmoAxis: _h._handle_drag_gizmo_axis,
DoubleClickFile: _h._handle_double_click_file,
ClickCodeCaret: _h._handle_click_code_caret,
}
[docs]
def register_editor_steps():
"""Register all editor step handlers with DemoRunner."""
for step_type, handler in _HANDLERS.items():
DemoRunner.register_step_handler(step_type, handler)
__all__ = [
# Step dataclasses
"AddNode", "PlaceNode", "RenameNode", "SelectNode",
"SetProperty", "AssertProperty",
"SetScript", "PlayScene", "StopScene", "SwitchViewport", "AssertTree",
"ConfigureNode", "AssertConfig",
"ClickAddButton", "ClickBottomTab", "DialogSelect", "ClickTreeItem",
"InspectorRename", "InspectorEdit", "InspectorSetColour",
"InspectorSetAnchorPreset",
"ClickToolbar", "ClickInspectorButton", "PasteInEditor",
"ClickViewport3D", "ClickGameNode",
"ClickMenu", "NewSceneSelect",
"DragGizmoAxis", "DoubleClickFile", "ClickCodeCaret",
# Registration
"register_editor_steps",
# Shared helpers used by demo files for custom steps
"_init_click",
"_drive_click",
# Re-exported handlers (private surface but legacy tests import them by name).
"_handle_add_node",
"_handle_assert_config",
"_handle_assert_property",
"_handle_assert_tree",
"_handle_click_add_button",
"_handle_click_bottom_tab",
"_handle_click_code_caret",
"_handle_click_game_node",
"_handle_click_inspector_button",
"_handle_click_menu",
"_handle_click_toolbar",
"_handle_click_tree_item",
"_handle_click_viewport3d",
"_handle_configure_node",
"_handle_dialog_select",
"_handle_double_click_file",
"_handle_drag_gizmo_axis",
"_handle_inspector_edit",
"_handle_inspector_rename",
"_handle_inspector_set_anchor_preset",
"_handle_inspector_set_colour",
"_handle_new_scene_select",
"_handle_paste_in_editor",
"_handle_place_node",
"_handle_play_scene",
"_handle_rename_node",
"_handle_select_node",
"_handle_set_property",
"_handle_set_script",
"_handle_stop_scene",
"_handle_switch_viewport",
]