Switch UI to HTML based tools
Some checks failed
Mirror to Gitea / mirror (push) Has been cancelled

This commit is contained in:
2026-08-12 04:56:02 +03:30
parent 7c50480324
commit f1d9693966
19 changed files with 1523 additions and 489 deletions

View File

@@ -1,13 +0,0 @@
@echo off
REM Create a Desktop shortcut that points at desktop\XlsxClean.vbs
setlocal
cd /d "%~dp0\.."
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0Install-DesktopShortcut.ps1"
if errorlevel 1 (
echo Failed to create desktop shortcut.
pause
exit /b 1
)
echo Desktop shortcut created: New QC Sheet
pause

View File

@@ -1,29 +0,0 @@
# Creates %USERPROFILE%\Desktop\New QC Sheet.lnk -> desktop\XlsxClean.vbs
$ErrorActionPreference = "Stop"
$repoRoot = Split-Path -Parent $PSScriptRoot
$target = Join-Path $PSScriptRoot "XlsxClean.vbs"
$desktop = [Environment]::GetFolderPath("Desktop")
$shortcutPath = Join-Path $desktop "New QC Sheet.lnk"
if (-not (Test-Path $target)) {
throw "Launcher not found: $target"
}
# Remove older shortcut name if present
$legacy = Join-Path $desktop "XlsxClean.lnk"
if (Test-Path $legacy) {
Remove-Item $legacy -Force
}
$wsh = New-Object -ComObject WScript.Shell
$shortcut = $wsh.CreateShortcut($shortcutPath)
$shortcut.TargetPath = $target
$shortcut.WorkingDirectory = $repoRoot
$shortcut.WindowStyle = 7
$shortcut.Description = "Open New QC Sheet"
$iconCandidate = Join-Path $PSScriptRoot "xlsx-clean.ico"
if (Test-Path $iconCandidate) {
$shortcut.IconLocation = "$iconCandidate,0"
}
$shortcut.Save()
Write-Host "Created $shortcutPath"

View File

@@ -1,5 +1,5 @@
@echo off
REM One-time Windows setup with uv: sync deps from uv.lock, Desktop shortcut.
REM One-time Windows setup with uv: sync deps from uv.lock.
setlocal
cd /d "%~dp0\.."
@@ -20,14 +20,6 @@ if errorlevel 1 (
exit /b 1
)
echo Creating Desktop shortcut...
powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0Install-DesktopShortcut.ps1"
if errorlevel 1 (
echo Desktop shortcut step failed.
pause
exit /b 1
)
echo.
echo Setup complete. Double-click the New QC Sheet icon on your Desktop.
echo Setup complete. Create your own shortcut to desktop\XlsxClean.vbs.
pause

14
desktop/XlsxClean.command Executable file
View File

@@ -0,0 +1,14 @@
#!/usr/bin/env bash
# Operator launcher for New QC Sheet on macOS.
# Double-click in Finder (or run from Terminal). Opens the GUI in a new Terminal window.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
cd "$ROOT"
if [[ ! -x .venv/bin/python ]]; then
echo "Virtual environment not found. Run 'uv sync' first, or use desktop/setup_macos.sh." >&2
exit 1
fi
exec ./.venv/bin/python -m xlsx_clean.gui_app

157
desktop/demo.html Normal file
View File

@@ -0,0 +1,157 @@
<!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/web_app.py (_build_page).
Demo only — no create-datasheet behavior.
-->
<script src="https://cdn.tailwindcss.com"></script>
<script>
tailwind.config = {
theme: {
extend: {
colors: {
primary: "#0f766e",
secondary: "#115e59",
accent: "#14b8a6",
},
},
},
};
</script>
<style>
body {
font-family: Roboto, "Helvetica Neue", Helvetica, Arial, sans-serif;
background: #f8fafc;
min-height: 100vh;
}
.field {
position: relative;
width: 100%;
}
.field label {
position: absolute;
top: -0.55rem;
left: 0.75rem;
padding: 0 0.25rem;
font-size: 0.75rem;
line-height: 1;
color: #0f766e;
background: #fff;
z-index: 1;
}
.field select,
.field input {
width: 100%;
appearance: none;
border: 1px solid #cbd5e1;
border-radius: 0.25rem;
background: #fff;
padding: 0.85rem 2.25rem 0.85rem 0.85rem;
font-size: 1rem;
color: #0f172a;
outline: none;
}
.field select:focus,
.field input:focus {
border-color: #0f766e;
box-shadow: inset 0 0 0 1px #0f766e;
}
.field .chevron {
pointer-events: none;
position: absolute;
right: 0.85rem;
top: 50%;
transform: translateY(-50%);
color: #64748b;
font-size: 0.75rem;
}
.btn-primary {
width: 100%;
border: none;
border-radius: 0.25rem;
background: #0f766e;
color: #fff;
font-size: 0.95rem;
font-weight: 500;
letter-spacing: 0.02em;
text-transform: uppercase;
padding: 0.7rem 1rem;
cursor: default;
}
.btn-primary:hover {
background: #115e59;
}
</style>
</head>
<body>
<main class="w-full max-w-xl mx-auto p-6 flex flex-col gap-4">
<h1 class="text-3xl font-bold text-teal-800 m-0">New QC Sheet</h1>
<p class="text-gray-600 m-0">
Create a new QC datasheet from the latest matching workbook.
</p>
<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>
<p class="text-sm text-amber-700 m-0">
COM backend requires Windows with Microsoft Excel; use ooxml here.
</p>
<div class="w-full p-3 rounded bg-gray-50 text-slate-700">
Ready.
</div>
<button type="button" class="btn-primary" tabindex="-1">
Create datasheet
</button>
<p class="w-full text-right text-xs text-gray-400 m-0">v0.2.0</p>
</main>
</body>
</html>

View File

@@ -1,80 +0,0 @@
"""Install a Desktop shortcut that launches New QC Sheet."""
from __future__ import annotations
import os
import subprocess
import sys
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parents[1]
DESKTOP_DIR = Path(__file__).resolve().parent
APP_DISPLAY_NAME = "New QC Sheet"
def _user_desktop() -> Path:
if sys.platform == "win32":
return Path(os.environ.get("USERPROFILE", str(Path.home()))) / "Desktop"
# Linux / macOS
xdg = os.environ.get("XDG_DESKTOP_DIR")
if xdg:
return Path(xdg)
return Path.home() / "Desktop"
def install_windows() -> Path:
ps1 = DESKTOP_DIR / "Install-DesktopShortcut.ps1"
subprocess.run(
[
"powershell",
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-File",
str(ps1),
],
check=True,
)
return _user_desktop() / f"{APP_DISPLAY_NAME}.lnk"
def install_linux() -> Path:
desktop = _user_desktop()
desktop.mkdir(parents=True, exist_ok=True)
python = REPO_ROOT / ".venv" / "bin" / "python"
if not python.is_file():
python = Path(sys.executable)
out = desktop / f"{APP_DISPLAY_NAME}.desktop"
legacy = desktop / "XlsxClean.desktop"
if legacy.is_file():
legacy.unlink()
exec_line = f"{python} -m xlsx_clean.gui_app"
icon_png = DESKTOP_DIR / "xlsx-clean.png"
icon_line = str(icon_png) if icon_png.is_file() else "applications-office"
content = f"""[Desktop Entry]
Type=Application
Version=1.0
Name={APP_DISPLAY_NAME}
Comment=Create a new QC datasheet
Exec={exec_line}
Path={REPO_ROOT}
Icon={icon_line}
Terminal=false
Categories=Office;
StartupNotify=true
"""
out.write_text(content, encoding="utf-8")
out.chmod(out.stat().st_mode | 0o111)
return out
def main() -> None:
if sys.platform == "win32":
path = install_windows()
else:
path = install_linux()
print(f"Desktop shortcut created: {path}")
if __name__ == "__main__":
main()

View File

@@ -1,6 +1,5 @@
#!/usr/bin/env bash
# Operator setup for New QC Sheet on Linux desktops.
# Installs deps with uv and creates a Desktop shortcut.
# Operator setup for New QC Sheet on Debian/Ubuntu Linux desktops.
set -euo pipefail
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -11,13 +10,59 @@ if ! command -v uv >/dev/null 2>&1; then
exit 1
fi
echo "Syncing dependencies..."
uv sync
if ! command -v apt-get >/dev/null 2>&1; then
echo "This setup script requires apt-get (Debian/Ubuntu). Install python3-gi,"
echo "gir1.2-gtk-3.0, and gir1.2-webkit2-4.1 (or WebKit2 4.0) manually." >&2
exit 1
fi
echo "Installing Desktop shortcut..."
.venv/bin/python desktop/install_desktop_shortcut.py
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)
elif apt-cache show gir1.2-webkit2-4.0 >/dev/null 2>&1; then
packages+=(gir1.2-webkit2-4.0)
else
echo "Neither gir1.2-webkit2-4.1 nor gir1.2-webkit2-4.0 is available." >&2
exit 1
fi
missing=()
for package in "${packages[@]}"; do
if ! dpkg-query -W -f='${db:Status-Status}' "$package" 2>/dev/null | grep -qx installed; then
missing+=("$package")
fi
done
if ((${#missing[@]})); then
echo "Installing GTK/WebKitGTK requirements: ${missing[*]}"
sudo apt-get update
sudo apt-get install -y "${missing[@]}"
else
echo "GTK/WebKitGTK requirements already installed."
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
uv venv --python /usr/bin/python3 --no-managed-python --system-site-packages
fi
echo "Syncing dependencies..."
uv sync --active
echo "Verifying GTK and WebKit2 bindings..."
.venv/bin/python -c '
import gi
gi.require_version("Gtk", "3.0")
try:
gi.require_version("WebKit2", "4.1")
except ValueError:
gi.require_version("WebKit2", "4.0")
from gi.repository import Gtk, WebKit2
print("GTK/WebKit2 bindings available")
'
echo
echo "Done. Launch with:"
echo " .venv/bin/python -m xlsx_clean.gui_app"
echo "or use the Desktop shortcut."
echo "Create your own shortcut to that command."

View File

@@ -1,12 +0,0 @@
[Desktop Entry]
Type=Application
Version=1.0
Name=New QC Sheet
Comment=Create a new QC datasheet
# Exec is filled by install_desktop_shortcut.py; placeholder for manual edits:
Exec=bash -lc 'cd "$(dirname "%k")/.." && .venv/bin/python -m xlsx_clean.gui_app'
Path=
Icon=applications-office
Terminal=false
Categories=Office;
StartupNotify=true