From 126d529d467f70be707abfdd75d4dd847b7340e8 Mon Sep 17 00:00:00 2001 From: Goffi Date: Mon, 12 Jul 2010 18:55:27 +0800 Subject: [PATCH] Primitivus: mouse wheel changed to 'up' and 'down' key press --- frontends/primitivus/primitivus | 14 ++++++++++++-- plugins/plugin_xep_0065.py | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/frontends/primitivus/primitivus b/frontends/primitivus/primitivus index 56dd91c5..9d3fda82 100755 --- a/frontends/primitivus/primitivus +++ b/frontends/primitivus/primitivus @@ -84,7 +84,7 @@ class PrimitivusApp(QuickApp): ## main loop setup ## self.main_widget = ProfileManager(self) - self.loop = urwid.MainLoop(self.main_widget, const_PALETTE, event_loop=urwid.GLibEventLoop(), unhandled_input=self.key_handler) + self.loop = urwid.MainLoop(self.main_widget, const_PALETTE, event_loop=urwid.GLibEventLoop(), input_filter=self.inputFilter, unhandled_input=self.keyHandler) ##misc setup## self.chat_wins=ChatList(self) @@ -105,7 +105,17 @@ class PrimitivusApp(QuickApp): self.loop.set_alarm_in(0,lambda a,b: self.postInit()) self.loop.run() - def key_handler(self, input): + def inputFilter(self, input, raw): + for i in input: + if i.__class__==tuple: + if i[0] == 'mouse press': + if i[1] == 4: #Mouse wheel up + input[input.index(i)] = 'up' + if i[1] == 5: #Mouse wheel down + input[input.index(i)] = 'down' + return input + + def keyHandler(self, input): if input in ('q', 'Q') or input == 'ctrl x': raise urwid.ExitMainLoop() elif input == 'ctrl d' and 'D' in self.bridge.getVersion(): #Debug only for dev versions diff --git a/plugins/plugin_xep_0065.py b/plugins/plugin_xep_0065.py index 682b6294..94cfee06 100755 --- a/plugins/plugin_xep_0065.py +++ b/plugins/plugin_xep_0065.py @@ -508,7 +508,7 @@ class XEP_0065(): IQ_id = iq['id'] for element in SI_elem.elements(): if element.name == "streamhost": - info (_("Stream proposed: host=[%(host)s] port=[%(post)s]") % {'host':element['host'], 'port':element['port']}) + info (_("Stream proposed: host=[%(host)s] port=[%(port)s]") % {'host':element['host'], 'port':element['port']}) factory = self.client_factory self.server_factory.protocol.mode = "target" factory.protocol.host = self.host #needed for progress CB