add keybind to wipe the screen
parent
f4cfcc5614
commit
dce87a8312
|
@ -1265,21 +1265,30 @@ class OptionsMenu(urwid.LineBox):
|
||||||
# try to let the base class handle the key, if not, we'll take over
|
# try to let the base class handle the key, if not, we'll take over
|
||||||
elif not super(OptionsMenu, self).keypress(size, key):
|
elif not super(OptionsMenu, self).keypress(size, key):
|
||||||
return
|
return
|
||||||
|
|
||||||
elif key in ["shift down", "J", "N"]:
|
elif key in ["shift down", "J", "N"]:
|
||||||
for x in range(5):
|
for x in range(5):
|
||||||
self.keypress(size, "down")
|
self.keypress(size, "down")
|
||||||
|
|
||||||
elif key in ["shift up", "K", "P"]:
|
elif key in ["shift up", "K", "P"]:
|
||||||
for x in range(5):
|
for x in range(5):
|
||||||
self.keypress(size, "up")
|
self.keypress(size, "up")
|
||||||
|
|
||||||
elif key.lower() in ["left", "h", "q"]:
|
elif key.lower() in ["left", "h", "q"]:
|
||||||
app.loop.widget = app.loop.widget[0]
|
app.loop.widget = app.loop.widget[0]
|
||||||
|
|
||||||
elif key.lower() in ["right", "l"]:
|
elif key.lower() in ["right", "l"]:
|
||||||
return self.keypress(size, "enter")
|
return self.keypress(size, "enter")
|
||||||
|
|
||||||
elif key in ["ctrl n", "j", "n"]:
|
elif key in ["ctrl n", "j", "n"]:
|
||||||
return self.keypress(size, "down")
|
return self.keypress(size, "down")
|
||||||
|
|
||||||
elif key in ["ctrl p", "k", "p"]:
|
elif key in ["ctrl p", "k", "p"]:
|
||||||
return self.keypress(size, "up")
|
return self.keypress(size, "up")
|
||||||
|
|
||||||
|
elif key == "ctrl l":
|
||||||
|
wipe_screen()
|
||||||
|
|
||||||
|
|
||||||
class ActionBox(urwid.ListBox):
|
class ActionBox(urwid.ListBox):
|
||||||
"""
|
"""
|
||||||
|
@ -1333,6 +1342,9 @@ class ActionBox(urwid.ListBox):
|
||||||
elif key.lower() == "q":
|
elif key.lower() == "q":
|
||||||
app.back(True)
|
app.back(True)
|
||||||
|
|
||||||
|
elif key == "ctrl l":
|
||||||
|
wipe_screen()
|
||||||
|
|
||||||
|
|
||||||
def frilly_exit():
|
def frilly_exit():
|
||||||
"""
|
"""
|
||||||
|
@ -1548,6 +1560,17 @@ def ignore(*_, **__):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
def wipe_screen(*_):
|
||||||
|
"""
|
||||||
|
A crude hack to repaint the whole screen. I didnt immediately
|
||||||
|
see anything to acheive this in the MainLoop methods so this
|
||||||
|
will do, I suppose.
|
||||||
|
"""
|
||||||
|
app.loop.stop()
|
||||||
|
run("clear", shell=True)
|
||||||
|
app.loop.start()
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
global app
|
global app
|
||||||
app = App()
|
app = App()
|
||||||
|
|
Loading…
Reference in New Issue