|
3 | 3 | import asyncio |
4 | 4 | import re |
5 | 5 | import shutil |
| 6 | +from collections.abc import AsyncIterator |
6 | 7 | from pathlib import Path |
7 | | -from typing import Literal, Any, Optional, AsyncIterator |
8 | | - |
9 | | -# Define button variant type |
10 | | -ButtonVariant = Literal["default", "primary", "success", "warning", "error"] |
| 8 | +from typing import Literal |
11 | 9 |
|
| 10 | +from rich.text import Text |
12 | 11 | from textual.app import ComposeResult |
13 | | -from textual.containers import Container, Vertical, Horizontal, ScrollableContainer |
| 12 | +from textual.containers import Horizontal, ScrollableContainer |
14 | 13 | from textual.screen import Screen |
15 | | -from textual.widgets import Header, Footer, Static, Button, DataTable |
16 | | -from textual.timer import Timer |
17 | | -from rich.text import Text |
18 | | -from rich.table import Table |
| 14 | +from textual.widgets import Button, DataTable, Footer, Static |
19 | 15 |
|
20 | 16 | from ..managers.container_manager import ( |
21 | 17 | ContainerManager, |
22 | | - ServiceStatus, |
23 | 18 | ServiceInfo, |
| 19 | + ServiceStatus, |
24 | 20 | format_port_conflict_message, |
25 | 21 | ) |
26 | 22 | from ..managers.docling_manager import DoclingManager |
27 | 23 | from ..utils.platform import RuntimeType |
28 | 24 | from ..widgets.command_modal import CommandOutputModal |
29 | | -from ..widgets.flow_backup_warning_modal import FlowBackupWarningModal |
| 25 | +from ..widgets.diagnostics_notification import notify_with_diagnostics |
30 | 26 | from ..widgets.factory_reset_warning_modal import FactoryResetWarningModal |
31 | | -from ..widgets.version_mismatch_warning_modal import VersionMismatchWarningModal |
| 27 | +from ..widgets.flow_backup_warning_modal import FlowBackupWarningModal |
32 | 28 | from ..widgets.upgrade_instructions_modal import UpgradeInstructionsModal |
33 | | -from ..widgets.diagnostics_notification import notify_with_diagnostics |
| 29 | +from ..widgets.version_mismatch_warning_modal import VersionMismatchWarningModal |
| 30 | + |
| 31 | +# Define button variant type |
| 32 | +ButtonVariant = Literal["default", "primary", "success", "warning", "error"] |
34 | 33 |
|
35 | 34 |
|
36 | 35 | class MonitorScreen(Screen): |
@@ -201,7 +200,7 @@ async def _refresh_services(self) -> None: |
201 | 200 | self.images_table.clear() |
202 | 201 |
|
203 | 202 | # Add container service rows |
204 | | - for service_name, service_info in services.items(): |
| 203 | + for _service_name, service_info in services.items(): |
205 | 204 | status_style = self._get_status_style(service_info.status) |
206 | 205 |
|
207 | 206 | self.services_table.add_row( |
@@ -277,7 +276,6 @@ async def _auto_refresh(self) -> None: |
277 | 276 | def on_button_pressed(self, event: Button.Pressed) -> None: |
278 | 277 | """Handle button presses.""" |
279 | 278 | button_id = event.button.id or "" |
280 | | - button_label = event.button.label or "" |
281 | 279 |
|
282 | 280 | # Use button ID prefixes to determine action, ignoring any random suffix |
283 | 281 | if button_id.startswith("start-btn"): |
@@ -322,7 +320,7 @@ def on_button_pressed(self, event: Button.Pressed) -> None: |
322 | 320 | self.run_worker(self._show_logs(service_name)) |
323 | 321 | self._start_follow(service_name) |
324 | 322 |
|
325 | | - async def _start_services(self, cpu_mode: Optional[bool] = None) -> None: |
| 323 | + async def _start_services(self, cpu_mode: bool | None = None) -> None: |
326 | 324 | """Start services with progress updates.""" |
327 | 325 | self.operation_in_progress = True |
328 | 326 | try: |
@@ -617,6 +615,7 @@ async def _prune_images(self) -> None: |
617 | 615 | def _check_flow_backups(self) -> bool: |
618 | 616 | """Check if there are any flow backups in flows/backup directory.""" |
619 | 617 | from pathlib import Path |
| 618 | + |
620 | 619 | from ..managers.env_manager import EnvManager |
621 | 620 |
|
622 | 621 | # Get flows path from env config |
|
0 commit comments