~eeejay/checkbox/gtkbuilder

« back to all changes in this revision

Viewing changes to checkbox/reactor.py

  • Committer: Marc Tardif
  • Date: 2009-06-08 23:55:34 UTC
  • Revision ID: marc.tardif@canonical.com-20090608235534-zl1jpaajn3n3fvpw
Added handler stack to reactor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
# You should have received a copy of the GNU General Public License
17
17
# along with Checkbox.  If not, see <http://www.gnu.org/licenses/>.
18
18
#
 
19
import os
19
20
import re
20
21
import logging
21
22
import threading
44
45
 
45
46
    def __init__(self):
46
47
        self._event_handlers = {}
 
48
        self._handler_stack = []
47
49
        self._local = threading.local()
48
50
 
49
51
    @property
86
88
            try:
87
89
                logging.debug("Calling %s for %s with priority %d.",
88
90
                              format_object(handler), event_type, priority)
 
91
                self._handler_stack.append(handler)
89
92
                results.append(handler(*args, **kwargs))
90
93
            except StopException:
91
94
                break
102
105
                                  "event type %r with args %r %r.",
103
106
                                  format_object(handler), event_type,
104
107
                                  args, kwargs)
 
108
            finally:
 
109
                self._handler_stack.pop(-1)
105
110
 
106
111
        self._event_stack.pop(-1)
107
112