[pyatspi2/p2p: 8/8] Make event queue global to the _AccessibilityBus class
- From: Mike Gorse <mgorse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pyatspi2/p2p: 8/8] Make event queue global to the _AccessibilityBus class
- Date: Fri, 1 Oct 2010 23:44:22 +0000 (UTC)
commit 6abef2399ca44592ea441365a0ab2f41c6471dd3
Author: Mike Gorse <mgorse novell com>
Date: Fri Oct 1 19:31:33 2010 -0400
Make event queue global to the _AccessibilityBus class
pyatspi/busutils/bus.py | 27 ++++++++++++++++-----------
1 files changed, 16 insertions(+), 11 deletions(-)
---
diff --git a/pyatspi/busutils/bus.py b/pyatspi/busutils/bus.py
index 5338f79..53ea064 100644
--- a/pyatspi/busutils/bus.py
+++ b/pyatspi/busutils/bus.py
@@ -66,21 +66,25 @@ class _AccessibilityBus (_bus.BusConnection):
def __init__ (self, address, mainloop):
_bus.BusConnection.__init__(self, address, mainloop)
self._signal_queue = _queue.Queue ()
- self.eventsFrozen = False
- self.needEventDispatch = False
+ try:
+ test = _AccessibilityBus.eventsFrozen
+ except:
+ _AccessibilityBus.eventsFrozen = False
+ _AccessibilityBus.needEventDispatchBuses = []
def freezeEvents(self):
- self.eventsFrozen = True
+ _AccessibilityBus.eventsFrozen = True
def thawEvents(self):
- self.eventsFrozen = False
- if self.needEventDispatch:
- gobject.idle_add(self._event_dispatch)
- self.needEventDispatch = False
+ _AccessibilityBus.eventsFrozen = False
+ for bus in _AccessibilityBus.needEventDispatchBuses:
+ gobject.idle_add(bus._event_dispatch)
+ _AccessibilityBus.needEventDispatchBuses = []
def _event_dispatch (self):
- if self.eventsFrozen:
- self.needEventDispatch = True
+ if _AccessibilityBus.eventsFrozen:
+ if not(self in _AccessibilityBus.needEventDispatchBuses):
+ _AccessibilityBus.needEventDispatchBuses.append(self)
return
while not self._signal_queue.empty():
(func, args, kwargs) = self._signal_queue.get (False)
@@ -91,8 +95,9 @@ class _AccessibilityBus (_bus.BusConnection):
def wrapper (*iargs, **ikwargs):
self._signal_queue.put ((func, iargs, ikwargs))
- if self.eventsFrozen:
- self.needEventDispatch = True
+ if _AccessibilityBus.eventsFrozen:
+ if not(self in _AccessibilityBus.needEventDispatchBuses):
+ _AccessibilityBus.needEventDispatchBuses.append(self)
else:
gobject.idle_add(self._event_dispatch)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]