Added alpine-like q to quit

pull/24/head
Jake Funke 2018-12-13 22:54:57 +00:00
parent 70d02db493
commit 300b9e8d00
1 changed files with 4 additions and 1 deletions

View File

@ -270,11 +270,14 @@ class CursedMenu(object):
self.screen.clear() self.screen.clear()
self.screen.refresh() self.screen.refresh()
# enter and exit Keys are special cases # enter, exit, and Q Keys are special cases
if user_in == 10: if user_in == 10:
return self.options[self.selected] return self.options[self.selected]
if user_in == 27: if user_in == 27:
return self.options[-1] return self.options[-1]
if user_in == 113:
self.selected = len(self.options) - 1
return
# this is a number; check to see if we can set it # this is a number; check to see if we can set it
if user_in >= ord('1') and user_in <= ord(str(min(6,len(self.options)))): if user_in >= ord('1') and user_in <= ord(str(min(6,len(self.options)))):