summaryrefslogtreecommitdiff
path: root/gtk/_lazyutils.py
diff options
context:
space:
mode:
authorJohan Dahlin <johan@src.gnome.org>2006-07-23 15:02:18 +0000
committerJohan Dahlin <johan@src.gnome.org>2006-07-23 15:02:18 +0000
commit89d569d07deebc33e9e7a3ca4251056af38d5cbd (patch)
tree33d2243283b6841d36ba2b2b17784e624e2c259d /gtk/_lazyutils.py
parent30510d904960bef4c9382aac264b052739b4b237 (diff)
downloadpygtk-89d569d07deebc33e9e7a3ca4251056af38d5cbd.tar.gz
Revert dynamic namespaces, it is not possible to solve it without breaking
* Makefile.am: * gtk/Makefile.am: * gtk/__init__.py: * gtk/_gtk.py: * gtk/_lazyutils.py: * gtk/deprecation.py: * gtk/gtk.override: * gtk/gtkmodule.c: (init_gtk): * gtk/libglademodule.c: (initglade): Revert dynamic namespaces, it is not possible to solve it without breaking the ABI.
Diffstat (limited to 'gtk/_lazyutils.py')
-rw-r--r--gtk/_lazyutils.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/gtk/_lazyutils.py b/gtk/_lazyutils.py
index cf40199c..2bc3aa60 100644
--- a/gtk/_lazyutils.py
+++ b/gtk/_lazyutils.py
@@ -33,7 +33,18 @@ class LazyModule(object):
sys.modules[self._modname] = module
return getattr(module, attr)
-_marker = object()
+class _NotLoadedMarker:
+ pass
+_marker = _NotLoadedMarker()
+
+class LazyDict(dict):
+ def __init__(self, module):
+ self._module = module
+ dict.__init__(self)
+
+ def __getitem__(self, name):
+ print name
+ return getattr(self._module, name)
class LazyNamespace(ModuleType):
def __init__(self, module, locals):
@@ -47,7 +58,7 @@ class LazyNamespace(ModuleType):
for symbol in module._get_symbol_names():
lazy_symbols[symbol] = ns[symbol] = _marker
- ns.update(__dict__=ns,
+ ns.update(__dict__=LazyDict(self),
__bases__=(ModuleType,),
add_submodule=self.add_submodule)