ruff formatted
This commit is contained in:
@@ -4,24 +4,27 @@ from textual.screen import ModalScreen
|
||||
from textual.widgets import Input, Label, Button
|
||||
from textual.containers import Horizontal
|
||||
|
||||
class OpenMessageScreen(ModalScreen[int | None]):
|
||||
|
||||
class OpenMessageScreen(ModalScreen[int | None]):
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Horizontal(
|
||||
Label("📨 ID", id="message_label"),
|
||||
Input(placeholder="Enter message ID (integer only)", type="integer", id="open_message_input"),
|
||||
Input(
|
||||
placeholder="Enter message ID (integer only)",
|
||||
type="integer",
|
||||
id="open_message_input",
|
||||
),
|
||||
Button("Cancel", id="cancel"),
|
||||
Button("Open", variant="primary", id="submit"),
|
||||
id="open_message_container",
|
||||
classes="modal_screen"
|
||||
classes="modal_screen",
|
||||
)
|
||||
|
||||
@on(Input.Submitted)
|
||||
def handle_message_id(self, event) -> None:
|
||||
input_widget = self.query_one("#open_message_input", Input)
|
||||
message_id = int(input_widget.value if input_widget.value else 0)
|
||||
self.dismiss(message_id)
|
||||
|
||||
input_widget = self.query_one("#open_message_input", Input)
|
||||
message_id = int(input_widget.value if input_widget.value else 0)
|
||||
self.dismiss(message_id)
|
||||
|
||||
def button_on_click(self, event) -> None:
|
||||
if event.button.id == "cancel":
|
||||
@@ -30,4 +33,3 @@ class OpenMessageScreen(ModalScreen[int | None]):
|
||||
input_widget = self.query_one("#open_message_input", Input)
|
||||
message_id = int(input_widget.value if input_widget.value else 0)
|
||||
self.dismiss(message_id)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user