[pygi] Correctly identify at creation time:
- From: Tomeu Vizoso <tomeuv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pygi] Correctly identify at creation time:
- Date: Tue, 25 May 2010 14:47:50 +0000 (UTC)
commit 097b92983b7a322c58fecb1e691ba6ddf5035548
Author: Tomeu Vizoso <tomeu vizoso collabora co uk>
Date: Tue May 25 14:17:13 2010 +0200
Correctly identify at creation time:
* if the class is defined in python -> hook up vfuncs
* if the class wraps a type from a .typelib -> set atributes
* else (GLocalFile) -> do nothing
https://bugzilla.gnome.org/show_bug.cgi?id=619604
gi/types.py | 15 +++++++++++----
1 files changed, 11 insertions(+), 4 deletions(-)
---
diff --git a/gi/types.py b/gi/types.py
index d96c510..8ac9cab 100644
--- a/gi/types.py
+++ b/gi/types.py
@@ -123,8 +123,17 @@ class GObjectMeta(gobject.GObjectMeta, MetaClassHelper):
def __init__(cls, name, bases, dict_):
super(GObjectMeta, cls).__init__(name, bases, dict_)
- # Avoid touching anything else than the base class.
- if cls.__info__.get_g_type().pytype is None:
+ is_gi_defined = False
+ if cls.__module__ == 'gi.repository.' + cls.__info__.get_namespace():
+ is_gi_defined = True
+
+ is_python_defined = False
+ if not is_gi_defined and cls.__module__ != GObjectMeta.__module__:
+ is_python_defined = True
+
+ if is_python_defined:
+ cls._setup_vfuncs()
+ elif is_gi_defined:
cls._setup_methods()
cls._setup_constants()
@@ -134,8 +143,6 @@ class GObjectMeta(gobject.GObjectMeta, MetaClassHelper):
set_object_has_new_constructor(cls.__info__.get_g_type())
elif isinstance(cls.__info__, InterfaceInfo):
register_interface_info(cls.__info__.get_g_type())
- else:
- cls._setup_vfuncs()
class StructMeta(type, MetaClassHelper):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]