stupid shit
This commit is contained in:
@@ -22,6 +22,13 @@ class MatchInfo(Component):
|
|||||||
opponent_2_seat: str = ""
|
opponent_2_seat: str = ""
|
||||||
winner: str = ""
|
winner: str = ""
|
||||||
|
|
||||||
|
def calculate_font_size(self, txt: str) -> float:
|
||||||
|
if len(txt) < 14:
|
||||||
|
return 0.9
|
||||||
|
elif len(txt) < 20:
|
||||||
|
return 0.7
|
||||||
|
return 0.6
|
||||||
|
|
||||||
def build(self) -> Component:
|
def build(self) -> Component:
|
||||||
return Rectangle(
|
return Rectangle(
|
||||||
content=Column(
|
content=Column(
|
||||||
@@ -33,13 +40,13 @@ class MatchInfo(Component):
|
|||||||
style=TextStyle(fill=self.session.theme.success_color if self.winner == self.opponent_1 else self.session.theme.background_color),
|
style=TextStyle(fill=self.session.theme.success_color if self.winner == self.opponent_1 else self.session.theme.background_color),
|
||||||
justify="left",
|
justify="left",
|
||||||
margin_right=0.6,
|
margin_right=0.6,
|
||||||
font_size=0.9
|
font_size=self.calculate_font_size(self.opponent_1)
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
text=f"({self.opponent_1_seat})" if self.opponent_1_seat else "Freilos",
|
text=f"({self.opponent_1_seat})" if self.opponent_1_seat else "Freilos",
|
||||||
style=TextStyle(fill=self.session.theme.background_color),
|
style=TextStyle(fill=self.session.theme.background_color),
|
||||||
justify="left",
|
justify="left",
|
||||||
font_size=0.9
|
font_size=self.calculate_font_size(self.opponent_1)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
Spacer(),
|
Spacer(),
|
||||||
@@ -49,13 +56,13 @@ class MatchInfo(Component):
|
|||||||
style=TextStyle(fill=self.session.theme.success_color if self.winner == self.opponent_2 else self.session.theme.background_color),
|
style=TextStyle(fill=self.session.theme.success_color if self.winner == self.opponent_2 else self.session.theme.background_color),
|
||||||
justify="right",
|
justify="right",
|
||||||
margin_right=0.6,
|
margin_right=0.6,
|
||||||
font_size=0.9
|
font_size=self.calculate_font_size(self.opponent_2)
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
text=f"({self.opponent_2_seat})" if self.opponent_2_seat else "Freilos",
|
text=f"({self.opponent_2_seat})" if self.opponent_2_seat else "Freilos",
|
||||||
style=TextStyle(fill=self.session.theme.background_color),
|
style=TextStyle(fill=self.session.theme.background_color),
|
||||||
justify="right",
|
justify="right",
|
||||||
font_size=0.9
|
font_size=self.calculate_font_size(self.opponent_2)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
margin=0.3
|
margin=0.3
|
||||||
|
|||||||
Reference in New Issue
Block a user