[meld] diffgrid: Refactor child allocation to make our variable abuse clearer



commit 8af956b5d81fc92d49c33baa4a27ede9271465f6
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue Oct 28 06:09:44 2014 +1000

    diffgrid: Refactor child allocation to make our variable abuse clearer

 meld/diffgrid.py |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
---
diff --git a/meld/diffgrid.py b/meld/diffgrid.py
index a51071e..a836097 100644
--- a/meld/diffgrid.py
+++ b/meld/diffgrid.py
@@ -184,12 +184,14 @@ class DiffGrid(Gtk.Grid):
                 return
             attach = get_child_attach(child)
             left, top, width, height = attach
-            alloc = self.get_allocation()
-            alloc.x = columns[left]
-            alloc.y = yrows[top]
-            alloc.width = columns[left + width] - columns[left]
-            alloc.height = yrows[top + height] - yrows[top]
-            child.size_allocate(alloc)
+            # This is a copy, and we have to do this because there's no Python
+            # access to Gtk.Allocation.
+            child_alloc = self.get_allocation()
+            child_alloc.x = columns[left]
+            child_alloc.y = yrows[top]
+            child_alloc.width = columns[left + width] - columns[left]
+            child_alloc.height = yrows[top + height] - yrows[top]
+            child.size_allocate(child_alloc)
 
         for child in self.get_children():
             child_allocate(child)


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]