Bases: ModalScreen[None]
Display a connection error with retry logic.
Source code in peagen/tui/components/reconnect_screen.py
| def __init__(self, message: str, on_retry) -> None:
super().__init__()
self.message = message
self.on_retry = on_retry
self._counter = 30
|
message
instance-attribute
on_retry
instance-attribute
compose
Source code in peagen/tui/components/reconnect_screen.py
18
19
20
21
22
23
24
25
26
27
28
29 | def compose(self) -> ComposeResult: # pragma: no cover - ui code
yield Center(
Vertical(
Static(self.message, id="error-message"),
Horizontal(
Button("Retry", id="retry"),
Button("Close", id="close"),
),
Static(f"Retrying in {self._counter}s", id="timer"),
id="reconnect-box",
)
)
|
on_mount
Source code in peagen/tui/components/reconnect_screen.py
| def on_mount(self) -> None: # pragma: no cover - ui code
self.set_interval(1.0, self._tick)
|
Source code in peagen/tui/components/reconnect_screen.py
| async def on_button_pressed(
self, event: Button.Pressed
) -> None: # pragma: no cover - ui code
if event.button.id == "retry":
self.dismiss()
self.on_retry()
elif event.button.id == "close":
self.app.exit()
|