[PR #219] refactor: Implement Command pattern for input event handling #227

Open
opened 2026-05-07 00:19:18 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/219
Author: @anirudhk06
Created: 2/5/2026
Status: 🔄 Open

Base: mainHead: key_events


📝 Commits (2)

  • 6fca128 refactor: clean up speed commands and update key event handling
  • ac5ec91 Merge branch 'main' into key_events

📊 Changes

7 files changed (+206 additions, -106 deletions)

View changed files

src/inputs/__init__.py (+0 -0)
src/inputs/base.py (+8 -0)
src/inputs/key_press.py (+113 -0)
src/inputs/key_release.py (+13 -0)
src/interfaces/__init__.py (+0 -0)
📝 src/interfaces/race_replay.py (+51 -84)
📝 src/ui_components.py (+21 -22)

📄 Description

Summary

Refactored input handling to use the Command pattern for both keyboard and mouse events, improving code consistency and maintainability.

Changes

  • New Command classes in src/inputs/:
    • TogglePauseCommand - Play/pause toggle
    • StartForwardCommand / StopForwardCommand - Hold-to-forward functionality
    • StartRewindCommand / StopRewindCommand - Hold-to-rewind functionality
    • IncreaseSpeedCommand / DecreaseSpeedCommand - Playback speed controls
    • etc...

Benefits

  • Unified behavior between mouse clicks and keyboard shortcuts
  • Button flash feedback now works consistently for all inputs
  • Easier to extend with new commands in the future
  • Better separation of concerns

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/IAmTomShaw/f1-race-replay/pull/219 **Author:** [@anirudhk06](https://github.com/anirudhk06) **Created:** 2/5/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `key_events` --- ### 📝 Commits (2) - [`6fca128`](https://github.com/IAmTomShaw/f1-race-replay/commit/6fca12878da9d454772a437229a84870ba48f7fe) refactor: clean up speed commands and update key event handling - [`ac5ec91`](https://github.com/IAmTomShaw/f1-race-replay/commit/ac5ec91ca7a599e9daf8e981e303c686b2da6697) Merge branch 'main' into key_events ### 📊 Changes **7 files changed** (+206 additions, -106 deletions) <details> <summary>View changed files</summary> ➕ `src/inputs/__init__.py` (+0 -0) ➕ `src/inputs/base.py` (+8 -0) ➕ `src/inputs/key_press.py` (+113 -0) ➕ `src/inputs/key_release.py` (+13 -0) ➕ `src/interfaces/__init__.py` (+0 -0) 📝 `src/interfaces/race_replay.py` (+51 -84) 📝 `src/ui_components.py` (+21 -22) </details> ### 📄 Description ## Summary Refactored input handling to use the Command pattern for both keyboard and mouse events, improving code consistency and maintainability. ## Changes - **New Command classes** in `src/inputs/`: - `TogglePauseCommand` - Play/pause toggle - `StartForwardCommand` / `StopForwardCommand` - Hold-to-forward functionality - `StartRewindCommand` / `StopRewindCommand` - Hold-to-rewind functionality - `IncreaseSpeedCommand` / `DecreaseSpeedCommand` - Playback speed controls - etc... ## Benefits - Unified behavior between mouse clicks and keyboard shortcuts - Button flash feedback now works consistently for all inputs - Easier to extend with new commands in the future - Better separation of concerns --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/f1-race-replay#227
No description provided.