Source code for exlab_wizard.ui.components.tree_context_menu
"""Tree context-menu renderers.
GUI/Orchestrator Redesign §4.6 / decision 4A / §9.1.
Two right-click context menus live on tree nodes:
* **Owned-equipment node** — *Edit equipment…* and *Remove…* both deep-
link into Settings → Equipment List. Add lives on the toolbar
(decision 4A); these stay in Settings.
* **Run node** — *Force sync*, *Clear verified*, *View log*. These are
the relocated bottom-dock per-run actions (§4.6) and are also
surfaced on the run's Metadata pane.
The renderers are NiceGUI thin wrappers around ``ui.context_menu()``;
both take a single callable (``on_tree_context_action`` /
``on_run_staging_action``) that the mount layer wires.
Received-equipment nodes deliberately have no context menu — they
aren't editable from this device (Redesign §3.3 + decision 3).
"""
from __future__ import annotations
from collections.abc import Callable
from typing import Any
__all__ = [
"RUN_CONTEXT_CLEAR_VERIFIED",
"RUN_CONTEXT_FORCE_SYNC",
"RUN_CONTEXT_VIEW_LOG",
"TREE_CONTEXT_EDIT_EQUIPMENT",
"TREE_CONTEXT_REMOVE_EQUIPMENT",
"render_equipment_context_menu",
"render_run_context_menu",
]
# Action discriminators consumed by the on_tree_context_action callback.
TREE_CONTEXT_EDIT_EQUIPMENT = "edit_equipment"
TREE_CONTEXT_REMOVE_EQUIPMENT = "remove_equipment"
# Action discriminators consumed by the on_run_staging_action callback.
# These are the same strings the metadata pane surfaces so a single
# router on the mount side handles both.
RUN_CONTEXT_FORCE_SYNC = "force_sync"
RUN_CONTEXT_CLEAR_VERIFIED = "clear_verified"
RUN_CONTEXT_VIEW_LOG = "view_log"