d88c20893dd1 — Alain Leufroy 2 years ago
widget: recompute the main widget orientation only when the screen size changed

There is no need to compute it every time.
1 files changed, 5 insertions(+), 2 deletions(-)

M lairucrem/widgets/mainwidget.py
M lairucrem/widgets/mainwidget.py +5 -2
@@ 130,15 130,18 @@ class packer(delegate_to_widget_mixin('_
 
     def selectable(self):
         return True
-    
+
     def __init__(self, widgets):
         self._orientation = None
         self._widgets = widgets
         self._original_widget = None
+        self._previous_size = None
 
     def render(self, size, focus):
         """render the widget"""
-        self._update_container(size)
+        if self._previous_size != size:
+            self._update_container(size)
+        self._previous_size = size
         return super(packer, self).render(size, focus)
 
     def _update_container(self, size):