mirror of
https://github.com/IAmTomShaw/f1-race-replay.git
synced 2026-05-09 08:25:56 +02:00
[PR #269] Refactor: Modularize UI components into src/ui/ package #263
Labels
No labels
bug
enhancement
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/f1-race-replay#263
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/269
Author: @OdysseasKalaitsidis
Created: 3/31/2026
Status: 🔄 Open
Base:
main← Head:refactor-ui-modularization📝 Commits (1)
f8f858aRefactor: Move UI components into src/ui package for better maintainability📊 Changes
15 files changed (+2363 additions, -2312 deletions)
View changed files
📝
.gitignore(+4 -1)➕
src/ui/__init__.py(+36 -0)➕
src/ui/base.py(+4 -0)➕
src/ui/controls.py(+295 -0)➕
src/ui/driver_info.py(+176 -0)➕
src/ui/lap_times.py(+88 -0)➕
src/ui/leaderboard.py(+334 -0)➕
src/ui/legend.py(+119 -0)➕
src/ui/popups.py(+289 -0)➕
src/ui/progress_bar.py(+419 -0)➕
src/ui/qualifying.py(+191 -0)➕
src/ui/session_info.py(+97 -0)➕
src/ui/utils.py(+176 -0)➕
src/ui/weather.py(+116 -0)📝
src/ui_components.py(+19 -2311)📄 Description
This PR refactors the monolithic src/ui_components.py file to improve maintainability and follow best practices for package structure.
Main Changes:
Created a new src/ui/ directory with a cleaner module-per-component structure.
Modularization: Divided the 2,300+ line ui_components.py into dedicated modules:
src/ui/base.py: Core component interface.
src/ui/leaderboard.py & src/ui/lap_times.py: Leaderboard logic.
src/ui/driver_info.py: Driver telemetry boxes.
src/ui/weather.py, src/ui/controls.py, src/ui/progress_bar.py, etc.
Backward Compatibility: Updated src/ui_components.py to act as a wrapper, importing all components from the new src/ui/ package so that existing code remains functional without needing to update imports everywhere immediately.
Utility Extraction: Moved track-related geometry functions (DRS zones, track building) to src/ui/utils.py.
Why this is needed: The original src/ui_components.py was becoming difficult to navigate and prone to merge conflicts. This modular approach makes it easier to add new UI features (like sector times or advanced charts) in isolation.
Verification:
Verified that the application launches and renders all UI components correctly using the GUI.
Confirmed src/ui_components.py correctly exports all classes for existing modules.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.