From 5e947e788734a26bfe97b758dafc55165fdea573 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 9 Sep 2021 10:34:14 -0400 Subject: [PATCH] Maybe show account names on order lines --- piker/ui/_lines.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/piker/ui/_lines.py b/piker/ui/_lines.py index 5572e3c2..acd1e88a 100644 --- a/piker/ui/_lines.py +++ b/piker/ui/_lines.py @@ -665,7 +665,7 @@ def order_line( # display the order pos size, which is some multiple # of the user defined base unit size fmt_str=( - '{size:.{size_digits}f}u{fiat_text}' + '{account_text}{size:.{size_digits}f}u{fiat_text}' ), color=line.color, ) @@ -679,13 +679,23 @@ def order_line( if not fiat_size: return '' - return f' -> ${humanize(fiat_size)}' + return f' ~ ${humanize(fiat_size)}' + + def maybe_show_account_name(fields: dict) -> str: + account = fields.get('account') + if not account: + return '' + + return f'{account}: ' + label.fields = { 'size': size, 'size_digits': 0, 'fiat_size': None, 'fiat_text': maybe_show_fiat_text, + 'account': None, + 'account_text': maybe_show_account_name, } label.orient_v = orient_v