31 lines
647 B
Python
31 lines
647 B
Python
from textual.app import App
|
|
|
|
from .db import db
|
|
|
|
from .screens.hamster import HamsterScreen
|
|
from .screens.kimai import KimaiScreen
|
|
|
|
|
|
class HamsterToolsApp(App):
|
|
CSS_PATH = "app.tcss"
|
|
BINDINGS = [
|
|
("h", "switch_mode('hamster')", "Hamster"),
|
|
("k", "switch_mode('kimai')", "Kimai"),
|
|
("q", "quit", "Quit"),
|
|
]
|
|
|
|
def __init__(self):
|
|
self.MODES = {
|
|
"hamster": HamsterScreen(),
|
|
"kimai": KimaiScreen(),
|
|
}
|
|
|
|
super().__init__()
|
|
|
|
def on_mount(self) -> None:
|
|
self.switch_mode("hamster")
|
|
|
|
def action_quit(self) -> None:
|
|
db.close()
|
|
self.exit()
|