From 37719efe37f758a663333f18a85a9a85db93f170 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 5 Sep 2021 21:23:35 -0400 Subject: [PATCH] Scale status bar labels to actual bar height --- piker/ui/_forms.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/piker/ui/_forms.py b/piker/ui/_forms.py index 3e016fc5..b504a408 100644 --- a/piker/ui/_forms.py +++ b/piker/ui/_forms.py @@ -307,7 +307,7 @@ class FieldsForm(QWidget): # that size on each item... values.sort() br = _font.boundingRect(str(values[-1])) - w, h = br.width(), br.height() + _, h = br.width(), br.height() # TODO: something better then this monkey patch # view._max_item_size = w, h @@ -537,6 +537,7 @@ def mk_fill_status_bar( # bracket_val = 0.375 * 0.666 * w # indent = bracket_val / (1 + 5/8) + # TODO: calc this height from the ``ChartnPane`` chart_h = round(parent_pane.height() * 5/8) bar_h = chart_h * 0.375 @@ -546,8 +547,7 @@ def mk_fill_status_bar( label_font = DpiAwareFont() label_font._set_qfont_px_size(bar_label_font_size) br = label_font.boundingRect(f'{3.32:.1f}% port') - w, h = br.width(), br.height() - text_w = 8/3 * w + _, h = br.width(), br.height() # text_w = 8/3 * w # PnL on lhs @@ -560,7 +560,7 @@ def mk_fill_status_bar( font_color='gunmetal', ) - bar_labels_lhs.addSpacing(5/8 * text_w) + bar_labels_lhs.addSpacing(5/8 * bar_h) bar_labels_lhs.addWidget( left_label, alignment=Qt.AlignLeft | Qt.AlignTop, @@ -600,7 +600,6 @@ def mk_fill_status_bar( bar = FillStatusBar( approx_height_px=bar_h, - # approx_height_px=8/3 * w, width_px=h * (1 + 1/6), font_size=form._font_size, parent=form