Use a `unit_prefix: str` (like u or $) on health bar

distribute_dis
Tyler Goodlet 2024-05-01 14:09:39 -04:00
parent 3d03781810
commit 821e73a409
2 changed files with 9 additions and 4 deletions

View File

@ -703,7 +703,8 @@ def mk_fill_status_bar(
)
bottom_label = form.add_field_label(
'x: {step_size}',
# 'x: {step_size}',
'{unit_prefix}: {step_size}',
font_size=bar_label_font_size,
font_color='gunmetal',
)

View File

@ -344,7 +344,10 @@ class SettingsPane:
dsize = tracker.live_pp.dsize
# READ out settings and update the status UI / settings widgets
suffix = {'currency': ' $', 'units': ' u'}[alloc.size_unit]
unit_char: str = {
'currency': '$',
'units': 'u',
}[alloc.size_unit]
size_unit, limit = alloc.limit_info()
step_size, currency_per_slot = alloc.step_sizes()
@ -358,10 +361,11 @@ class SettingsPane:
self.apply_setting('limit', limit)
self.step_label.format(
step_size=str(humanize(step_size)) + suffix
unit_prefix=unit_char,
step_size=str(humanize(step_size))
)
self.limit_label.format(
limit=str(humanize(limit)) + suffix
limit=f'{unit_char}: {str(humanize(limit))}'
)
# update size unit in UI