Skip to content

interface

dev_tool.tui.task.interface

TaskInterface

Bases: BaseInterface

The constructor for the TaskInterface class.

Parameters:

  • terminal (Terminal) –

    The blessed Terminal instance.

Source code in dev_tool/tui/task/interface.py
def __init__(self, terminal: Terminal) -> None:
    """
    The constructor for the TaskInterface class.

    :param terminal: The blessed Terminal instance.
    """

    super().__init__(terminal)

    self.task_manager = TaskManager()
    self.index = 0
    self.offset = 0
    self.scroll = 0
    self.viewing_result = False
    self.visible = 10
    self.selected_task_result: TaskResult | None = None
    self.previous_update: float = 0

    self.task_manager.register_watcher(self._on_task_update)

task_manager = TaskManager() instance-attribute

index = 0 instance-attribute

offset = 0 instance-attribute

scroll = 0 instance-attribute

viewing_result = False instance-attribute

visible = 10 instance-attribute

selected_task_result = None instance-attribute

previous_update = 0 instance-attribute

draw_progress_screen

A method that draws the progress screen.

Source code in dev_tool/tui/task/interface.py
def draw_progress_screen(self) -> None:
    """A method that draws the progress screen."""

    if self.viewing_result and self.selected_task_result:
        self._draw_task_result()
    else:
        self._draw_task_list()

handle_input

A method that handles input for the task progress interface.

Parameters:

  • key (str) –

    The key name.

Returns:

  • str | None

    The navigation result or None to continue.

Source code in dev_tool/tui/task/interface.py
def handle_input(self, key: str) -> str | None:
    """
    A method that handles input for the task progress interface.

    :param key: The key name.
    :return: The navigation result or None to continue.
    """

    if self.viewing_result:
        return self._handle_result_view_input(key)

    return self._handle_task_list_input(key)

needs_refresh

A method that checks if the interface needs to be refreshed.

Returns:

  • bool

    True if refresh is needed, False otherwise.

Source code in dev_tool/tui/task/interface.py
def needs_refresh(self) -> bool:
    """
    A method that checks if the interface needs to be refreshed.

    :return: True if refresh is needed, False otherwise.
    """

    current = time.time()

    if self.task_manager.get_active():
        return True

    return current - self.previous_update < 1.0