From 5321f2b56a097ad3d0acafa9f1a3db21bff3710c Mon Sep 17 00:00:00 2001 From: Mark Doffman Date: Mon, 8 Jun 2009 11:18:35 +0100 Subject: [PATCH] 2009-06-08 Mark Doffman Add an option to refresh the cache of data on any given accessible object. The refresh currently affects all accessible objects in any particular application. --- pyatspi/accessible.py | 3 ++- pyatspi/accessiblecache.py | 17 +++++++++-------- pyatspi/registry.py | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/pyatspi/accessible.py b/pyatspi/accessible.py index 8055e00..233d3eb 100644 --- a/pyatspi/accessible.py +++ b/pyatspi/accessible.py @@ -273,8 +273,9 @@ class Accessible(BaseProxy): """ parent = property(fget=get_parent, doc=_parentDoc) - def flushCache(self): + def refresh(self): self._relation_set = None + self._cache.application_cache[self._app_name].refresh() # Register the accessible class with the factory. accessible_factory.register_accessible_class(ATSPI_ACCESSIBLE, Accessible) diff --git a/pyatspi/accessiblecache.py b/pyatspi/accessiblecache.py index edfde8a..7d199e9 100644 --- a/pyatspi/accessiblecache.py +++ b/pyatspi/accessiblecache.py @@ -90,20 +90,17 @@ class AccessibleCache(object): self._bus_name = bus_name obj = connection.get_object(bus_name, self._PATH, introspect=False) - itf = _dbus.Interface(obj, self._INTERFACE) + self._tree_itf = _dbus.Interface(obj, self._INTERFACE) self._objects = {} - get_method = itf.get_dbus_method(self._GET_METHOD) + get_method = self._tree_itf.get_dbus_method(self._GET_METHOD) self._update_objects(get_method()) - self._updateMatch = itf.connect_to_signal(self._UPDATE_SIGNAL, self._update_single) - self._removeMatch = itf.connect_to_signal(self._REMOVE_SIGNAL, self._remove_object) + self._updateMatch = self._tree_itf.connect_to_signal(self._UPDATE_SIGNAL, self._update_single) + self._removeMatch = self._tree_itf.connect_to_signal(self._REMOVE_SIGNAL, self._remove_object) - obj = connection.get_object(self._bus_name, self._PATH, introspect=False) - itf = _dbus.Interface(obj, self._INTERFACE) - - self._root = itf.getRoot() + self._root = self._tree_itf.getRoot() def __getitem__(self, key): return self._objects[key] @@ -190,6 +187,10 @@ class AccessibleCache(object): def _get_root(self): return self._root + def _refresh(self): + get_method = self._tree_itf.get_dbus_method(self._GET_METHOD) + self._update_objects(get_method()) + root = property(fget=_get_root) #END--------------------------------------------------------------------------- diff --git a/pyatspi/registry.py b/pyatspi/registry.py index 66fcaf7..9873fd3 100644 --- a/pyatspi/registry.py +++ b/pyatspi/registry.py @@ -479,4 +479,4 @@ class _Registry(object): @param name: Name of the event to generate @type name: string """ - self.dev.generateMouseEvent(x, y, name) + self.dev.generateMouseEvent(dbus.Int32(x), dbus.Int32(y), name) -- 2.7.4