Make escape key a back button too

This commit is contained in:
Tanner Collin 2022-09-05 14:01:26 -06:00
parent a16e4c72a9
commit ee730cde0f

16
main.py
View File

@ -434,19 +434,19 @@ while True:
elif button == 'p': elif button == 'p':
current_screen = 'protocoin' current_screen = 'protocoin'
elif current_screen == 'debug': elif current_screen == 'debug':
if button == 'b': if button == 'b' or c == KEY_ESCAPE:
current_screen = 'home' current_screen = 'home'
if button == 'x': if button == 'x':
break break
elif current_screen == 'stats': elif current_screen == 'stats':
if button == 'b': if button == 'b' or c == KEY_ESCAPE:
current_screen = 'home' current_screen = 'home'
stats = {} stats = {}
elif current_screen == 'about': elif current_screen == 'about':
if button == 'b': if button == 'b' or c == KEY_ESCAPE:
current_screen = 'home' current_screen = 'home'
elif current_screen == 'classes': elif current_screen == 'classes':
if button == 'b': if button == 'b' or c == KEY_ESCAPE:
current_screen = 'home' current_screen = 'home'
classes = {} classes = {}
classes_start = 0 classes_start = 0
@ -458,7 +458,7 @@ while True:
classes_start -= 1 classes_start -= 1
stdscr.erase() stdscr.erase()
elif current_screen == 'info': elif current_screen == 'info':
if button == 'b': if button == 'b' or c == KEY_ESCAPE:
current_screen = 'home' current_screen = 'home'
protocoin = {} protocoin = {}
info_line = 0 info_line = 0
@ -470,7 +470,7 @@ while True:
info_line -= 19 info_line -= 19
stdscr.erase() stdscr.erase()
elif current_screen == 'protocoin': elif current_screen == 'protocoin':
if button == 'b': if button == 'b' or c == KEY_ESCAPE:
current_screen = 'home' current_screen = 'home'
protocoin = {} protocoin = {}
protocoin_line = 0 protocoin_line = 0
@ -498,7 +498,7 @@ while True:
else: else:
if c < 127 and c > 31: if c < 127 and c > 31:
sign_to_send = sign_to_send[:-1] + chr(c) + '_' sign_to_send = sign_to_send[:-1] + chr(c) + '_'
elif button == 'b': elif button == 'b' or c == KEY_ESCAPE:
current_screen = 'home' current_screen = 'home'
elif button == 'e': elif button == 'e':
sign_to_send = '_' sign_to_send = '_'
@ -525,7 +525,7 @@ while True:
else: else:
if c < 127 and c > 31: if c < 127 and c > 31:
think_to_send = think_to_send[:-1] + chr(c) + '_' think_to_send = think_to_send[:-1] + chr(c) + '_'
elif button == 'b': elif button == 'b' or c == KEY_ESCAPE:
current_screen = 'home' current_screen = 'home'
think_result = '' think_result = ''
elif button == 'e': elif button == 'e':