Add MainWindow._update_overlay_geometries()
This commit is contained in:
parent
2b46228e3d
commit
a006ecffec
@ -217,18 +217,13 @@ class MainWindow(QWidget):
|
|||||||
def _add_overlay(self, widget, signal, *, centered=False, padding=0):
|
def _add_overlay(self, widget, signal, *, centered=False, padding=0):
|
||||||
self._overlays.append((widget, signal, centered, padding))
|
self._overlays.append((widget, signal, centered, padding))
|
||||||
|
|
||||||
def _update_overlay_geometry(self, widget=None, centered=None, padding=0):
|
def _update_overlay_geometries(self):
|
||||||
"""Reposition/resize the given overlay.
|
"""Update the size/position of all overlays."""
|
||||||
|
|
||||||
If no widget is given, reposition/resize all overlays.
|
|
||||||
"""
|
|
||||||
if widget is None:
|
|
||||||
for w, _signal, centered, padding in self._overlays:
|
for w, _signal, centered, padding in self._overlays:
|
||||||
self._update_overlay_geometry(w, centered, padding)
|
self._update_overlay_geometry(w, centered, padding)
|
||||||
return
|
|
||||||
|
|
||||||
assert centered is not None
|
|
||||||
|
|
||||||
|
def _update_overlay_geometry(self, widget, centered, padding):
|
||||||
|
"""Reposition/resize the given overlay."""
|
||||||
if not widget.isVisible():
|
if not widget.isVisible():
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -298,12 +293,12 @@ class MainWindow(QWidget):
|
|||||||
if section != 'ui':
|
if section != 'ui':
|
||||||
return
|
return
|
||||||
if option == 'statusbar-padding':
|
if option == 'statusbar-padding':
|
||||||
self._update_overlay_geometry()
|
self._update_overlay_geometries()
|
||||||
elif option == 'downloads-position':
|
elif option == 'downloads-position':
|
||||||
self._add_widgets()
|
self._add_widgets()
|
||||||
elif option == 'status-position':
|
elif option == 'status-position':
|
||||||
self._add_widgets()
|
self._add_widgets()
|
||||||
self._update_overlay_geometry()
|
self._update_overlay_geometries()
|
||||||
|
|
||||||
def _add_widgets(self):
|
def _add_widgets(self):
|
||||||
"""Add or readd all widgets to the VBox."""
|
"""Add or readd all widgets to the VBox."""
|
||||||
@ -370,7 +365,7 @@ class MainWindow(QWidget):
|
|||||||
signal.connect(
|
signal.connect(
|
||||||
functools.partial(self._update_overlay_geometry, widget,
|
functools.partial(self._update_overlay_geometry, widget,
|
||||||
centered, padding))
|
centered, padding))
|
||||||
self._update_overlay_geometry(widget, centered)
|
self._update_overlay_geometry(widget, centered, padding)
|
||||||
|
|
||||||
def _set_default_geometry(self):
|
def _set_default_geometry(self):
|
||||||
"""Set some sensible default geometry."""
|
"""Set some sensible default geometry."""
|
||||||
@ -472,7 +467,7 @@ class MainWindow(QWidget):
|
|||||||
e: The QResizeEvent
|
e: The QResizeEvent
|
||||||
"""
|
"""
|
||||||
super().resizeEvent(e)
|
super().resizeEvent(e)
|
||||||
self._update_overlay_geometry()
|
self._update_overlay_geometries()
|
||||||
self._downloadview.updateGeometry()
|
self._downloadview.updateGeometry()
|
||||||
self.tabbed_browser.tabBar().refresh()
|
self.tabbed_browser.tabBar().refresh()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user