[pyatspi2] API changes for out--of-process accessibles, and support ParentOf



commit 57e32728bb1f755b3cd0af2a579e88c61d8e805d
Author: Mike Gorse <mgorse novell com>
Date:   Fri Nov 6 14:43:14 2009 -0500

    API changes for out--of-process accessibles, and support ParentOf
    
    Modified DBus api to return bus names along with object paths to support
    out-of-process children.
    Also, support the new ParentOf relationship.

 pyatspi/accessible.py |   13 ++++++++---
 pyatspi/component.py  |    6 +++-
 pyatspi/relation.py   |   51 ++++++++++++++++++++++++++----------------------
 pyatspi/table.py      |   17 +++++++++++----
 4 files changed, 53 insertions(+), 34 deletions(-)
---
diff --git a/pyatspi/accessible.py b/pyatspi/accessible.py
index fd43faa..b0b5079 100644
--- a/pyatspi/accessible.py
+++ b/pyatspi/accessible.py
@@ -287,8 +287,10 @@ class AccessibleImplCached (AccessibleImpl):
                 return self.cache(self.app_name, self.acc_path)
 
         def getChildAtIndex(self, index):
-                path = self.cached_data.children[index]
-                return self.acc_factory.create_accessible(self._app_name, path, ATSPI_ACCESSIBLE)
+                (name, path) = self.cached_data.children[index]
+                if (name == ""):
+                        name = self._app_name
+                return self.acc_factory.create_accessible(name, path, ATSPI_ACCESSIBLE)
 
         def getRelationSet(self):
                 if self._relation_set is not None:
@@ -328,8 +330,11 @@ class AccessibleImplCached (AccessibleImpl):
                 return self.cached_data.name
 
         def get_parent(self):
-                return self.acc_factory.create_accessible(self._app_name,
-                                                          self.cached_data.parent,
+                [name, path] = self.cached_data.parent
+                if (name == ""):
+                        name = self._app_name
+                return self.acc_factory.create_accessible(name,
+                                                          path,
                                                           ATSPI_ACCESSIBLE)
 
         def get_interfaces (self):
diff --git a/pyatspi/component.py b/pyatspi/component.py
index daba989..10c23b0 100644
--- a/pyatspi/component.py
+++ b/pyatspi/component.py
@@ -100,8 +100,10 @@ class Component(Accessible):
                 specified point.
                 """
                 func = self.get_dbus_method("getAccessibleAtPoint", dbus_interface=ATSPI_COMPONENT)
-                return self.acc_factory.create_accessible(self._app_name,
-                                                          func(x, y, UInt32(coord_type)),
+                (name, path) = func(x, y, UInt32(coord_type))
+                if (name == ""):
+                        name = self._app_name
+                return self.acc_factory.create_accessible(name, path,
                                                           interfaces.ATSPI_ACCESSIBLE)
 
         def getAlpha(self):
diff --git a/pyatspi/relation.py b/pyatspi/relation.py
index bf448fa..23b1235 100644
--- a/pyatspi/relation.py
+++ b/pyatspi/relation.py
@@ -34,39 +34,41 @@ class RelationType(_Enum):
                 5:'RELATION_MEMBER_OF',
                 6:'RELATION_TOOLTIP_FOR',
                 7:'RELATION_NODE_CHILD_OF',
-                8:'RELATION_EXTENDED',
-                9:'RELATION_FLOWS_TO',
-                10:'RELATION_FLOWS_FROM',
-                11:'RELATION_SUBWINDOW_OF',
-                12:'RELATION_EMBEDS',
-                13:'RELATION_EMBEDDED_BY',
-                14:'RELATION_POPUP_FOR',
-                15:'RELATION_PARENT_WINDOW_OF',
-                16:'RELATION_DESCRIPTION_FOR',
-                17:'RELATION_DESCRIBED_BY',
-                18:'RELATION_LAST_DEFINED',
+                8:'RELATION_NODE_PARENT_OF',
+                9:'RELATION_EXTENDED',
+                10:'RELATION_FLOWS_TO',
+                11:'RELATION_FLOWS_FROM',
+                12:'RELATION_SUBWINDOW_OF',
+                13:'RELATION_EMBEDS',
+                14:'RELATION_EMBEDDED_BY',
+                15:'RELATION_POPUP_FOR',
+                16:'RELATION_PARENT_WINDOW_OF',
+                17:'RELATION_DESCRIPTION_FOR',
+                18:'RELATION_DESCRIBED_BY',
+                19:'RELATION_LAST_DEFINED',
         }
 
 #------------------------------------------------------------------------------
 
 RELATION_CONTROLLED_BY = RelationType(4)
 RELATION_CONTROLLER_FOR = RelationType(3)
-RELATION_DESCRIBED_BY = RelationType(17)
-RELATION_DESCRIPTION_FOR = RelationType(16)
-RELATION_EMBEDDED_BY = RelationType(13)
-RELATION_EMBEDS = RelationType(12)
-RELATION_EXTENDED = RelationType(8)
-RELATION_FLOWS_FROM = RelationType(10)
-RELATION_FLOWS_TO = RelationType(9)
+RELATION_DESCRIBED_BY = RelationType(18)
+RELATION_DESCRIPTION_FOR = RelationType(17)
+RELATION_EMBEDDED_BY = RelationType(14)
+RELATION_EMBEDS = RelationType(13)
+RELATION_EXTENDED = RelationType(9)
+RELATION_FLOWS_FROM = RelationType(11)
+RELATION_FLOWS_TO = RelationType(10)
 RELATION_LABELLED_BY = RelationType(2)
 RELATION_LABEL_FOR = RelationType(1)
 RELATION_LAST_DEFINED = RelationType(18)
 RELATION_MEMBER_OF = RelationType(5)
 RELATION_NODE_CHILD_OF = RelationType(7)
+RELATION_NODE_PARENT_OF = RelationType(8)
 RELATION_NULL = RelationType(0)
-RELATION_PARENT_WINDOW_OF = RelationType(15)
-RELATION_POPUP_FOR = RelationType(14)
-RELATION_SUBWINDOW_OF = RelationType(11)
+RELATION_PARENT_WINDOW_OF = RelationType(16)
+RELATION_POPUP_FOR = RelationType(15)
+RELATION_SUBWINDOW_OF = RelationType(12)
 RELATION_TOOLTIP_FOR = RelationType(6)
 
 #------------------------------------------------------------------------------
@@ -130,8 +132,11 @@ class Relation(object):
                 e.g. the Object at index i in the list of Objects having the
                 specified relationship to this Accessible.
                 """
-                return self._cache.create_accessible(self._app_name,
-                                                     self._objects[index],
+                (name, path) = self._objects[index]
+                if (name == ""):
+                        name = self._app_name
+                return self._cache.create_accessible(name,
+                                                     path,
                                                      interfaces.ATSPI_ACCESSIBLE)
 
 #END----------------------------------------------------------------------------
diff --git a/pyatspi/table.py b/pyatspi/table.py
index 49c80e5..778a2d3 100644
--- a/pyatspi/table.py
+++ b/pyatspi/table.py
@@ -72,7 +72,10 @@ class Table(Accessible):
                 cell.
                 """
                 func = self.get_dbus_method("getAccessibleAt", dbus_interface=ATSPI_TABLE)
-                return self.acc_factory.create_accessible(self._app_name, func(row, column),
+                (name, path) = func(row, column)
+                if (name == ""):
+                        name = self._app_name
+                return self.acc_factory.create_accessible(name, path,
                                                           interfaces.ATSPI_ACCESSIBLE)
 
         def getColumnAtIndex(self, index):
@@ -309,8 +312,10 @@ class Table(Accessible):
                 return func(row)
 
         def get_caption(self):
-                accessible = self._pgetter(self._dbus_interface, "caption")
-                return self.acc_factory.create_accessible(self._app_name, accessible,
+                (name, path) = self._pgetter(self._dbus_interface, "caption")
+                if (name == ""):
+                        name = self._app_name
+                return self.acc_factory.create_accessible(name, path,
                                                           interfaces.ATSPI_ACCESSIBLE)
         _captionDoc = \
                 """
@@ -358,8 +363,10 @@ class Table(Accessible):
         nSelectedRows = property(fget=get_nSelectedRows, doc=_nSelectedRowsDoc)
 
         def get_summary(self):
-                accessible = self._pgetter(self._dbus_interface, "summary")
-                return self.acc_factory.create_accessible(self._app_name, accessible,
+                (name, path) = self._pgetter(self._dbus_interface, "summary")
+                if (name == ""):
+                        name = self._app_name
+                return self.acc_factory.create_accessible(name, path,
                                                           interfaces.ATSPI_ACCESSIBLE)
         _summaryDoc = \
                 """



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