mirror of https://github.com/JoshKarpel/spiel
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
592 B
Python
25 lines
592 B
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
from textual.reactive import _watch
|
|
from textual.widget import Widget
|
|
|
|
from spiel.slide import Slide
|
|
|
|
if TYPE_CHECKING:
|
|
from spiel.app import SpielApp
|
|
|
|
|
|
class SpielWidget(Widget):
|
|
app: "SpielApp"
|
|
|
|
def on_mount(self) -> None:
|
|
_watch(self, self.app, "deck", self.refresh)
|
|
_watch(self, self.app, "current_slide_idx", self.refresh)
|
|
_watch(self, self.app, "message", self.refresh)
|
|
|
|
@property
|
|
def current_slide(self) -> Slide:
|
|
return self.app.deck[self.app.current_slide_idx]
|