[d-feet] Fix Annotation handling



commit 935214311868c66aea5d93d96a5bbca211b7c30d
Author: Thomas Bechtold <thomasbechtold jpberlin de>
Date:   Sun Jun 9 10:22:20 2013 +0200

    Fix Annotation handling
    
    https://bugzilla.gnome.org/show_bug.cgi?id=701841

 src/dfeet/introspection.py        |    6 ++++--
 src/dfeet/introspection_helper.py |   19 +++++++++++++++++++
 2 files changed, 23 insertions(+), 2 deletions(-)
---
diff --git a/src/dfeet/introspection.py b/src/dfeet/introspection.py
index 52a8b7d..493da07 100644
--- a/src/dfeet/introspection.py
+++ b/src/dfeet/introspection.py
@@ -11,6 +11,7 @@ from dfeet.introspection_helper import DBusInterface
 from dfeet.introspection_helper import DBusProperty
 from dfeet.introspection_helper import DBusSignal
 from dfeet.introspection_helper import DBusMethod
+from dfeet.introspection_helper import DBusAnnotation
 
 
 class AddressInfo():
@@ -217,14 +218,15 @@ class AddressInfo():
                                 self.__treemodel.append(
                                     iface_properties_iter,
                                     ["%s" % property_obj.markup_str, property_obj])
-                        #interface annotations #FIXME: add Annotation object!!!
+                        #interface annotations
                         if len(iface.annotations) > 0:
                             iface_annotations_iter = self.__treemodel.append(
                                 iface_iter, ["<b>Annotations</b>", None])
                             for iface_annotation in iface.annotations:
+                                annotation_obj = DBusAnnotation(iface_obj, iface_annotation)
                                 self.__treemodel.append(
                                     iface_annotations_iter,
-                                    ["%s" % iface_annotation.name, iface_annotation])
+                                    ["%s" % (annotation_obj.markup_str), annotation_obj])
 
             #are more nodes left?
             if len(node_info.nodes) > 0:
diff --git a/src/dfeet/introspection_helper.py b/src/dfeet/introspection_helper.py
index 3341dd2..20d4506 100644
--- a/src/dfeet/introspection_helper.py
+++ b/src/dfeet/introspection_helper.py
@@ -221,3 +221,22 @@ class DBusMethod(DBusInterface):
     @property
     def out_args_markup_str(self):
         return self.__args_markup_str(self.out_args)
+
+
+class DBusAnnotation(DBusInterface):
+    """object to represent a DBus Annotation"""
+    def __init__(self, dbus_iface_obj, annotation_info):
+        DBusInterface.__init__(self, dbus_iface_obj,
+                               dbus_iface_obj.iface_info)
+        self.__annotation_info = annotation_info  # Gio.GDBusAnnotationInfo object
+
+    def __repr__(self):
+        return "%s: %s" % (self.annotation_info.key, self.annotation_info.value)
+
+    @property
+    def annotation_info(self):
+        return self.__annotation_info
+
+    @property
+    def markup_str(self):
+        return "%s: %s" % (self.annotation_info.key, self.annotation_info.value)


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