1
# -*- coding: utf-8 -*-
3
# This file is part of emesene.
5
# emesene is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; either version 3 of the License, or
8
# (at your option) any later version.
10
# emesene is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
# GNU General Public License for more details.
15
# You should have received a copy of the GNU General Public License
16
# along with emesene; if not, write to the Free Software
17
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
23
class Signals(object):
24
'''a class that conversats e3 signals into gui.Signal'''
26
def __init__(self, events, event_queue):
28
self.event_queue = event_queue
29
self.event_names = tuple(sorted(events))
32
event = event.replace(' ', '_')
33
setattr(self, event, Signal.Signal())
35
def _handle_events(self):
36
'''convert Event object on the queue to gui.Signal'''
39
event = self.event_queue.get(False)
41
if event.id_ < len(self.event_names):
42
event_name = self.event_names[event.id_].replace(' ', '_')
43
signal = getattr(self, event_name)
44
signal.emit(*event.args)