diff --git a/Sidebar.py b/Sidebar.py new file mode 100644 index 0000000..7209f31 --- /dev/null +++ b/Sidebar.py @@ -0,0 +1,31 @@ +from textual.containers import Container +from textual.app import ComposeResult +from textual.widgets import Static, Button + +MESSAGE = ''' +Be excellent to each other! + +Made with :red_heart: by Panki + +[@click="app.open_link('https://tty0.social/@panki')"]Mastodon:[/] tty0.social/@panki +[@click="app.open_link('https://git.theresno.cloud/panki/bingo-cli')"]Source:[/] git.theresno.cloud/panki/bingo-cli + +Built using [@click="app.open_link('https://textual.textualize.io/')"]Textual[/] + +''' + +class Sidebar(Container): + '''Class to represent the sidebar''' + + def compose(self) -> ComposeResult: + '''Create the widgets that make up the sidebar''' + yield Static('CCC Bingo', classes='title') + yield Static(MESSAGE, classes='message') + self.button = Button('< Back', variant='primary', classes='btn_sidebar') + self.button.disabled = True + yield self.button + + def on_button_pressed(self, event: Button.Pressed) -> None: + '''Closes the sidebar''' + self.app.action_toggle_sidebar() + diff --git a/bingo.py b/bingo.py index e778f06..e1e538f 100644 --- a/bingo.py +++ b/bingo.py @@ -2,7 +2,7 @@ from textual.app import App, ComposeResult from textual.widgets import Header, Input, Static, Button -from textual.containers import Horizontal, Container +from textual.containers import Horizontal from textual.validation import Number from textual.reactive import reactive @@ -10,33 +10,7 @@ from datetime import datetime from BingoBoard import BingoBoard from AboutCommand import AboutCommand - -MESSAGE = ''' -Be excellent to each other! - -Made with :red_heart: by Panki - -[@click="app.open_link('https://tty0.social/@panki')"]Mastodon:[/] tty0.social/@panki -[@click="app.open_link('https://git.theresno.cloud/panki/bingo-cli')"]Source:[/] git.theresno.cloud/panki/bingo-cli - -Built using [@click="app.open_link('https://textual.textualize.io/')"]Textual[/] - -''' - -class Sidebar(Container): - '''Class to represent the sidebar''' - - def compose(self) -> ComposeResult: - '''Create the widgets that make up the sidebar''' - yield Static('CCC Bingo', classes='title') - yield Static(MESSAGE, classes='message') - self.button = Button('< Back', variant='primary', classes='btn_sidebar') - self.button.disabled = True - yield self.button - - def on_button_pressed(self, event: Button.Pressed) -> None: - '''Closes the sidebar''' - self.app.action_toggle_sidebar() +from Sidebar import Sidebar class BingoApp(App): '''