Compare commits

..

1 Commits

Author SHA1 Message Date
Cursor Agent
42d6192a42 Restyle New QC Sheet GUI to match OmniRoute visual language.
Some checks failed
Mirror to Gitea / mirror (push) Has been cancelled
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 <s-diaco@users.noreply.github.com>
2026-08-15 06:15:59 +00:00
5 changed files with 472 additions and 149 deletions

324
desktop/demo.html Normal file
View File

@@ -0,0 +1,324 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>New QC Sheet · 0.2.0</title>
<!--
Static UI mock of src/xlsx_clean/ui/index.html.
Demo only — no create-datasheet behavior.
-->
<style>
:root {
--primary: #e54d5e;
--accent-3: #a855f7;
--success: #22c55e;
--tl-red: #ff5f56;
--tl-yellow: #ffbd2e;
--tl-green: #27c93f;
--bg: #0b0e14;
--surface: #161b22;
--surface-2: #1c2230;
--border: rgba(255, 255, 255, 0.08);
--border-strong: rgba(255, 255, 255, 0.14);
--grid-line: rgba(255, 255, 255, 0.06);
--grid-size: 32px;
--text: #e6e6ef;
--text-muted: #8b8b9e;
--text-dim: #5a5a6e;
--grad-brand: linear-gradient(135deg, var(--primary), var(--accent-3));
--radius: 14px;
--radius-sm: 9px;
}
* { box-sizing: border-box; }
body {
min-height: 100vh;
margin: 0;
background: var(--bg);
color: var(--text);
font-family: Inter, ui-sans-serif, system-ui, sans-serif;
font-size: 15px;
}
body::before {
content: "";
position: fixed;
inset: 0;
z-index: -1;
pointer-events: none;
background-image:
linear-gradient(to right, var(--grid-line) 1px, transparent 1px),
linear-gradient(to bottom, var(--grid-line) 1px, transparent 1px);
background-size: var(--grid-size) var(--grid-size);
}
.page {
display: flex;
min-height: 100vh;
padding: 24px;
}
.panel {
display: flex;
flex-direction: column;
width: min(100%, 36rem);
margin: auto;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: 0 24px 60px -28px rgb(0 0 0 / 55%);
overflow: hidden;
}
.chrome {
display: flex;
align-items: center;
gap: 10px;
min-height: 40px;
padding: 0 14px;
background: var(--surface-2);
border-bottom: 1px solid var(--border);
}
.traffic {
display: flex;
gap: 6px;
}
.traffic span {
width: 10px;
height: 10px;
border-radius: 50%;
}
.tl-red { background: var(--tl-red); }
.tl-yellow { background: var(--tl-yellow); }
.tl-green { background: var(--tl-green); }
.chrome-title {
flex: 1;
color: var(--text-muted);
font-family: ui-monospace, monospace;
font-size: 0.75rem;
text-align: center;
}
.panel-body {
display: flex;
flex-direction: column;
padding: 22px;
}
.eyebrow {
margin: 0 0 8px;
color: var(--primary);
font-size: 0.75rem;
font-weight: 700;
letter-spacing: 0.08em;
text-transform: uppercase;
}
h1 {
margin: 0;
font-size: 1.875rem;
font-weight: 700;
letter-spacing: -0.02em;
}
.subtitle {
margin: 8px 0 22px;
color: var(--text-muted);
}
.fields { display: grid; gap: 18px; }
.field {
position: relative;
padding-top: 8px;
}
.field label {
position: absolute;
top: 0;
left: 11px;
padding: 0 4px;
background: var(--surface);
color: var(--primary);
font-size: 0.75rem;
z-index: 1;
}
.field select,
.field input {
width: 100%;
appearance: none;
border: 1px solid var(--border-strong);
border-radius: var(--radius-sm);
background: var(--surface-2);
padding: 0.85rem 2.25rem 0.85rem 0.85rem;
font-size: 1rem;
color: var(--text);
outline: none;
}
.field .chevron {
pointer-events: none;
position: absolute;
right: 0.85rem;
top: 50%;
transform: translateY(-50%);
color: var(--text-muted);
font-size: 0.75rem;
}
.divider {
height: 1px;
margin: 22px 0;
background: var(--border);
}
.btn-primary {
width: 100%;
border: none;
border-radius: var(--radius-sm);
background: var(--grad-brand);
color: #fff;
font-size: 0.875rem;
font-weight: 700;
letter-spacing: 0.04em;
text-transform: uppercase;
padding: 0.85rem 1rem;
cursor: default;
}
.note {
margin: 0 0 16px;
color: var(--warning, #f59e0b);
font-size: 0.85rem;
}
.terminal {
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--bg);
overflow: hidden;
}
.terminal-bar {
padding: 6px 12px;
border-bottom: 1px solid var(--border);
color: var(--text-dim);
font-family: ui-monospace, monospace;
font-size: 0.7rem;
text-transform: uppercase;
}
.status {
min-height: 48px;
padding: 12px;
color: var(--success);
font-family: ui-monospace, monospace;
font-size: 0.8rem;
}
.status::before {
content: "$ ";
color: var(--primary);
font-weight: 700;
}
.version {
margin: 16px 0 0;
color: var(--text-dim);
font-family: ui-monospace, monospace;
font-size: 0.75rem;
text-align: right;
}
</style>
</head>
<body>
<main class="page">
<section class="panel">
<div class="chrome">
<span class="traffic" aria-hidden="true">
<span class="tl-red"></span>
<span class="tl-yellow"></span>
<span class="tl-green"></span>
</span>
<span class="chrome-title">xlsx-clean — New QC Sheet</span>
</div>
<div class="panel-body">
<p class="eyebrow">QC datasheet</p>
<h1>New QC Sheet</h1>
<p class="subtitle">
Create a new QC datasheet from the latest matching workbook.
</p>
<div class="fields">
<div class="field">
<label>Select Set</label>
<select aria-label="Select Set" tabindex="-1">
<option selected>Kimia Razi</option>
<option>inco</option>
</select>
<span class="chevron" aria-hidden="true">▾</span>
</div>
<div class="field">
<label>Select Ink Color</label>
<select aria-label="Select Ink Color" tabindex="-1">
<option selected>KRCY1100T Blue</option>
<option>KRBK1300T Black</option>
<option>KRBK1314T Black</option>
<option>KRBR1200T Brown</option>
<option>KRBG1600T Beige</option>
<option>KRHN1700T Honey</option>
<option>KRPK1500T Pink</option>
</select>
<span class="chevron" aria-hidden="true">▾</span>
</div>
<div class="field">
<label>Serial:</label>
<input
type="text"
placeholder="e.g. 1234/A"
value=""
aria-label="Serial"
tabindex="-1"
readonly
/>
</div>
<div class="field">
<label>Backend</label>
<select aria-label="Backend" tabindex="-1">
<option selected>ooxml</option>
<option>com</option>
</select>
<span class="chevron" aria-hidden="true">▾</span>
</div>
</div>
<p class="note">
COM backend requires Windows with Microsoft Excel; use ooxml here.
</p>
<div class="divider"></div>
<button type="button" class="btn-primary" tabindex="-1">
Create datasheet
</button>
<div class="terminal" style="margin-top: 16px;">
<div class="terminal-bar">status</div>
<div class="status">Ready.</div>
</div>
<p class="version">v0.2.0</p>
</div>
</section>
</main>
</body>
</html>

View File

@@ -5,8 +5,6 @@ set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
SYS_PY=/usr/bin/python3
if ! command -v uv >/dev/null 2>&1; then
echo "uv not found on PATH. Install uv first: https://docs.astral.sh/uv/" >&2
exit 1
@@ -18,11 +16,6 @@ if ! command -v apt-get >/dev/null 2>&1; then
exit 1
fi
if [[ ! -x "$SYS_PY" ]]; then
echo "System Python not found at $SYS_PY" >&2
exit 1
fi
packages=(python3-gi gir1.2-gtk-3.0)
if apt-cache show gir1.2-webkit2-4.1 >/dev/null 2>&1; then
packages+=(gir1.2-webkit2-4.1)
@@ -48,23 +41,6 @@ else
echo "GTK/WebKitGTK requirements already installed."
fi
if ! "$SYS_PY" -c 'import gi' >/dev/null 2>&1; then
echo "System $SYS_PY cannot import gi. Install python3-gi." >&2
exit 1
fi
enable_system_site_packages() {
local cfg=.venv/pyvenv.cfg
if [[ ! -f "$cfg" ]]; then
return 1
fi
if grep -q '^include-system-site-packages' "$cfg"; then
sed -i 's/^include-system-site-packages = .*/include-system-site-packages = true/' "$cfg"
else
printf '\ninclude-system-site-packages = true\n' >> "$cfg"
fi
}
if [[ ! -x .venv/bin/python ]] || ! .venv/bin/python -c 'import gi' >/dev/null 2>&1; then
echo "Creating venv with the system Python and system site packages..."
rm -rf .venv
@@ -72,22 +48,7 @@ if [[ ! -x .venv/bin/python ]] || ! .venv/bin/python -c 'import gi' >/dev/null 2
fi
echo "Syncing dependencies..."
# Pin the same interpreter so uv does not honor .python-version (3.12) and
# recreate a managed venv without apt gi (python3-gi).
uv sync --python /usr/bin/python3 --no-managed-python
if ! .venv/bin/python -c 'import gi' >/dev/null 2>&1; then
echo "Restoring system site packages on .venv so apt gi is importable..."
enable_system_site_packages
fi
venv_ver="$(.venv/bin/python -c 'import sys; print("%d.%d" % sys.version_info[:2])')"
sys_ver="$("$SYS_PY" -c 'import sys; print("%d.%d" % sys.version_info[:2])')"
if [[ "$venv_ver" != "$sys_ver" ]]; then
echo "venv Python $venv_ver does not match system Python $sys_ver at $SYS_PY." >&2
echo "uv likely honored .python-version instead of the system interpreter." >&2
exit 1
fi
uv sync --active
echo "Verifying GTK and WebKit2 bindings..."
.venv/bin/python -c '

View File

@@ -39,6 +39,9 @@
--success: #22c55e;
--warning: #f59e0b;
--error: #ef4444;
--tl-red: #ff5f56;
--tl-yellow: #ffbd2e;
--tl-green: #27c93f;
--bg: #0b0e14;
--bg-alt: #111520;
--surface: #161b22;
@@ -61,7 +64,6 @@
--status-success: rgba(34, 197, 94, 0.12);
--status-skipped: rgba(245, 158, 11, 0.12);
--status-error: rgba(239, 68, 68, 0.12);
--label-bg: rgba(11, 14, 20, 0.5);
}
html[data-theme="light"] {
@@ -79,7 +81,6 @@
--status-success: rgba(34, 197, 94, 0.1);
--status-skipped: rgba(245, 158, 11, 0.12);
--status-error: rgba(239, 68, 68, 0.1);
--label-bg: rgba(249, 249, 251, 0.5);
}
* { box-sizing: border-box; }
@@ -115,31 +116,65 @@
.panel {
display: flex;
flex: 1;
flex-direction: column;
width: min(100%, 36rem);
margin: auto;
background: transparent;
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
box-shadow: 0 24px 60px -28px rgb(0 0 0 / 55%);
overflow: hidden;
}
.heading-row {
.chrome {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
align-items: center;
gap: 10px;
min-height: 40px;
padding: 0 14px;
background: var(--surface-2);
border-bottom: 1px solid var(--border);
}
.traffic {
display: flex;
gap: 6px;
flex-shrink: 0;
}
.traffic span {
width: 10px;
height: 10px;
border-radius: 50%;
}
.tl-red { background: var(--tl-red); }
.tl-yellow { background: var(--tl-yellow); }
.tl-green { background: var(--tl-green); }
.chrome-title {
flex: 1;
color: var(--text-muted);
font-family: var(--font-mono);
font-size: 0.75rem;
letter-spacing: 0.02em;
text-align: center;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
.theme-toggle {
display: inline-flex;
align-items: center;
justify-content: center;
flex-shrink: 0;
min-width: 52px;
height: 28px;
margin-top: 2px;
padding: 0 8px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--surface-2);
background: var(--surface);
color: var(--text);
cursor: pointer;
font: inherit;
@@ -160,6 +195,13 @@
outline-offset: 2px;
}
.panel-body {
display: flex;
flex: 1;
flex-direction: column;
padding: 22px 22px 18px;
}
.eyebrow {
margin: 0 0 8px;
color: var(--primary);
@@ -188,28 +230,27 @@
.field {
position: relative;
display: flex;
flex-direction: column;
align-items: flex-start;
gap: 6px;
display: block;
padding-top: 8px;
}
.field-label {
position: absolute;
z-index: 1;
margin-left: 4px;
top: 0;
left: 11px;
padding: 0 4px;
background: var(--label-bg);
background: var(--surface);
color: var(--primary);
font-size: 0.75rem;
line-height: 1.2;
line-height: 1rem;
pointer-events: none;
}
select, input {
width: 100%;
align-self: stretch;
min-height: 54px;
padding: 16px 12px;
padding: 16px 12px 6px;
border: 1px solid var(--border-strong);
border-radius: var(--radius-sm);
outline: none;
@@ -241,11 +282,11 @@
.combobox-caret {
position: absolute;
top: 0;
right: 12px;
bottom: 0;
display: flex;
align-items: center;
height: 54px;
color: var(--text-muted);
pointer-events: none;
font-size: 0.75rem;
@@ -337,12 +378,28 @@
#create-button:disabled { cursor: not-allowed; opacity: 0.65; }
.status {
min-height: 48px;
.terminal {
margin-top: 16px;
padding: 12px;
border: 1px solid var(--border);
border-radius: var(--radius-sm);
background: var(--bg);
overflow: hidden;
}
.terminal-bar {
padding: 6px 12px;
border-bottom: 1px solid var(--border);
color: var(--text-dim);
font-family: var(--font-mono);
font-size: 0.7rem;
letter-spacing: 0.04em;
text-transform: uppercase;
}
.status {
min-height: 48px;
margin: 0;
padding: 12px;
color: var(--text-muted);
font-family: var(--font-mono);
font-size: 0.8rem;
@@ -362,7 +419,8 @@
.status-error { background: var(--status-error); color: var(--error); }
.version {
margin-top: 16px;
margin: auto 0 0;
padding-top: 16px;
color: var(--text-dim);
font-family: var(--font-mono);
font-size: 0.75rem;
@@ -371,6 +429,7 @@
@media (max-width: 480px) {
.page { padding: 14px; }
.panel-body { padding: 18px 16px 14px; }
h1 { font-size: 1.5rem; }
}
</style>
@@ -378,11 +437,13 @@
<body>
<main class="page">
<section class="panel" aria-labelledby="heading">
<div class="heading-row">
<div>
<p class="eyebrow">QC datasheet</p>
<h1 id="heading">New QC Sheet</h1>
</div>
<div class="chrome">
<span class="traffic" aria-hidden="true">
<span class="tl-red"></span>
<span class="tl-yellow"></span>
<span class="tl-green"></span>
</span>
<span class="chrome-title">xlsx-clean — New QC Sheet</span>
<button
id="theme-toggle"
class="theme-toggle"
@@ -392,6 +453,9 @@
Aa
</button>
</div>
<div class="panel-body">
<p class="eyebrow">QC datasheet</p>
<h1 id="heading">New QC Sheet</h1>
<p class="subtitle">Create a new QC datasheet from the latest matching workbook.</p>
<div class="fields">
@@ -439,8 +503,12 @@
<div class="divider"></div>
<button id="create-button" type="button">Create datasheet</button>
<div class="terminal">
<div class="terminal-bar">status</div>
<div id="status" class="status status-ready" role="status">Loading configuration...</div>
</div>
<p id="version" class="version"></p>
</div>
</section>
</main>
@@ -591,15 +659,14 @@
empty.textContent = "No matches";
empty.hidden = true;
panelEl.append(empty);
inputEl.value = selectEl.value || "";
if (selectEl.value && !inputEl.value) {
inputEl.value = selectEl.value;
}
inputDirty = false;
syncDisabled();
};
inputEl.addEventListener("focus", open);
inputEl.addEventListener("mousedown", () => {
open();
});
inputEl.addEventListener("input", () => {
inputDirty = true;
if (!openState) open();

View File

@@ -1,19 +0,0 @@
from pathlib import Path
def test_setup_linux_pins_system_python_for_uv_sync():
script = Path("desktop/setup_linux.sh").read_text(encoding="utf-8")
assert "uv venv --python /usr/bin/python3 --no-managed-python --system-site-packages" in script
sync_lines = [
line.strip()
for line in script.splitlines()
if line.strip().startswith("uv sync")
]
assert sync_lines == [
"uv sync --python /usr/bin/python3 --no-managed-python"
]
assert "--python-preference" not in script
assert "uv sync --active" not in script
assert "include-system-site-packages = true" in script

View File

@@ -1,6 +1,5 @@
import re
from html.parser import HTMLParser
from pathlib import Path
from xlsx_clean.paths import package_file
@@ -32,8 +31,6 @@ 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
@@ -44,9 +41,6 @@ def test_ui_asset_exists_and_has_required_bridge_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)
@@ -57,7 +51,3 @@ 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()