[pybank] Only set up the wrapper methods and fields in their base classes



commit 639260dfc0dc25f2406fe3c493f958ef4bfe9272
Author: Tomeu Vizoso <tomeu sugarlabs org>
Date:   Tue May 26 14:32:34 2009 +0200

    Only set up the wrapper methods and fields in their base classes
---
 bank/bank-info.c |    4 ++--
 bank/btypes.py   |   14 ++++++++------
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/bank/bank-info.c b/bank/bank-info.c
index 49341c0..c0d28ed 100644
--- a/bank/bank-info.c
+++ b/bank/bank-info.c
@@ -373,7 +373,7 @@ _wrap_g_function_info_invoke(PyGIBaseInfo *self, PyObject *args)
             expected_out_argc += 1;
         g_base_info_unref( (GIBaseInfo*) arg_info);
     }
-
+    /*
     g_debug("Call is to %s %s.%s with expected: %d in args, %d out args, %d total args",
                       is_method ? "method" : "function",
                       g_base_info_get_namespace( (GIBaseInfo*) self->info),
@@ -381,7 +381,7 @@ _wrap_g_function_info_invoke(PyGIBaseInfo *self, PyObject *args)
                       expected_in_argc,
                       expected_out_argc,
                       n_args);
-
+    */
     if (is_method)
         expected_in_argc += 1;
 
diff --git a/bank/btypes.py b/bank/btypes.py
index 470ca22..38f16bd 100644
--- a/bank/btypes.py
+++ b/bank/btypes.py
@@ -189,15 +189,17 @@ class PyBankMeta(gobject.GObjectMeta):
     def __init__(cls, name, bases, dict_):
         gobject.GObjectMeta.__init__(cls, name, bases, dict_)
 
-        needs_constructor = not '__init__' in dict_
-        cls._setup_methods(needs_constructor)
-
-        if hasattr(cls.__info__, 'getFields'):
-            cls._setup_fields()
-
         if hasattr(cls, '__gtype__'):
             repo.setObjectHasNewConstructor(cls.__gtype__)
 
+        # Only set up the wrapper methods and fields in their base classes
+        if name == cls.__info__.getName():
+            needs_constructor = not '__init__' in dict_
+            cls._setup_methods(needs_constructor)
+
+            if hasattr(cls.__info__, 'getFields'):
+                cls._setup_fields()
+
     def _setup_methods(cls, needs_constructor):
         info = cls.__info__
         constructors = []



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