Skip to content

Class peagen.tui.components.task_detail_screen.TaskDetailScreen

peagen.tui.components.task_detail_screen.TaskDetailScreen

TaskDetailScreen(task_data)

Bases: ModalScreen[None]

A modal screen to display task details.

Source code in peagen/tui/components/task_detail_screen.py
17
18
19
def __init__(self, task_data: dict) -> None:
    super().__init__()
    self.task = task_data

task class-attribute instance-attribute

task = task_data

compose

compose()

Construct widgets for the detail view.

Source code in peagen/tui/components/task_detail_screen.py
21
22
23
24
25
26
27
def compose(self) -> ComposeResult:
    """Construct widgets for the detail view."""

    with VerticalScroll(id="task_detail_vertical_scroll"):
        yield Label("Task Details", classes="title")
        yield Tree("task", id="task_detail_tree")
    yield Button("Close", id="close_task_detail_button", variant="primary")

on_mount

on_mount()

Populate the task table when the screen is shown.

Source code in peagen/tui/components/task_detail_screen.py
29
30
31
32
33
34
35
36
37
38
39
def on_mount(self) -> None:
    """Populate the task table when the screen is shown."""

    tree = self.query_one("#task_detail_tree", Tree)
    tree.root.expand()

    if not self.task:
        tree.root.add_leaf("No task data")
        return

    self._populate_tree(tree.root, self.task)

on_button_pressed

on_button_pressed(event)

Event handler called when a button is pressed.

Source code in peagen/tui/components/task_detail_screen.py
69
70
71
72
def on_button_pressed(self, event: Button.Pressed) -> None:
    """Event handler called when a button is pressed."""
    if event.button.id == "close_task_detail_button":
        self.dismiss()