[PR #269] Refactor: Modularize UI components into src/ui/ package #263

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

📋 Pull Request Information

Original PR: https://github.com/IAmTomShaw/f1-race-replay/pull/269
Author: @OdysseasKalaitsidis
Created: 3/31/2026
Status: 🔄 Open

Base: mainHead: refactor-ui-modularization


📝 Commits (1)

  • f8f858a Refactor: 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.

## 📋 Pull Request Information **Original PR:** https://github.com/IAmTomShaw/f1-race-replay/pull/269 **Author:** [@OdysseasKalaitsidis](https://github.com/OdysseasKalaitsidis) **Created:** 3/31/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `refactor-ui-modularization` --- ### 📝 Commits (1) - [`f8f858a`](https://github.com/IAmTomShaw/f1-race-replay/commit/f8f858afb9d1ba97718ea4ff5648dca5d24cb89d) Refactor: Move UI components into src/ui package for better maintainability ### 📊 Changes **15 files changed** (+2363 additions, -2312 deletions) <details> <summary>View changed files</summary> 📝 `.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) </details> ### 📄 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. --- <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#263
No description provided.