def _connected(self, width, height): if self.running: del self.current self.set_application(freevo.taskmanager.current) return True self.running = True self.height = height self.width = width self.playitem = None self.screens = None l = self.height while not self.screens: try: layouts[l] c = self.width while True: try: self.screens = layouts[l][c] break except KeyError: c -= 1 if c < 1: raise KeyError except KeyError: l -= 1 if l < 1: return False self.lines = l self.columns = c kaa.EventHandler(self.eventhandler).register() freevo.signals['application-change'].connect(self.set_application) self.set_application(freevo.taskmanager.current)
def __init__(self): super(TaskManager, self).__init__() self.applications = [] self.current = None self.windows = [] self.eventmap = None kaa.EventHandler(self.eventhandler).register() gui.signals['reset'].connect(self.reset)
def __init__(self): """ init the osd """ super(PluginInterface, self).__init__() kaa.EventHandler(self.show).register([freevo.OSD_MESSAGE]) self.widget = None self.hide_timer = kaa.OneShotTimer(self.hide)
def __init__(self): """ get the list of plugins wanting events """ self.eventhandler_plugins = [] self.eventlistener_plugins = [] for p in plugin.get('daemon_eventhandler'): if hasattr(p, 'event_listener') and p.event_listener: self.eventlistener_plugins.append(p) else: self.eventhandler_plugins.append(p) kaa.EventHandler(self.eventhandler).register()
def plugin_activate(self, level): if not os.environ.get('DISPLAY') or not kaa.utils.which('xset'): return # get xset process to call self.xset = kaa.Process(kaa.utils.which('xset')).start self.counter = 0 self._mode = OFF # Timer to poll and increase counter. It willbe started when the # menu is shown. self.timer = kaa.Timer(self.poll) # register to all events kaa.EventHandler(self.eventhandler).register() # turn on dpms on shutdown kaa.main.signals['shutdown'].connect(self.xset, '+dpms') # register to application changes freevo.signals['application-change'].connect(self.application_changed) # turn off dpms self.xset('-dpms s off')
print 'got FOO' elif event == 'BAR_EVENT': print 'got BAR with %s' % event.arg def foo(event): if event == 'FOO_EVENT': print 'foo got FOO' else: print 'This can not happen' def all(event): print event e = kaa.EventHandler(foobar) e.register(('FOO_EVENT', 'BAR_EVENT')) e = kaa.EventHandler(foo) e.register((FOO_EVENT, )) e = kaa.EventHandler(all) e.register([]) FOO_EVENT.post() kaa.Event('BAR_EVENT').post(1) kaa.Event('BAR_EVENT', 2).post() kaa.main.run()