Modernize the desktop UI: readable cards, light/dark theme, and a °C/°F toggle#62
Open
jgamblin wants to merge 14 commits into
Open
Modernize the desktop UI: readable cards, light/dark theme, and a °C/°F toggle#62jgamblin wants to merge 14 commits into
jgamblin wants to merge 14 commits into
Conversation
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Qt Style Sheets do not support the CSS font-variant-numeric property;
it was ignored and logged a warning on every restyle. Enable tabular
figures via QFont.setFeature(Tag('tnum')) guarded for older PyQt6.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nits Replace the inline SensorDisplay/PlotCanvas with the aircube_ui widgets, drop the hardcoded Segoe UI font and global stylesheet, and add a View menu with Appearance (System/Light/Dark) and Units (Celsius/Fahrenheit), both persisted via QSettings. CSV format and serial handling unchanged. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Code review found that MetricCard's value text kept the light-theme color after switching to dark (invisible on the dark card), because the guard keyed off the stylesheet string. Track a value-color override flag instead, so plain values follow the theme while the VOC band color is preserved. Also theme the CSV path/status labels via the palette rather than hardcoded hex. Adds regression tests for both behaviors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Labels with a per-widget color stylesheet were picking up the page background instead of the card surface, leaving mismatched boxes behind the metric text. Scope the background fill to QMainWindow and keep labels transparent so they show the surface behind them. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The auto light/dark theme relies on QStyleHints.colorScheme() (Qt 6.5+), so raise the floor from 6.4 to match. Drive the Connect/Disconnect button's disabled color from the palette instead of a fixed gray. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Locks the header and row layout (both temperature_c and temperature_f) so the desktop log stays compatible with the other AirCube scripts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Existing users see no change out of the box; System (follow the OS) and Dark remain available under View > Appearance. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This refreshes the
scripts/aircube_app.pydesktop GUI to fix a readability problem and bring the look up to date. No device behavior, serial protocol, or CSV format changes, and there are tests pinning that. The headline fix: the live sensor values were rendered in a near invisible low contrast color (only the color coded VOC value stood out). They are now crisp, high contrast metric cards with per reading accent colors and tabular numerals.Along the way it adds a light/dark theme (System, Light, or Dark), a Celsius/Fahrenheit toggle, and extracts the UI into a small, testable
aircube_ui/package, plus the unit tests CONTRIBUTING.md asks for.Before and after
Screenshots are attached just below this line (original UI, new light theme, new dark theme, and the °C/°F toggle). The same data is used in every shot.
Appearance default
The app defaults to Light, so existing users get the same out of box look as today (no behavior change). Dark, and a System mode that follows the OS light/dark setting, are opt in under View, then Appearance. The choice is remembered with QSettings.
What is preserved (no functional regressions)
temperature_candtemperature_fregardless of the display unit. This is now locked by a regression test (tests/test_csv_logging.py).parse_json_lineandSerialReaderThreadmoved verbatim).What changed
Readability and visuals:
Segoe UIfont with the platform UI font.New features:
Refactor:
scripts/aircube_ui/(theme.py,widgets.py,plotting.py,serial_reader.py) so appearance lives in one place and the pure logic is testable.aircube_app.pyis now mostly wiring. It runs the same way (python aircube_app.pyfromscripts/).Testing
cd scripts && python -m pytest), covering the serial parser, the VOC band and °C/°F math, the CSV log format, and a headless main window smoke test. The parser and color math tests are ones CONTRIBUTING.md lists as wanted.python build_exe.pystill produces a working standalone binary that bundles the new package. This is the same build that produces the Windows.exeon Releases.Dependency note
Bumped the PyQt6 floor to
>=6.5because the auto theme usesQStyleHints.colorScheme()(added in 6.5). Tabular numerals use theQFont.setFeaturefont API (6.7+) and degrade gracefully: they simply do not apply on 6.5 or 6.6, with no error.Scope
This is one cohesive change (refactor, restyle, and the two toggles). I am happy to split it into separate PRs, for example the refactor and restyle first, then the toggles, if you would prefer smaller reviews.