From 05a00c9dcc3ee9a38190f590c1a9a74787bff340 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 23 Sep 2021 14:17:08 -0400 Subject: [PATCH] Force min pnl label width to avoid resizes on magnitude steps --- piker/ui/_forms.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/piker/ui/_forms.py b/piker/ui/_forms.py index 993073a9..45d68317 100644 --- a/piker/ui/_forms.py +++ b/piker/ui/_forms.py @@ -653,11 +653,21 @@ def mk_fill_status_bar( font_size=bar_label_font_size, font_color='gunmetal', ) + # size according to dpi scaled fonted contents to avoid + # resizes on magnitude changes (eg. 9 -> 10 %) + min_w = _font.boundingRect('1000.0M% pnl').width() + left_label.setMinimumWidth(min_w) + left_label.resize( + min_w, + left_label.size().height(), + ) bar_labels_lhs.addSpacing(5/8 * bar_h) bar_labels_lhs.addWidget( left_label, - alignment=Qt.AlignLeft | Qt.AlignTop, + # XXX: doesn't seem to actually push up against + # the status bar? + alignment=Qt.AlignRight | Qt.AlignTop, ) # this hbox is added as a layout by the paner maker/caller