Enhance | Theme
This commit is contained in:
parent
3f097c3ed5
commit
263891a982
@ -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):
|
||||
"""
|
||||
|
@ -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()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user