tools/scyllatop: fix crash due to mouse events

due to an urwid-library technicality, some mouse events like scroll or
click would crash scyllatop. This patch fixes this problem.

closes issue #1396.

Signed-off-by: Yoav Kleinberger <yoav@scylladb.com>
Message-Id: <1467294117-19218-1-git-send-email-yoav@scylladb.com>
This commit is contained in:
Yoav Kleinberger
2016-06-30 16:41:57 +03:00
committed by Avi Kivity
parent cb59e724ee
commit 0ad940bfc3

View File

@@ -1,4 +1,5 @@
import urwid
import logging
class UserInput(object):
@@ -13,8 +14,11 @@ class UserInput(object):
self._mainLoop = loop
def __call__(self, keypress):
logging.debug('keypress={}'.format(keypress))
if keypress in ('q', 'Q'):
raise urwid.ExitMainLoop()
if type(keypress) is not str:
return
if keypress.upper() not in self._viewMap:
return