diff options
author | Florian Bruhin <me@the-compiler.org> | 2022-06-14 09:43:14 +0200 |
---|---|---|
committer | Florian Bruhin <me@the-compiler.org> | 2022-06-14 09:43:14 +0200 |
commit | a8d7e91e17419e1b365b0c8cc43f5defdf674291 (patch) | |
tree | 3be2af9d7261046b0940c1616fd67f177fb947ac | |
parent | 1bca8f2763591d8eae10d08a933b1e5ec5a3536f (diff) | |
download | qutebrowser-a8d7e91e17419e1b365b0c8cc43f5defdf674291.tar.gz qutebrowser-a8d7e91e17419e1b365b0c8cc43f5defdf674291.zip |
Slightly clean up _draw_widgets
-rw-r--r-- | qutebrowser/mainwindow/statusbar/bar.py | 21 |
1 files 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.""" |