Implemented viewing game help documents from inside the game#240
Implemented viewing game help documents from inside the game#240mohammad-aloufi wants to merge 10 commits intoXGDevGroup:mainfrom
Conversation
|
Review generated by Claude (Anthropic's coding assistant), posted at the repo owner's request. Thanks for tackling this — universal F1 for rules is a genuine accessibility win. Claude tested the PR end-to-end (real Blocking1. Silent / gibberish failure when 2. Dead if hasattr(self, "_table") and self._table and hasattr(self._table, "_server") and self._table._server:
3. Reaches into private API and reinvents existing logic. The handler calls Design / cleanup4. The new def _is_leave_game_enabled(self, player): # line 113
return None
def _is_show_actions_enabled(self, player): # line 161
return NoneBoth are wired to (For clarity, this is an 5. Tight coupling. 6. Trailing whitespace on many lines in 7. Possible duplicate F1 packet on the desktop client. F1 was already mapped in 8. F1 from the lobby (no game) is silent. Client always sends the packet when connected; server drops it if the user isn't at a table. Not a regression, but for a "global rules shortcut" some feedback ("you must be at a table to view rules") would be friendlier. TestingThe PR description says "Deployed a local test environment" and "Traced inbound network packets," but the PR adds zero automated tests for new code that touches keybind dispatch, document lookup, and locale selection. Claude wrote 8 targeted tests covering the end-to-end path, locale fallback, private-locale exclusion, missing-document handling, and the |
|
Done.
|
Summary
This PR implements a universally accessible
F1shortcut that allows players to seamlessly pull up the rulebook for their current game without leaving the table. Modifies both the desktop client functionality and the server's documentation/game event plumbing.Key Changes
Client Side
main_window.py): AddedF1natively to theAcceleratorTable. Previously,F1could only be parsed if the player's cursor was specifically focused on the game menu list. Elevating this to the accelerator configuration guarantees the signal reliably fires from anywhere in the application.Server Side
action_set_creation_mixin.py): Defined an explicit"show_rules"action internally mapped to the inbound{"key": "f1"}packet binding across all game tables.action_visibility_mixin.py): Handled visibility restrictions by introducing_is_always_enabled, securely ensuring that pressing F1 cannot be blocked regardless of the match's turn state.menu_management_mixin.py): Authored_action_show_rules, which serves as a programmatic bridge between live games and the static document system. When fired, it references the table's master_documentsmanager, dynamically parses the appropriate folder ([game_type]_rules), respects active localization overrides, and ships the Markdown safely back to the client'sMarkdownViewerDialog.games.ftl): Populated the master configuration string definitions for"show-rules".Testing Notes
AcceleratorTablelogic.f1keybind payload against a simulated lobby table.