diff --git a/Difficult_Rocket/gui/widget/theme/__init__.py b/Difficult_Rocket/gui/widget/theme/__init__.py index 16a66ac..7d83603 100644 --- a/Difficult_Rocket/gui/widget/theme/__init__.py +++ b/Difficult_Rocket/gui/widget/theme/__init__.py @@ -4,7 +4,9 @@ # All rights reserved # ------------------------------- -from typing import Optional, Tuple +from typing import Optional, Tuple, TYPE_CHECKING + +from pyglet.graphics import Batch, Group class BaseTheme(dict): @@ -19,6 +21,19 @@ class BaseTheme(dict): if hasattr(self, k): setattr(self, k, v) + if TYPE_CHECKING: + def init(self, + batch: Batch, + group: Group, + **kwargs) -> None: + """ + Init theme + :param batch: batch + :param group: group + :param kwargs: options + :return: None + """ + class FontTheme(BaseTheme): """ diff --git a/Difficult_Rocket/gui/widget/theme/button.py b/Difficult_Rocket/gui/widget/theme/button.py index df9252a..43450b9 100644 --- a/Difficult_Rocket/gui/widget/theme/button.py +++ b/Difficult_Rocket/gui/widget/theme/button.py @@ -23,6 +23,18 @@ class ButtonBaseTheme(BaseTheme): """ theme_name = 'Button Base Theme' + def init(self, batch: Batch, group: Group, **kwargs) -> None: + """ + Init theme + :param batch: batch + :param group: group + :param kwargs: options + :return: None + """ + self.batch = batch + self.group = group + self.font_theme = FontTheme(**kwargs) + class BlockTheme(ButtonBaseTheme): """ @@ -34,3 +46,4 @@ class BlockTheme(ButtonBaseTheme): hit_color: _RGBA = (15, 135, 250, 255) font_theme: FontTheme = FontTheme() +