This submission represents a major engineering upgrade and business logic correction for the book price calculator, aiming for a more stable, aesthetically modern (Modern UI/UX), and functionally accurate pricing tool.
The underlying codebase has been thoroughly refactured to adhere to robust software engineering principles:
- 🛡️ Critical Stability Patching:
- Introduced the
RuntimeFixermodule to specifically address theAttributeErrorcrashes inCTkSwitchandCTkOptionMenuthat occurred during widget destruction or initialization interruptions. This resolves random application failures under rapid operation or forced exit. - Fixed a
KeyError: 'TEXT_SUB'in the configuration to ensure the application's stability and correct color rendering across themes.
- Introduced the
- 🧩 MVC Architectural Separation:
- Logic Decoupling: All complex pricing formulas are strictly contained within the
PricingEnginestatic class. This complete separation from the UI layer significantly simplifies future maintenance and unit testing. - Configuration Centralization: All variables (e.g., margins, API URLs, colors) are defined in the
AppConfigclass, enhancing maintainability.
- Logic Decoupling: All complex pricing formulas are strictly contained within the
- 🌍 Thread Safety & Performance: The
ExchangeRateServiceutilizesthreading.Lock()and asynchronous fetching to ensure data integrity and prevent the GUI from freezing .
The application transitions from native Tkinter to CustomTkinter, adopting modern design standards:
- Visual Consistency: Utilizes Dark Mode with rounded, card-style layouts, providing a clean and professional aesthetic.
- Information Hierarchy: The bottom
DashboardViewhighlights the Member Price (large, primary color) while displaying the Standard Price in a muted, smaller font, prioritizing key user information. - Interaction Refinement: Buttons and input fields feature modern design touches and the status bar provides real-time feedback on synchronization status.
The PricingEngine has been definitively updated to correctly execute the final, complex pricing policy agreed upon:
| Pricing Scenario | Member Price Formula (Final AUD) | Standard (Non-Member) Price Formula (Final AUD) |
|---|---|---|
| Standard Book |
(Price + 15%) |
(Price + 15%) |
| Manager Recommend |
Base Member Price |
Base Member Price (Non-member gets member pricing) |
| Used Book | Input Price |
Input Price |