diff --git a/katrain/gui.kv b/katrain/gui.kv index 9617f53a..1af4515e 100644 --- a/katrain/gui.kv +++ b/katrain/gui.kv @@ -455,31 +455,26 @@ text: '+0' size: self.texture_size -: +: size_hint_y: EPSILON if root.hidden else 1 opacity: 0 if root.hidden else 1 - size_hint: 0.6,1 font_size: self.height * 0.7 font_name: root.font_name text_size: self.size valign: 'middle' + max_lines: 1 + +: + size_hint: 0.6,1 halign: 'left' text: root.label - max_lines: 1 : - size_hint_y: EPSILON if root.hidden else 1 - opacity: 0 if root.hidden else 1 size_hint: 0.4,1 color: root.color - font_size: self.height * 0.7 - font_name: root.font_name - text_size: self.size - valign: 'middle' halign: 'left' bold: True - text: root.text - max_lines: 1 + text: root.value cols: 2 @@ -493,7 +488,7 @@ id: winrate_value hidden: winrate_label.hidden color: Theme.WINRATE_COLOR - text: root.winrate + value: root.winrate StatsLabel: id: score_label label: i18n._('stats:score') @@ -501,7 +496,7 @@ id: score_value hidden: score_label.hidden color: Theme.SCORE_COLOR - text: root.score + value: root.score StatsLabel: id: pointloss_label label: i18n._('stats:pointslost') if root.points_lost is None or root.points_lost > 0 else i18n._('stats:pointsgained') @@ -509,7 +504,7 @@ id: pointloss_value hidden: pointloss_label.hidden color: Theme.POINTLOSS_COLOR - text: '{}: {:.1f}'.format(i18n._(f'short color {root.player}'), abs(root.points_lost)) if root.points_lost is not None else '...' + value: '{}: {:.1f}'.format(i18n._(f'short color {root.player}'), abs(root.points_lost)) if root.points_lost is not None else '...' : background_color: Theme.BOX_BACKGROUND_COLOR diff --git a/katrain/gui/kivyutils.py b/katrain/gui/kivyutils.py index 0fdc38c3..b80314f3 100644 --- a/katrain/gui/kivyutils.py +++ b/katrain/gui/kivyutils.py @@ -178,17 +178,18 @@ class LightLabel(Label): pass -class StatsLabel(Label): - label = StringProperty("") - color = ListProperty([1, 1, 1, 1]) +class StatsItem(Label): hidden = BooleanProperty(False) font_name = StringProperty(Theme.DEFAULT_FONT) -class StatsValue(Label): - text = StringProperty("") + +class StatsLabel(StatsItem): + label = StringProperty("") + + +class StatsValue(StatsItem): + value = StringProperty("") color = ListProperty([1, 1, 1, 1]) - hidden = BooleanProperty(False) - font_name = StringProperty(Theme.DEFAULT_FONT) class MyNavigationDrawer(MDNavigationDrawer):