From 821e73a4095df07b4fe738e3db6c14c26a0424e8 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Wed, 1 May 2024 14:09:39 -0400 Subject: [PATCH] Use a `unit_prefix: str` (like u or $) on health bar --- piker/ui/_forms.py | 3 ++- piker/ui/_position.py | 10 +++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/piker/ui/_forms.py b/piker/ui/_forms.py index d3f8da73..de64747e 100644 --- a/piker/ui/_forms.py +++ b/piker/ui/_forms.py @@ -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', ) diff --git a/piker/ui/_position.py b/piker/ui/_position.py index 1e4895f9..e071ecd9 100644 --- a/piker/ui/_position.py +++ b/piker/ui/_position.py @@ -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