From a8d7e91e17419e1b365b0c8cc43f5defdf674291 Mon Sep 17 00:00:00 2001 From: Florian Bruhin Date: Tue, 14 Jun 2022 09:43:14 +0200 Subject: Slightly clean up _draw_widgets --- qutebrowser/mainwindow/statusbar/bar.py | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/qutebrowser/mainwindow/statusbar/bar.py b/qutebrowser/mainwindow/statusbar/bar.py index aaaded938..ff4822f1e 100644 --- a/qutebrowser/mainwindow/statusbar/bar.py +++ b/qutebrowser/mainwindow/statusbar/bar.py @@ -251,28 +251,29 @@ class StatusBar(QWidget): # Read the list and set widgets accordingly for segment in config.val.statusbar.widgets: - cur_widget = self._get_widget_from_config(segment) - self._hbox.addWidget(cur_widget) + widget = self._get_widget_from_config(segment) + self._hbox.addWidget(widget) if segment == 'scroll_raw': - cur_widget.set_raw() + widget.set_raw() elif segment in ('history', 'progress'): - cur_widget.enabled = True + widget.enabled = True if tab: - cur_widget.on_tab_changed(tab) + widget.on_tab_changed(tab) - # Do not call .show() for these widgets. + # Do not call .show() for these widgets. They are not always shown, and + # dynamically show/hide themselves in their on_tab_changed() methods. continue elif segment.startswith('text:'): - cur_widget.setText(segment.split(':', maxsplit=1)[1]) + widget.setText(segment.split(':', maxsplit=1)[1]) elif segment.startswith('clock:') or segment == 'clock': split_segment = segment.split(':', maxsplit=1) if len(split_segment) == 2 and split_segment[1]: - cur_widget.format = split_segment[1] + widget.format = split_segment[1] else: - cur_widget.format = '%X' + widget.format = '%X' - cur_widget.show() + widget.show() def _clear_widgets(self): """Clear widgets before redrawing them.""" -- cgit v1.2.3-54-g00ecf