summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Bruhin <me@the-compiler.org>2018-09-30 21:53:19 +0200
committerFlorian Bruhin <me@the-compiler.org>2018-09-30 21:53:19 +0200
commit8d489a40e46f95af252cb8c5bd3d2046787a6f9c (patch)
tree12ede2df26f630d9b0aae9308cf35fa1f6634192
parentb8be4e5915517171a53ecca3d56c1772327c8b40 (diff)
downloadqutebrowser-8d489a40e46f95af252cb8c5bd3d2046787a6f9c.tar.gz
qutebrowser-8d489a40e46f95af252cb8c5bd3d2046787a6f9c.zip
Simplify toggle_visibility
-rw-r--r--qutebrowser/mainwindow/tabwidget.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/qutebrowser/mainwindow/tabwidget.py b/qutebrowser/mainwindow/tabwidget.py
index 5a70304db..e221a8c24 100644
--- a/qutebrowser/mainwindow/tabwidget.py
+++ b/qutebrowser/mainwindow/tabwidget.py
@@ -216,7 +216,7 @@ class TabWidget(QTabWidget):
return fields
@contextlib.contextmanager
- def _toggle_visibility(self, force_toggle=False):
+ def _toggle_visibility(self):
"""Toggle visibility while running.
Every single call to setTabText calls the size hinting functions for
@@ -224,18 +224,15 @@ class TabWidget(QTabWidget):
the tab's titles, we can delay this processing by making the tab
non-visible. To avoid flickering, disable repaint updates whlie we
work.
-
- Args:
- force_toggle: Whether to always force the toggle, or only do it
- if we have enough tabs for it to matter
"""
- if self.count() > 10:
- force_toggle = True
- if force_toggle:
+ toggle = self.count() > 10
+ if toggle:
self.setUpdatesEnabled(False)
self.setVisible(False)
+
yield
- if force_toggle:
+
+ if toggle:
self.setVisible(True)
self.setUpdatesEnabled(True)