layout of panels tweaked

This commit is contained in:
Tim Bendt
2025-05-04 14:50:58 -06:00
parent 08eb4ee0cf
commit b26674ff4e
9 changed files with 201 additions and 54 deletions

View File

@@ -1,22 +1,24 @@
from textual import on
from textual.app import ComposeResult, Screen
from textual.app import ComposeResult
from textual.screen import ModalScreen
from textual.widgets import Input, Label, Button
from textual.containers import Horizontal
from textual.containers import Container
class OpenMessageScreen(ModalScreen[int | None]):
class OpenMessageScreen(Screen[int]):
def compose(self) -> ComposeResult:
yield Horizontal(
yield Container(
Label("📨", id="message_label"),
Input(placeholder="Enter message ID (integer only)", type="integer", id="open_message_input"),
Button("Open", variant="primary", id="open_message_button")
Button("Open", variant="primary", id="open_message_button"),
id="open_message_container",
classes="modal_screen"
)
@on(Input.Submitted)
def handle_message_id(self) -> None:
input_widget = self.query_one("#open_message_input", Input)
self.disabled = True
self.loading = True
message_id = int(input_widget.value)
message_id = int(input_widget.value if input_widget.value else 0)
self.dismiss(message_id)
@on(Input._on_key)