mirror of
https://github.com/FuzzingLabs/fuzzforge_ai.git
synced 2026-09-30 23:39:39 +02:00
fix: resolve mypy type errors in TUI app and build_log screen
This commit is contained in:
1 parent
6cdd0caec0
commit
73a0170d65
2 files changed
+9
-6
No files matched your search
@@ -35,7 +35,7 @@ if TYPE_CHECKING:
|
|||||||
_AgentRow = tuple[str, "AIAgent", Path, str, bool]
|
_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.
|
"""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
|
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 the data table that fired this event."""
|
||||||
return self.data_table
|
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.
|
"""Forward to parent, then post RowClicked on every mouse click.
|
||||||
|
|
||||||
The hub table is handled exclusively via RowClicked. RowSelected is
|
The hub table is handled exclusively via RowClicked. RowSelected is
|
||||||
@@ -450,9 +450,10 @@ class FuzzForgeApp(App[None]):
|
|||||||
|
|
||||||
self._build_dialog_open = True
|
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._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(
|
self.push_screen(
|
||||||
BuildImageScreen(server_name, image, hub_name),
|
BuildImageScreen(server_name, image, hub_name),
|
||||||
|
|||||||
@@ -8,6 +8,8 @@ open at any time while the build is running and see up-to-date output.
|
|||||||
|
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
from typing import Any
|
||||||
|
|
||||||
from textual.app import ComposeResult
|
from textual.app import ComposeResult
|
||||||
from textual.containers import Horizontal, Vertical
|
from textual.containers import Horizontal, Vertical
|
||||||
from textual.screen import ModalScreen
|
from textual.screen import ModalScreen
|
||||||
@@ -51,13 +53,13 @@ class BuildLogScreen(ModalScreen[None]):
|
|||||||
log_widget.write_line(line)
|
log_widget.write_line(line)
|
||||||
self._last_line += len(new_lines)
|
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)
|
status = self.query_one("#build-status", Label)
|
||||||
if self._image in active:
|
if self._image in active:
|
||||||
status.update("[yellow]⏳ Building…[/yellow]")
|
status.update("[yellow]⏳ Building…[/yellow]")
|
||||||
else:
|
else:
|
||||||
# Build is done — check if we have a result stored
|
# 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 self._image in results:
|
||||||
if results[self._image]:
|
if results[self._image]:
|
||||||
status.update(f"[green]✓ {self._image} built successfully[/green]")
|
status.update(f"[green]✓ {self._image} built successfully[/green]")
|
||||||
|
|||||||
Reference in new issue
Block a user