fix for watchers

This commit is contained in:
Will McGugan
2022-08-19 10:22:58 +01:00
parent 2fbafe8322
commit ee97553c18
4 changed files with 35 additions and 36 deletions

View File

@@ -8,12 +8,24 @@ TimerWidget {
transition: background 200ms linear;
}
TimerWidget.started {
text-style: bold;
background: $success;
color: $text-success;
border: tall $success-darken-2;
}
TimeDisplay {
content-align: center middle;
opacity: 60%;
height: 3;
}
TimerWidget.started TimeDisplay {
opacity: 100%;
}
Button {
width: 16;
}
@@ -23,14 +35,6 @@ Button {
}
TimerWidget.started {
opacity: 100%;
text-style: bold;
background: $success;
color: $text-success;
border: tall $success-darken-2;
}
TimerWidget.started #start {
display: none
}

View File

@@ -68,15 +68,15 @@ class TimerApp(App):
def compose(self) -> ComposeResult:
yield Header()
yield Footer()
yield Container(TimerWidget(), TimerWidget(), TimerWidget())
yield Container(TimerWidget(), TimerWidget(), TimerWidget(), id="timers")
def action_add_timer(self) -> None:
new_timer = TimerWidget()
self.query_one(Container).mount(new_timer)
self.query_one("#timers").mount(new_timer)
new_timer.scroll_visible()
def action_remove_timer(self) -> None:
timers = self.query("Container TimerWidget")
timers = self.query("#timers TimerWidget")
if timers:
timers.last().remove()