Fixed h reading help instead of navigating to items that begin with h. Help now bound to control+h.
This commit is contained in:
@@ -888,12 +888,18 @@ class VoicedMenu:
|
||||
return True
|
||||
return False
|
||||
|
||||
def handle_letter_navigation(self, key):
|
||||
"""Handle printable letter navigation and reliable control shortcuts."""
|
||||
def handle_control_shortcut(self, key):
|
||||
"""Handle reliable control-key shortcuts before printable navigation."""
|
||||
if key == 2: # Ctrl+B
|
||||
self.report_battery_status()
|
||||
return True
|
||||
if key == 8: # Ctrl+H
|
||||
self.speak_help()
|
||||
return True
|
||||
return False
|
||||
|
||||
def handle_letter_navigation(self, key):
|
||||
"""Handle printable letter navigation."""
|
||||
if key < 0 or key > 255:
|
||||
return False
|
||||
|
||||
@@ -1128,7 +1134,7 @@ class VoicedMenu:
|
||||
Lowercase letters: Jump to menu items.
|
||||
Uppercase letters: Jump to categories from the main menu.
|
||||
Enter: Launch selected item.
|
||||
H key: Hear these instructions again.
|
||||
Control H: Hear these instructions again.
|
||||
Control B: Report battery status.
|
||||
Left bracket: Decrease speech rate.
|
||||
Right bracket: Increase speech rate.
|
||||
@@ -1154,7 +1160,7 @@ class VoicedMenu:
|
||||
self.stdscr.addstr(1, x, title, curses.A_BOLD)
|
||||
|
||||
# Draw help line
|
||||
helpText = "Navigate | Letters: Jump | Enter: Select | H: Help | Ctrl+B: Battery | Esc: Back"
|
||||
helpText = "Navigate | Letters: Jump | Enter: Select | Ctrl+H: Help | Ctrl+B: Battery | Esc: Back"
|
||||
x = max(0, w // 2 - len(helpText) // 2)
|
||||
self.stdscr.addstr(3, x, helpText)
|
||||
|
||||
@@ -1245,7 +1251,7 @@ class VoicedMenu:
|
||||
|
||||
# Welcome message - don't interrupt this initial speech
|
||||
boot_source = "internal disk" if self.is_installed else "USB drive"
|
||||
self.speak(f"Welcome to {self.title}, booted from {boot_source}. Use left and right arrows to navigate sections. Up and down for items. Press H for help.")
|
||||
self.speak(f"Welcome to {self.title}, booted from {boot_source}. Use left and right arrows to navigate sections. Up and down for items. Press Control H for help.")
|
||||
|
||||
# Wait for initial speech to finish before announcing section
|
||||
time.sleep(1)
|
||||
@@ -1321,9 +1327,6 @@ class VoicedMenu:
|
||||
self.play_sound("menu_select")
|
||||
self.execute_current_item()
|
||||
|
||||
elif key == ord('h') or key == ord('H'): # Help
|
||||
self.speak_help()
|
||||
|
||||
elif key == ord('['): # Decrease speech rate
|
||||
self.decrease_speech_rate()
|
||||
self.draw_menu()
|
||||
@@ -1351,6 +1354,9 @@ class VoicedMenu:
|
||||
time.sleep(0.5)
|
||||
break
|
||||
|
||||
elif self.handle_control_shortcut(key):
|
||||
pass
|
||||
|
||||
elif self.handle_letter_navigation(key):
|
||||
pass
|
||||
|
||||
|
||||
Reference in New Issue
Block a user