[meld] diffgrid: Simplify and speed up our child property requests



commit 2a15af055f6f91f0c53705340d43f41bbe96667a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Sun Sep 25 10:52:16 2016 +1000

    diffgrid: Simplify and speed up our child property requests

 meld/diffgrid.py |   18 ++----------------
 1 files changed, 2 insertions(+), 16 deletions(-)
---
diff --git a/meld/diffgrid.py b/meld/diffgrid.py
index ae0463e..71ee7b5 100644
--- a/meld/diffgrid.py
+++ b/meld/diffgrid.py
@@ -166,25 +166,11 @@ class DiffGrid(Gtk.Grid):
             allocation.x, wmap1, wpane1, wlink1, wpane2, wlink2, wpane3, wmap2)
         columns = [sum(wcols[:i + 1]) for i in range(len(wcols))]
 
-        def get_child_prop_int(child, name):
-            prop = GObject.Value(int)
-            self.child_get_property(child, name, prop)
-            return prop.get_int()
-
-        def get_child_attach(child):
-            attach = [
-                get_child_prop_int(child, 'left-attach'),
-                get_child_prop_int(child, 'top-attach'),
-                get_child_prop_int(child, 'width'),
-                get_child_prop_int(child, 'height'),
-            ]
-            return attach
-
         def child_allocate(child):
             if not child.get_visible():
                 return
-            attach = get_child_attach(child)
-            left, top, width, height = attach
+            left, top, width, height = self.child_get(
+                child, 'left-attach', 'top-attach', 'width', 'height')
             # This is a copy, and we have to do this because there's no Python
             # access to Gtk.Allocation.
             child_alloc = self.get_allocation()


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