[pygobject] [gi] dir() now works for modules



commit f6386a6e0d225c83cdbe1add4c4d3ea51d3ec2f0
Author: Deepankar Sharma <deepankar sharma gmail com>
Date:   Wed Oct 27 18:28:11 2010 -0400

    [gi] dir() now works for modules
    
    https://bugzilla.gnome.org/show_bug.cgi?id=625093

 gi/module.py |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/gi/module.py b/gi/module.py
index d1aadc2..0f21bed 100644
--- a/gi/module.py
+++ b/gi/module.py
@@ -173,6 +173,9 @@ class IntrospectionModule(object):
         path = repository.get_typelib_path(self._namespace)
         return "<IntrospectionModule %r from %r>" % (self._namespace, path)
 
+    def __dir__ (self):
+        attribs_list = repository.get_infos(self._namespace)
+        return list(map(lambda x: x.get_name(), attribs_list))
 
 class DynamicGObjectModule(IntrospectionModule):
     """Wrapper for the GObject module
@@ -235,3 +238,8 @@ class DynamicModule(object):
                 return getattr(self._overrides_module, name, None)
 
         return getattr(self.introspection_module, name)
+
+    def __dir__ (self):
+        repository.require(self._namespace, self._version)
+        attribs_list = repository.get_infos(self._namespace)
+        return list(map(lambda x: x.get_name(), attribs_list))



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