[pyatspi2] More event ordering and ToolkitName fixes



commit 121e8cd3be11dd761444979f5fac87c52b7180f7
Author: Mike Gorse <mgorse novell com>
Date:   Tue Apr 6 16:33:50 2010 -0400

    More event ordering and ToolkitName fixes

 pyatspi/accessible.py  |   24 ++++++++++++++++++------
 pyatspi/appevent.py    |   10 +++++++---
 pyatspi/application.py |    2 +-
 3 files changed, 26 insertions(+), 10 deletions(-)
---
diff --git a/pyatspi/accessible.py b/pyatspi/accessible.py
index 831f5d7..957fda5 100644
--- a/pyatspi/accessible.py
+++ b/pyatspi/accessible.py
@@ -25,6 +25,9 @@ from dbus import UnknownMethodException, DBusException
 
 from exceptions import *
 
+import registry
+import dbus
+
 __all__ = [
            "LOCALE_TYPE",
            "LOCALE_TYPE_COLLATE",
@@ -284,7 +287,7 @@ class Accessible(BaseProxy):
 		else:
                         func = self.get_dbus_method("GetApplication", dbus_interface=ATSPI_ACCESSIBLE)
 			name, path = func ()
-		return self._acc_factory (name, path, ATSPI_ACCESSIBLE)
+		return self._acc_factory (name, path, ATSPI_APPLICATION)
 
         def getAttributes(self):
                 """
@@ -337,7 +340,11 @@ class Accessible(BaseProxy):
                         func = self.get_dbus_method("GetChildAtIndex", dbus_interface=ATSPI_ACCESSIBLE)
                         (name, path) = func (index)
 
-                return self._acc_factory (name, path, ATSPI_ACCESSIBLE)
+                if (path == ATSPI_ROOT_PATH):
+                        itf = ATSPI_APPLICATION
+                else:
+                        itf = ATSPI_ACCESSIBLE
+                return self._acc_factory (name, path, itf)
 
         def getIndexInParent(self):
                 """
@@ -467,7 +474,12 @@ class Accessible(BaseProxy):
                         name, path = self._cached_data.parent
                 else:
 		        name, path = self._pgetter (ATSPI_ACCESSIBLE, "Parent")
-                return self._acc_factory (name, path, ATSPI_ACCESSIBLE)
+
+                if (path == ATSPI_ROOT_PATH):
+                        itf = ATSPI_APPLICATION
+                else:
+                        itf = ATSPI_ACCESSIBLE
+                return self._acc_factory (name, path, itf)
         _parentDoc = \
                 """
                 an Accessible object which is this object's containing object.
@@ -490,11 +502,11 @@ class Accessible(BaseProxy):
                 if self.cached:
                         try:
                                 getattr(self, "extraData")
-                        except (attributeError):
-                                self.extraData = dit()
+                        except (AttributeError):
+                                self.extraData = dict()
                         try:
                                 return self.extraData[name]
-                        except (attributeError):
+                        except (KeyError):
                                 r = registry.Registry()
                                 r.freezeEvents()
                                 self.extraData[name] = dbus.String(self._pgetter(interface, name))
diff --git a/pyatspi/appevent.py b/pyatspi/appevent.py
index bee0333..01c8347 100644
--- a/pyatspi/appevent.py
+++ b/pyatspi/appevent.py
@@ -159,9 +159,9 @@ def signal_spec_to_event_type (interface, name, minor):
         if klass == "focus":
                 return EventType ("focus:")
 
-        event_string = klass + ':' + major + ':'
+        event_string = klass + ':' + major
         if minor:
-                event_string += minor
+                event_string += ":" + minor
         return EventType (event_string)
 
 def event_type_to_signal_reciever(bus, factory, event_handler, event_type):
@@ -210,7 +210,11 @@ def event_type_to_signal_reciever(bus, factory, event_handler, event_type):
                 # Create the source
                 source_name = sender
                 source_path = path
-                source = factory (source_name, source_path, interfaces.ATSPI_ACCESSIBLE)
+                if (path == interfaces.ATSPI_ROOT_PATH):
+                        source_itf = interfaces.ATSPI_APPLICATION
+                else:
+                        source_itf = interfaces.ATSPI_ACCESSIBLE
+                source = factory (source_name, source_path, source_itf)
 
                 event = Event (type,
                                detail1,
diff --git a/pyatspi/application.py b/pyatspi/application.py
index aaa9b02..9a6196e 100644
--- a/pyatspi/application.py
+++ b/pyatspi/application.py
@@ -52,7 +52,7 @@ class Application(Accessible):
         id = property(fget=get_id, doc=_idDoc)
 
         def get_toolkitName(self):
-                return self.getConstantProperty(ATSPI_APPLICATION, "ToolkitName")
+                return self._getConstantProperty(ATSPI_APPLICATION, "ToolkitName")
         _toolkitNameDoc = \
                 """
                 A string indicating the type of user interface toolkit which



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