looks good
This commit is contained in:
parent
6255d29008
commit
7f52894682
@ -75,8 +75,10 @@ class ButtonTheme(BaseTheme):
|
||||
secondary_color: RGBA = (66, 150, 250, 256),
|
||||
hit_color: RGBA = (15, 135, 250, 256),
|
||||
main_font: str = Fonts.鸿蒙简体,
|
||||
font_theme: Optional[FontTheme] = None,
|
||||
):
|
||||
super().__init__(main_color, secondary_color, main_font)
|
||||
self.font_theme = font_theme or FontTheme(main_color, secondary_color, main_font)
|
||||
self.hit_color = hit_color
|
||||
|
||||
|
||||
@ -91,8 +93,7 @@ class PressTextButton(widgets.WidgetBase):
|
||||
width: int,
|
||||
height: int,
|
||||
text: str,
|
||||
font_name: str = Fonts.鸿蒙简体,
|
||||
font_size: int = 15,
|
||||
font_theme: Optional[FontTheme] = None,
|
||||
batch: Optional[Batch] = None,
|
||||
group: Optional[Group] = None,
|
||||
theme: Optional[ButtonTheme] = None,
|
||||
@ -109,6 +110,7 @@ class PressTextButton(widgets.WidgetBase):
|
||||
self.pressed = False
|
||||
|
||||
self.theme = theme or ButtonTheme()
|
||||
self.font_theme = font_theme or FontTheme()
|
||||
|
||||
self.untouched_color = self.theme.main_color
|
||||
self.touched_color = self.theme.secondary_color
|
||||
@ -116,11 +118,15 @@ class PressTextButton(widgets.WidgetBase):
|
||||
# from ImGui
|
||||
|
||||
self.text = text
|
||||
self.text_label = Label(font_name=font_name, font_size=font_size,
|
||||
self.text_label = Label(font_name=self.font_theme.main_font, font_size=self.font_theme.font_size,
|
||||
batch=self.front_batch, group=self.front_group,
|
||||
x=self._x, y=self._y, width=self._width,
|
||||
height=self._height,)
|
||||
self.font = pyglet.font.load(font_name, font_size)
|
||||
self.font = pyglet.font.load(self.font_theme.main_font,
|
||||
self.font_theme.font_size,
|
||||
bold=self.font_theme.font_bold,
|
||||
italic=self.font_theme.font_italic,
|
||||
stretch=self.font_theme.font_stretch)
|
||||
self.font_height = self.font.ascent - self.font.descent
|
||||
self.back_rec = Rectangle(x=self._x, y=self._y,
|
||||
width=self._width, height=self._height,
|
||||
|
Loading…
Reference in New Issue
Block a user