changeset 170:f4522b7c3318

widgets handler: use widget's top and right
author Goffi <goffi@goffi.org>
date Sun, 29 Apr 2018 12:23:52 +0200
parents 6a288d4a493f
children 27b4ceb977c7
files cagou/core/widgets_handler.py
diffstat 1 files changed, 9 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/cagou/core/widgets_handler.py	Sat Apr 28 20:19:53 2018 +0200
+++ b/cagou/core/widgets_handler.py	Sun Apr 29 12:23:52 2018 +0200
@@ -400,35 +400,31 @@
         return G.host.default_wid['factory'](G.host.default_wid, None, None)
 
     def do_layout(self, *args):
-        x, y = self.pos
-        width, height = self.width, self.height
-        end_x, end_y = x + width, y + height
         for child in self.children:
             # XXX: left must be calculated before right and bottom before top
             #      because they are the pos, and are used to caculate size (right and top)
             # left
             left = child._left_wid
-            left_end_x = x-1 if left is None else left.x + left.width
+            left_end_x = self.x-1 if left is None else left.right
             if child.x != left_end_x + 1 and child._split == "None":
                 child.x = left_end_x + 1
             # right
             right = child._right_wid
-            right_x = end_x + 1 if right is None else right.x
-            if child.x + child.width != right_x - 1:
+            right_x = self.right + 1 if right is None else right.x
+            if child.right != right_x - 1:
                 child.width = right_x - child.x - 1
             # bottom
             bottom = child._bottom_wid
             if bottom is None:
-                if child.y != y:
-                    child.y = y
+                if child.y != self.y:
+                    child.y = self.y
             else:
-                bottom_end_y = bottom.y + bottom.height
-                if child.y != bottom_end_y + 1:
-                    child.y = bottom_end_y + 1
+                if child.y != bottom.top + 1:
+                    child.y = bottom.top + 1
             # top
             top = child._top_wid
-            top_y = end_y+1 if top is None else top.y
-            if child.y + child.height != top_y - 1:
+            top_y = self.top+1 if top is None else top.y
+            if child.top != top_y - 1:
                 if child._split == "None":
                     child.height = top_y - child.y - 1