fix: resolve mypy type errors in TUI app and build_log screen

This commit is contained in:
AFredefon
2026-03-11 07:09:58 +01:00
parent 6cdd0caec0
commit 73a0170d65
2 changed files with 9 additions and 6 deletions

View File

@@ -35,7 +35,7 @@ if TYPE_CHECKING:
_AgentRow = tuple[str, "AIAgent", Path, str, bool]
class SingleClickDataTable(DataTable):
class SingleClickDataTable(DataTable[Any]):
"""DataTable subclass that also fires ``RowClicked`` on a single mouse click.
Textual's built-in ``RowSelected`` only fires on Enter or on a second click
@@ -56,7 +56,7 @@ class SingleClickDataTable(DataTable):
"""Return the data table that fired this event."""
return self.data_table
async def _on_click(self, event: events.Click) -> None: # type: ignore[override]
async def _on_click(self, event: events.Click) -> None:
"""Forward to parent, then post RowClicked on every mouse click.
The hub table is handled exclusively via RowClicked. RowSelected is
@@ -450,9 +450,10 @@ class FuzzForgeApp(App[None]):
self._build_dialog_open = True
def _on_build_dialog_done(confirmed: bool, sn: str = server_name, im: str = image, hn: str = hub_name) -> None:
def _on_build_dialog_done(result: bool | None) -> None:
self._build_dialog_open = False
self._on_build_confirmed(confirmed, sn, im, hn)
if result is not None:
self._on_build_confirmed(result, server_name, image, hub_name)
self.push_screen(
BuildImageScreen(server_name, image, hub_name),

View File

@@ -8,6 +8,8 @@ open at any time while the build is running and see up-to-date output.
from __future__ import annotations
from typing import Any
from textual.app import ComposeResult
from textual.containers import Horizontal, Vertical
from textual.screen import ModalScreen
@@ -51,13 +53,13 @@ class BuildLogScreen(ModalScreen[None]):
log_widget.write_line(line)
self._last_line += len(new_lines)
active: dict = getattr(self.app, "_active_builds", {})
active: dict[str, Any] = getattr(self.app, "_active_builds", {})
status = self.query_one("#build-status", Label)
if self._image in active:
status.update("[yellow]⏳ Building…[/yellow]")
else:
# Build is done — check if we have a result stored
results: dict = getattr(self.app, "_build_results", {})
results: dict[str, Any] = getattr(self.app, "_build_results", {})
if self._image in results:
if results[self._image]:
status.update(f"[green]✓ {self._image} built successfully[/green]")