Skip to content

Commit 7da55ac

Browse files
zhaohongxuanKugin
authored andcommitted
feat: adding illustration for special tracks (yihong0618#705)
* feat: add illustration for special tracks update * format special distance
1 parent 1910660 commit 7da55ac

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

run_page/gpxtrackposter/poster.py

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(self):
5252
"special": "#FFFF00",
5353
"track": "#4DD2FF",
5454
}
55-
self.special_distance = {"special_distance1": "10", "special_distance2": "20"}
55+
self.special_distance = {"special_distance": 10, "special_distance2": 20}
5656
self.width = 200
5757
self.height = 300
5858
self.years = None
@@ -155,6 +155,9 @@ def __draw_footer(self, d):
155155
value_style = "font-size:9px; font-family:Arial"
156156
small_value_style = "font-size:3px; font-family:Arial"
157157

158+
special_distance1 = self.special_distance["special_distance"]
159+
special_distance2 = self.special_distance["special_distance2"]
160+
158161
(
159162
total_length,
160163
average_length,
@@ -179,6 +182,38 @@ def __draw_footer(self, d):
179182
style=value_style,
180183
)
181184
)
185+
186+
d.add(
187+
d.text(
188+
self.trans("SPECIAL TRACKS"),
189+
insert=(65, self.height - 20),
190+
fill=text_color,
191+
style=header_style,
192+
)
193+
)
194+
195+
d.add(d.rect((65, self.height - 17), (2.6, 2.6), fill=self.colors["special"]))
196+
197+
d.add(
198+
d.text(
199+
f"Over {special_distance1:.1f} km",
200+
insert=(70, self.height - 14.5),
201+
fill=text_color,
202+
style=small_value_style,
203+
)
204+
)
205+
206+
d.add(d.rect((65, self.height - 13), (2.6, 2.6), fill=self.colors["special2"]))
207+
208+
d.add(
209+
d.text(
210+
f"Over {special_distance2:.1f} km",
211+
insert=(70, self.height - 10.5),
212+
fill=text_color,
213+
style=small_value_style,
214+
)
215+
)
216+
182217
d.add(
183218
d.text(
184219
self.trans("STATISTICS"),

0 commit comments

Comments
 (0)