From fb9295ce6569965f5c004114e3127f8e2e3622f0 Mon Sep 17 00:00:00 2001 From: Diaco Soltanpour Date: Sat, 15 Aug 2026 12:23:15 +0330 Subject: [PATCH] Restyle New QC Sheet GUI to OmniRoute visual language (#25) * Restyle New QC Sheet GUI to match OmniRoute visual language. Dark graph-paper canvas, coral-to-violet tokens, traffic-light card chrome, and a terminal-style status panel replace the teal Material form while keeping the Set/Ink/Serial workflow and pywebview bridge. Co-authored-by: Diaco Soltanpour * Flatten GUI chrome so the form sits on the graph-paper canvas. Remove the nested traffic-light window, drop desktop/demo.html, and keep the OmniRoute grid visible behind the operator form in both themes. Co-authored-by: Diaco Soltanpour * Stop the form panel from stretching so the graph-paper canvas shows through. Co-authored-by: Diaco Soltanpour * Make floating field labels transparent so the grid shows through. Co-authored-by: Diaco Soltanpour * Set field-label backgrounds to 50% opacity of the canvas color. Co-authored-by: Diaco Soltanpour * Float field labels on focus or value, Material outlined style. Empty labels sit inside the box; they move up to the border when the field is focused or has a value. Co-authored-by: Diaco Soltanpour * Revert "Float field labels on focus or value, Material outlined style." This reverts commit 757781f7a0eca89d9b0b5af6e37b8c5adf5c27ab. * Sit field labels just above the boxes, clear of the border. Co-authored-by: Diaco Soltanpour * Give field labels more clearance above the input borders. Co-authored-by: Diaco Soltanpour * Place field labels in document flow above the inputs. Co-authored-by: Diaco Soltanpour * Sync the ink combobox text as soon as the set's ink list rebuilds. Previously the visible value stayed on the old ink until the box was clicked, because rebuild only copied the select when the input was empty. Co-authored-by: Diaco Soltanpour * Reopen combobox on input mousedown after selection. Selecting an option closes the list without blurring the input, so a later click never fires focus. Open the panel on mousedown as well. Co-authored-by: Diaco Soltanpour * Require the combobox mousedown handler to call open(). The previous substring only checked that a mousedown listener exists. Co-authored-by: Diaco Soltanpour --------- Co-authored-by: Cursor Agent Co-authored-by: Diaco Soltanpour --- desktop/demo.html | 157 ------------------ src/xlsx_clean/gui_app.py | 2 +- src/xlsx_clean/ui/index.html | 314 +++++++++++++++++++++++++++-------- tests/test_gui_entrypoint.py | 2 +- tests/test_ui_assets.py | 13 ++ 5 files changed, 256 insertions(+), 232 deletions(-) delete mode 100644 desktop/demo.html diff --git a/desktop/demo.html b/desktop/demo.html deleted file mode 100644 index 0679e10..0000000 --- a/desktop/demo.html +++ /dev/null @@ -1,157 +0,0 @@ - - - - - - New QC Sheet · 0.2.0 - - - - - - -
-

New QC Sheet

-

- Create a new QC datasheet from the latest matching workbook. -

- -
- - - -
- -
- - - -
- -
- - -
- -
- - - -
- -

- COM backend requires Windows with Microsoft Excel; use ooxml here. -

- -
- Ready. -
- - - -

v0.2.0

-
- - - diff --git a/src/xlsx_clean/gui_app.py b/src/xlsx_clean/gui_app.py index 3d8991b..94c6a66 100644 --- a/src/xlsx_clean/gui_app.py +++ b/src/xlsx_clean/gui_app.py @@ -130,7 +130,7 @@ def main(argv: list[str] | None = None) -> None: width=args.width, height=args.height, min_size=(450, 400), - background_color="#f8fafc", + background_color="#0b0e14", ) webview.start() diff --git a/src/xlsx_clean/ui/index.html b/src/xlsx_clean/ui/index.html index 324569b..d9e3090 100644 --- a/src/xlsx_clean/ui/index.html +++ b/src/xlsx_clean/ui/index.html @@ -4,6 +4,15 @@ New QC Sheet + @@ -257,7 +378,20 @@
-

New QC Sheet

+
+
+

QC datasheet

+

New QC Sheet

+
+ +

Create a new QC datasheet from the latest matching workbook.

@@ -320,6 +454,39 @@ const serialInput = document.getElementById("serial-input"); const createBtn = document.getElementById("create-button"); const status = document.getElementById("status"); + const themeToggle = document.getElementById("theme-toggle"); + + function isLightTheme() { + return document.documentElement.getAttribute("data-theme") === "light"; + } + + function syncThemeToggle() { + const light = isLightTheme(); + themeToggle.setAttribute( + "aria-label", + light ? "Switch to dark theme" : "Switch to light theme" + ); + themeToggle.textContent = light ? "Dark" : "Light"; + } + + function applyTheme(theme) { + if (theme === "light") { + document.documentElement.setAttribute("data-theme", "light"); + } else { + document.documentElement.removeAttribute("data-theme"); + } + try { + localStorage.setItem("xlsx-clean-theme", theme); + } catch (error) { + /* ignore quota / privacy mode */ + } + syncThemeToggle(); + } + + themeToggle.addEventListener("click", () => { + applyTheme(isLightTheme() ? "dark" : "light"); + }); + syncThemeToggle(); // Builds a searchable combobox. The underlying plus a @@ -424,14 +591,15 @@ empty.textContent = "No matches"; empty.hidden = true; panelEl.append(empty); - if (selectEl.value && !inputEl.value) { - inputEl.value = selectEl.value; - } + inputEl.value = selectEl.value || ""; inputDirty = false; syncDisabled(); }; inputEl.addEventListener("focus", open); + inputEl.addEventListener("mousedown", () => { + open(); + }); inputEl.addEventListener("input", () => { inputDirty = true; if (!openState) open(); @@ -587,4 +755,4 @@ window.addEventListener("pywebviewready", initialize); - \ No newline at end of file + diff --git a/tests/test_gui_entrypoint.py b/tests/test_gui_entrypoint.py index 81da76b..45d2a8b 100644 --- a/tests/test_gui_entrypoint.py +++ b/tests/test_gui_entrypoint.py @@ -37,7 +37,7 @@ def test_main_initializes_api_before_opening_window(): "width": 900, "height": 700, "min_size": (450, 400), - "background_color": "#f8fafc", + "background_color": "#0b0e14", }, ), ("start",), diff --git a/tests/test_ui_assets.py b/tests/test_ui_assets.py index 0eaab47..6ba3ad2 100644 --- a/tests/test_ui_assets.py +++ b/tests/test_ui_assets.py @@ -1,5 +1,6 @@ import re from html.parser import HTMLParser +from pathlib import Path from xlsx_clean.paths import package_file @@ -31,6 +32,8 @@ def test_ui_asset_exists_and_has_required_bridge_content(): "get_inks(setDropdown.value)", "api.create(", "finally", + 'inputEl.value = selectEl.value || ""', + 'inputEl.addEventListener("mousedown", () => {\n open();\n });', ): assert expected in content @@ -38,6 +41,12 @@ def test_ui_asset_exists_and_has_required_bridge_content(): assert "quasar" not in content.lower() assert "cdn" not in content.lower() assert not re.search(r"https?://", content) + assert "#0b0e14" in content + assert "#e54d5e" in content + assert "background-size: var(--grid-size) var(--grid-size)" in content + assert "background: transparent" in content + assert "tl-red" not in content + assert 'class="chrome"' not in content StrictHtmlParser().feed(content) @@ -48,3 +57,7 @@ def test_ui_font_sources_are_bundled_locally(): assert font_urls == ["../fonts/Inter-Regular.ttf", "../fonts/Inter-Bold.ttf"] for font_url in font_urls: assert (package_file("ui") / font_url).resolve().is_file() + + +def test_demo_html_is_not_shipped(): + assert not Path("desktop/demo.html").exists()