mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-11-01 07:33:45 -06:00
fix: help names only keys the route sends
This commit is contained in:
1 parent
fad5b10665
commit
ae3faec86b
7 files changed
+52
-21
No files matched your search
+12
-3
@@ -12758,7 +12758,7 @@ def _help_lines(state: TuiState) -> list[tuple[str, str]]:
|
||||
if screen == "installing":
|
||||
return [(names["stop"], "Stop: what is done stays done"),
|
||||
*([(names["kill"], "Stop")] if names["kill"] else []),
|
||||
*_route_extras(state), ("?, F1", "This help")]
|
||||
*_route_extras(state), *_help_key(state)]
|
||||
if screen == "path":
|
||||
return [(names["enter"], "Use this folder"), ("Backspace", "Delete a character"),
|
||||
("Ctrl-U", "Clear"), (names["esc"], "Back"), ("Ctrl-C", "Quit"),
|
||||
@@ -12786,10 +12786,16 @@ def _help_lines(state: TuiState) -> list[tuple[str, str]]:
|
||||
keys.append((names["options"], "Options"))
|
||||
back = "Quit" if len(state.stack) == 1 else "Back"
|
||||
keys += [(names["back"], back), ("q, Ctrl-C", "Quit"), *kill, *_route_extras(state),
|
||||
("?, F1", "This help")]
|
||||
*_help_key(state)]
|
||||
return keys
|
||||
|
||||
|
||||
def _help_key(state: TuiState) -> list[tuple[str, str]]:
|
||||
"""? and F1, named only where a keyboard may send them: no pad route
|
||||
maps a button to either."""
|
||||
return [("?, F1", "This help")] if state.pad in ("both", "keys") else []
|
||||
|
||||
|
||||
def _primary(state: TuiState) -> str | None:
|
||||
"""What A does on the row in focus, for the first entry of the bar."""
|
||||
if state.screen in _PAGERS:
|
||||
@@ -12805,7 +12811,10 @@ def _primary(state: TuiState) -> str | None:
|
||||
def _view_help(state: TuiState, width: int, height: int) -> tuple:
|
||||
keys = _help_lines(state)
|
||||
column = min(22, max(cell_width(key) for key, _what in keys) + 2)
|
||||
lines = [f"{_pad(key, column)}{what}" for key, what in keys]
|
||||
# Two spaces at least: a key as wide as the column touched its text
|
||||
# ("Select Keyboard on or off" on muxterm).
|
||||
lines = [f"{_pad(key, column)}{what}" if cell_width(key) <= column - 2
|
||||
else f"{key} {what}" for key, what in keys]
|
||||
if state.screen in ("setup", "plan", "browse", "folder") and state.dest is not None:
|
||||
lines += ["", f"BIOS folder: {state.dest}"]
|
||||
return ("Keys", _compose(state, width, height, lines, []), ("Any key closes this help",))
|
||||
|
||||
Vendored
+3
-3
@@ -1140,10 +1140,10 @@
|
||||
Y, Tab, o Options
|
||||
B, Select, Esc Back
|
||||
q, Ctrl-C Quit
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder:
|
||||
/home/user/.config/retroarch/system
|
||||
|
||||
Any key closes this help
|
||||
=== help 40x15
|
||||
RetroBIOS: Keys
|
||||
@@ -1153,13 +1153,13 @@
|
||||
Y, Tab, o Options
|
||||
B, Select, Esc Back
|
||||
q, Ctrl-C Quit
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder:
|
||||
/home/user/.config/retroarch/system
|
||||
|
||||
|
||||
|
||||
|
||||
Any key closes this help
|
||||
=== help 80x24
|
||||
RetroBIOS: Keys
|
||||
@@ -1169,7 +1169,6 @@
|
||||
Y, Tab, o Options
|
||||
B, Select, Esc Back
|
||||
q, Ctrl-C Quit
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder: /home/user/.config/retroarch/system
|
||||
|
||||
@@ -1185,4 +1184,5 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Any key closes this help
|
||||
+4
-4
@@ -1141,9 +1141,9 @@
|
||||
B, Select, Esc Back
|
||||
q, Ctrl-C Quit
|
||||
Select, then Start Quit at once
|
||||
?, F1 This help
|
||||
|
||||
|
||||
BIOS folder:
|
||||
/home/user/.config/retroarch/system
|
||||
Any key closes this help
|
||||
=== help 40x15
|
||||
RetroBIOS: Keys
|
||||
@@ -1154,12 +1154,12 @@
|
||||
B, Select, Esc Back
|
||||
q, Ctrl-C Quit
|
||||
Select, then Start Quit at once
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder:
|
||||
/home/user/.config/retroarch/system
|
||||
|
||||
|
||||
|
||||
Any key closes this help
|
||||
=== help 80x24
|
||||
RetroBIOS: Keys
|
||||
@@ -1170,7 +1170,6 @@
|
||||
B, Select, Esc Back
|
||||
q, Ctrl-C Quit
|
||||
Select, then Start Quit at once
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder: /home/user/.config/retroarch/system
|
||||
|
||||
@@ -1185,4 +1184,5 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Any key closes this help
|
||||
+4
-4
@@ -1141,9 +1141,9 @@
|
||||
B, Select, Esc Back
|
||||
q, Ctrl-C Quit
|
||||
Select, then Start Quit at once
|
||||
?, F1 This help
|
||||
|
||||
|
||||
BIOS folder:
|
||||
/home/user/.config/retroarch/system
|
||||
Any key closes this help
|
||||
=== help 40x15
|
||||
RetroBIOS: Keys
|
||||
@@ -1154,12 +1154,12 @@
|
||||
B, Select, Esc Back
|
||||
q, Ctrl-C Quit
|
||||
Select, then Start Quit at once
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder:
|
||||
/home/user/.config/retroarch/system
|
||||
|
||||
|
||||
|
||||
Any key closes this help
|
||||
=== help 80x24
|
||||
RetroBIOS: Keys
|
||||
@@ -1170,7 +1170,6 @@
|
||||
B, Select, Esc Back
|
||||
q, Ctrl-C Quit
|
||||
Select, then Start Quit at once
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder: /home/user/.config/retroarch/system
|
||||
|
||||
@@ -1185,4 +1184,5 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Any key closes this help
|
||||
Vendored
+4
-4
@@ -1141,9 +1141,9 @@
|
||||
R2, Esc, Backspace Back
|
||||
q, Ctrl-C Quit
|
||||
B Sends no key here
|
||||
?, F1 This help
|
||||
|
||||
|
||||
BIOS folder:
|
||||
/home/user/.config/retroarch/system
|
||||
Any key closes this help
|
||||
=== help 40x15
|
||||
RetroBIOS: Keys
|
||||
@@ -1154,12 +1154,12 @@
|
||||
R2, Esc, Backspace Back
|
||||
q, Ctrl-C Quit
|
||||
B Sends no key here
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder:
|
||||
/home/user/.config/retroarch/system
|
||||
|
||||
|
||||
|
||||
Any key closes this help
|
||||
=== help 80x24
|
||||
RetroBIOS: Keys
|
||||
@@ -1170,7 +1170,6 @@
|
||||
R2, Esc, Backspace Back
|
||||
q, Ctrl-C Quit
|
||||
B Sends no key here
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder: /home/user/.config/retroarch/system
|
||||
|
||||
@@ -1185,4 +1184,5 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Any key closes this help
|
||||
Vendored
+3
-3
@@ -1142,7 +1142,7 @@
|
||||
q, Ctrl-C Quit
|
||||
Select Keyboard on or off
|
||||
Menu Close the terminal
|
||||
?, F1 This help
|
||||
|
||||
|
||||
Any key closes this help
|
||||
=== help 40x15
|
||||
@@ -1155,11 +1155,11 @@
|
||||
q, Ctrl-C Quit
|
||||
Select Keyboard on or off
|
||||
Menu Close the terminal
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder:
|
||||
/home/user/.config/retroarch/system
|
||||
|
||||
|
||||
Any key closes this help
|
||||
=== help 80x24
|
||||
RetroBIOS: Keys
|
||||
@@ -1171,7 +1171,6 @@
|
||||
q, Ctrl-C Quit
|
||||
Select Keyboard on or off
|
||||
Menu Close the terminal
|
||||
?, F1 This help
|
||||
|
||||
BIOS folder: /home/user/.config/retroarch/system
|
||||
|
||||
@@ -1185,4 +1184,5 @@
|
||||
|
||||
|
||||
|
||||
|
||||
Any key closes this help
|
||||
@@ -3940,6 +3940,28 @@ class GameDataIsNoFirmwareAlarm(unittest.TestCase):
|
||||
self.assertIn("Anims.j2a (Jazz Jackrabbit 2)", lines[1])
|
||||
|
||||
|
||||
class TheHelpNamesKeysThatCome(unittest.TestCase):
|
||||
"""Every route's help listed "?, F1 This help", which no pad sends, and
|
||||
a key as wide as the column touched its text."""
|
||||
|
||||
def test_pad_routes_name_no_help_key(self):
|
||||
for pad in ROUTES:
|
||||
with self.subTest(route=pad):
|
||||
state = checked_state()
|
||||
state.pad = pad
|
||||
keys = [key for key, _what in install._help_lines(state)]
|
||||
self.assertEqual("?, F1" in keys, pad == "keys")
|
||||
|
||||
def test_a_wide_key_keeps_two_spaces(self):
|
||||
state = checked_state()
|
||||
state.help = True
|
||||
with mock.patch.object(install, "_help_lines",
|
||||
return_value=[("A, Start, Enter, Space, x", "Choose"),
|
||||
("q", "Quit")]):
|
||||
lines = install._view_help(state, 80, 24)[1]
|
||||
self.assertTrue(any("A, Start, Enter, Space, x Choose" in line for line in lines))
|
||||
|
||||
|
||||
class NothingFoundIsSaid(unittest.TestCase):
|
||||
"""With nothing detected the first screen was the list of 18 setups,
|
||||
with no line at 40x15 saying nothing was found, which the beginner's
|
||||
|
||||
Reference in new issue
Block a user