Skip to content

PlanPanel

Base classes

Name Children Inherits
VerticalScroll
textual.containers
A container with vertical layout and an automatic scrollbar on the Y axis.

⋔ Inheritance diagram

graph TD
  696488792["sidebar.PlanPanel"]
  1388448080["containers.VerticalScroll"]
  1759507108["containers.ScrollableContainer"]
  4188532303["widget.Widget"]
  3946681048["dom.DOMNode"]
  53685856["message_pump.MessagePump"]
  2751680898["builtins.object"]
  1388448080 --> 696488792
  1759507108 --> 1388448080
  4188532303 --> 1759507108
  3946681048 --> 4188532303
  53685856 --> 3946681048
  2751680898 --> 53685856

🛈 DocStrings

Bases: VerticalScroll

Every plan of the session that is not removed, kept in sync with the state.

Source code in src/acptui/ui/widgets/sidebar.py
class PlanPanel(VerticalScroll):
    """Every plan of the session that is not removed, kept in sync with the state."""

    DEFAULT_CSS = """
    PlanPanel {
        height: auto;
        max-height: 50vh;
        scrollbar-size-vertical: 1;
        & > PlanView { border: round $secondary 40%; margin: 0; }
        & > #no-plan { color: $text-muted; text-style: italic; padding: 0 1; }
    }
    """

    def compose(self) -> ComposeResult:
        yield Static("No plan yet", id="no-plan")

    @property
    def views(self) -> list[PlanView]:
        """The plans shown, in order."""
        return list(self.query_children(PlanView))

    def show(self, state: SessionState | None) -> None:
        """Show the plans of ``state`` (removed ones go, new ones are added at the end)."""
        plans = list(state.plans.values()) if state is not None else []
        views = {view.entry: view for view in self.views}
        for entry, view in views.items():
            if entry not in plans:
                view.remove()
        for entry in plans:
            if (view := views.get(entry)) is None:
                self.mount(PlanView(entry, title=""))
            else:
                view.refresh_entry()
        self.query_one("#no-plan", Static).display = not plans

views property

views: list[PlanView]

The plans shown, in order.

show

show(state: SessionState | None) -> None

Show the plans of state (removed ones go, new ones are added at the end).

Source code in src/acptui/ui/widgets/sidebar.py
def show(self, state: SessionState | None) -> None:
    """Show the plans of ``state`` (removed ones go, new ones are added at the end)."""
    plans = list(state.plans.values()) if state is not None else []
    views = {view.entry: view for view in self.views}
    for entry, view in views.items():
        if entry not in plans:
            view.remove()
    for entry in plans:
        if (view := views.get(entry)) is None:
            self.mount(PlanView(entry, title=""))
        else:
            view.refresh_entry()
    self.query_one("#no-plan", Static).display = not plans

:fa-brands-github: Show source on GitHub