mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
fix for watchers
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user