openCom-Companion/sbapp/kivymd/uix/label/label.kv

69 lines
2.0 KiB
Plaintext
Raw Normal View History

2022-07-07 22:16:10 +02:00
#:import md_icons kivymd.icon_definitions.md_icons
<MDLabel>
disabled_color: self.theme_cls.disabled_hint_text_color
2023-07-10 02:49:58 +02:00
text_size:
(self.width if not self.adaptive_width else None) \
if not self.adaptive_size else None, \
None
2022-07-07 22:16:10 +02:00
<MDIcon>:
canvas:
Color:
rgba: (1, 1, 1, 1) if self.source else (0, 0, 0, 0)
Rectangle:
2023-07-10 02:49:58 +02:00
group: "rectangle"
2022-07-07 22:16:10 +02:00
source: self.source if self.source else None
2022-10-08 17:17:59 +02:00
pos:
self.pos \
if not self.source else \
(self.x - self._size[0] / 2, self.y)
size:
self._size \
if self.source else \
self.size
2022-07-07 22:16:10 +02:00
font_style: "Icon"
text: u"{}".format(md_icons[root.icon]) if root.icon in md_icons else "blank"
source: None if root.icon in md_icons else root.icon
# Badge icon.
MDLabel:
2023-07-10 02:49:58 +02:00
id: badge
2022-07-07 22:16:10 +02:00
font_style: "Icon"
adaptive_size: True
opposite_icon_color: True
color: root.badge_icon_color
text:
u"{}".format(md_icons[root.badge_icon]) \
if root.badge_icon in md_icons else \
""
pos:
root.x + root.width / 2 + self.width / 2 - dp(6), \
root.y + self.texture_size[1] / 2 + dp(6)
font_size:
( \
root.font_size / 1.5 \
if not root.badge_font_size else \
root.badge_font_size \
) \
if root.badge_icon and root.badge_icon != "blank" else 0
canvas.before:
Color:
rgba:
( \
root.badge_bg_color \
if root.badge_bg_color else \
app.theme_cls.error_color \
) \
if root.badge_icon else \
(0, 0, 0, 0)
RoundedRectangle:
2023-07-10 02:49:58 +02:00
group: "badge"
2022-07-07 22:16:10 +02:00
radius: [self.width / 2,]
pos: self.pos
size: self.size