Primitivus: mouse wheel changed to 'up' and 'down' key press
This commit is contained in:
parent
12b166ca89
commit
126d529d46
1 changed files with 13 additions and 3 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue