stupid shit
This commit is contained in:
@@ -22,6 +22,13 @@ class MatchInfo(Component):
|
||||
opponent_2_seat: 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:
|
||||
return Rectangle(
|
||||
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),
|
||||
justify="left",
|
||||
margin_right=0.6,
|
||||
font_size=0.9
|
||||
font_size=self.calculate_font_size(self.opponent_1)
|
||||
),
|
||||
Text(
|
||||
text=f"({self.opponent_1_seat})" if self.opponent_1_seat else "Freilos",
|
||||
style=TextStyle(fill=self.session.theme.background_color),
|
||||
justify="left",
|
||||
font_size=0.9
|
||||
font_size=self.calculate_font_size(self.opponent_1)
|
||||
)
|
||||
),
|
||||
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),
|
||||
justify="right",
|
||||
margin_right=0.6,
|
||||
font_size=0.9
|
||||
font_size=self.calculate_font_size(self.opponent_2)
|
||||
),
|
||||
Text(
|
||||
text=f"({self.opponent_2_seat})" if self.opponent_2_seat else "Freilos",
|
||||
style=TextStyle(fill=self.session.theme.background_color),
|
||||
justify="right",
|
||||
font_size=0.9
|
||||
font_size=self.calculate_font_size(self.opponent_2)
|
||||
)
|
||||
),
|
||||
margin=0.3
|
||||
|
||||
Reference in New Issue
Block a user