diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md
index 920e4b3..8b23955 100644
--- a/.github/copilot-instructions.md
+++ b/.github/copilot-instructions.md
@@ -39,7 +39,7 @@ QuantUI/
│ ├── app_launcher.py ← `quantui run app` / `quantui view` Voilà launch
│ ├── app_viewer.py ← read-only viewer mode (History + Analysis only)
│ ├── app_workspace.py ← two-pane workspace: persistent viewer pane, view toolbar, atom list, status footer
-│ ├── app_pane_views.py ← Populations / Vibrational / Isosurface panels show their 3D view in the pane (one viewer)
+│ ├── app_pane_views.py ← Populations / Vibrational / Isosurface / Trajectory / Geometries panels (and PES-plot clicks) show their 3D view in the pane (one viewer; stepper controls stay in the panel)
│ ├── app_a11y.py ← page script for menu ARIA roles + arrow keys, dialog focus, live status region, skip link
│ ├── app_menubar.py ← menu bar (File / Calculate / View / Results / Help); items call existing handlers
│ ├── app_setup_dialog.py ← modal dialog that moves calc_setup_panel in and back out
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1a87c79..eca5a51 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,83 @@ and this project follows [Semantic Versioning](https://semver.org/spec/v2.0.0.ht
## [Unreleased]
+## [0.15.0] - 2026-12-06
+
+### Changed
+
+- **Trajectory, Geometries and PES Scan use the workspace pane's viewer.**
+ With the two-pane workspace on, the optimization trajectory (also the
+ frequency pre-optimization, IRC path and scan points), the reorganization
+ energy Geometries viewer and the PES Scan geometries play in the viewer
+ pane, with the same "Showing … — Back to structure" banner as the
+ Populations, Vibrational and Isosurface views. The play / step buttons,
+ slider, frame label and the energy plots stay in their panels and drive
+ the pane's viewer; the panel shows a one-line note where its viewer was.
+ Clicking a point on a 1-D PES profile or a 2-D PES map shows that point's
+ geometry in the pane, even before the Trajectory panel was opened.
+ Collapsing the panel, a new result or a Calculate-tab pick mode brings the
+ structure back. With the workspace turned off, each panel keeps its own
+ viewer as before.
+
+- **Menus say why an item is unavailable.** A greyed-out menu item now has a
+ short muted line under it with the reason ("Load a molecule first",
+ "Available after: Single Point, Geometry Opt"), so you no longer have to
+ hover to find out. Screen readers read the reason with the item; the
+ tooltip stays.
+- **No more emoji as status icons.** Error and warning texts use Font
+ Awesome icons in the app (XYZ errors, the Slurm error panel, the step
+ progress box, help notes, the "RI" badge) and plain words in plain text
+ (XYZ and charge/multiplicity errors, structure search messages, run
+ summaries such as "Warning: SCF did not converge"). Compare's Converged
+ column says Yes / **No**; the basis-set help table drops its emoji.
+- **Run boxes and the run log follow the theme.** The "Calculation failed",
+ "Calculation cancelled", "Result NOT saved" and dependency boxes, the
+ Slurm error panel and the cluster banner used light-only pinks and
+ yellows (a pale box on a dark page); they now use the palette's surfaces
+ with text that meets WCAG AA. A new `surface_error_bg` theme token backs
+ the error boxes. The coloured lines of the run log use theme colours too.
+- **Plot colours read on every theme.** Spectrum, energy-level, Compare,
+ charge and PES traces use one set of mid-tone data colours that keep at
+ least 3:1 contrast on light and dark backgrounds, also in exported files
+ (the blue occupied levels were 2.8:1 on Dark, the grey virtual levels
+ 1.7:1 on Bright). Grid and axis colours of the plot modules come from the
+ theme. The Bright theme's teal is a little darker so teal log lines meet
+ 4.5:1.
+- **Scrollbars and selected text follow the theme.** Scrollbars use the
+ palette's border and panel colours instead of the browser's light
+ default, and selected text is highlighted in the theme's accent.
+- **Fewer boxes inside boxes.** A tab set inside another tab's panel (the
+ Library / XYZ Input / Online Search / Upload File tabs under Molecule
+ Input) no longer draws its own frame and background; a single line under
+ its tab bar keeps the tabs grouped with their content.
+- **Run answers the click at once.** The moment you click Run (or Run in
+ the menu or the setup dialog), the button turns into a spinner reading
+ "Starting…", the run status, the header chip and the footer say
+ "Starting…", and screen readers hear "Starting the calculation…" — before
+ any checks or program output. Then the usual "Running …" states take
+ over, and the button reads "Running…" until the run ends. If the run
+ does not start (a setting to fix, say), Run comes straight back with the
+ reason.
+- **Screen readers can name icon buttons and unlabelled fields.** Buttons
+ that show only an icon or a glyph (the "?" help buttons, refresh, trash,
+ previous / next, the viewer frame steppers) take their tooltip as their
+ accessible name, so a screen reader says "RHF vs UHF — opens Help tab"
+ instead of "question mark". Fields without a visible label (the engine
+ and execution menus, the atom table's symbol and x / y / z boxes, the
+ orbital gallery span, the Compare export format, the Files list) have a
+ name too, and the hidden helper fields used for PNG capture and atom
+ picking are no longer in the Tab order.
+
+### Fixed
+
+- Slider tracks show again in Chromium-based browsers (the Trajectory,
+ Geometries and vibration steppers drew only the handle): the slider style
+ mixed rules for two browser engines in one selector list, which browsers
+ discard as a whole.
+- Clicking the gold "minimum" star on a 1-D PES profile opens that scan
+ point's geometry (it opened the first point); clicking a failed point no
+ longer opens an unrelated geometry.
+
## [0.14.0] - 2026-12-05
### Added
@@ -1917,7 +1994,8 @@ Initial public scaffolding of the QuantUI package: `quantui` package with
`calculator.py`, basic notebook launcher, Apptainer container definition,
MIT license, and project metadata.
-[Unreleased]: https://github.com/The-Schultz-Lab/QuantUI/compare/v0.14.0...HEAD
+[Unreleased]: https://github.com/The-Schultz-Lab/QuantUI/compare/v0.15.0...HEAD
+[0.15.0]: https://github.com/The-Schultz-Lab/QuantUI/compare/v0.14.0...v0.15.0
[0.14.0]: https://github.com/The-Schultz-Lab/QuantUI/compare/v0.13.2...v0.14.0
[0.13.2]: https://github.com/The-Schultz-Lab/QuantUI/compare/v0.13.1...v0.13.2
[0.13.1]: https://github.com/The-Schultz-Lab/QuantUI/compare/v0.13.0...v0.13.1
diff --git a/CLAUDE.md b/CLAUDE.md
index db4c1a3..381c05f 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -63,7 +63,7 @@ pytest tests/test_foo.py -n0 # one test, serial (breakpoints work; -n=auto is o
pre-commit run --all-files # file hygiene + nbstripout + black (26.5.1) + ruff (v0.16.0); mypy runs on pre-push and in CI
```
-Test baseline (see STATUS): **~5410 passed / 11 skipped** for
+Test baseline (see STATUS): **~6219 passed / 11 skipped** for
`pytest -m "not network and not weekly"` (what PR CI runs; cloud, Python 3.11,
2026-12). `weekly`-marked tests (full backend cross-check, PyFock cases) run in
`.github/workflows/xcheck-weekly.yml`. `network`-marked tests
diff --git a/pyproject.toml b/pyproject.toml
index 6649468..dd9f197 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -11,7 +11,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "quantui"
-version = "0.14.0"
+version = "0.15.0"
description = "An open-source frontend for DFT and post-HF quantum chemistry with PySCF"
readme = "README.md"
requires-python = ">=3.9"
diff --git a/quantui/__init__.py b/quantui/__init__.py
index 24b238e..da70853 100644
--- a/quantui/__init__.py
+++ b/quantui/__init__.py
@@ -7,7 +7,7 @@
PySCF requires Linux/macOS/WSL. Windows users should use the Apptainer container.
"""
-__version__ = "0.14.0"
+__version__ = "0.15.0"
import logging
from typing import Any
diff --git a/quantui/app.py b/quantui/app.py
index 957147f..a70e492 100644
--- a/quantui/app.py
+++ b/quantui/app.py
@@ -302,6 +302,9 @@
from quantui.app_runflow import (
frozen_atom_indices as _run_frozen_atoms,
)
+from quantui.app_runflow import (
+ mark_run_running as _run_mark_running,
+)
from quantui.app_runflow import (
on_accumulate as _run_on_accumulate,
)
@@ -407,6 +410,9 @@
from quantui.app_runflow import (
on_reset_click as _run_on_reset_click,
)
+from quantui.app_runflow import (
+ on_run_button_disabled_changed as _run_on_run_button_disabled_changed,
+)
from quantui.app_runflow import (
on_run_clicked as _run_on_run_clicked,
)
@@ -1048,6 +1054,13 @@ class carries a per-app uid suffix. LiveLog also sets the stack inline — this
height: auto !important;
}
.quantui-history-recent:hover { text-decoration: underline !important; }
+/* Run clicked / running (UX-34): busy, not "unavailable". Outranks the
+ dashed disabled look of theme.disabled_button_css. */
+button.jupyter-button.mod-success.quantui-run-busy:disabled {
+ border-style: solid !important;
+ color: var(--q-text-body) !important;
+ cursor: progress !important;
+}
/* Job status: a chip, not a button (UX-4). Hover still shows its tooltip. */
.quantui-status-chip {
cursor: default !important;
@@ -3349,6 +3362,11 @@ def _wire_callbacks(self) -> None:
self.calc_type_help_btn.on_click(self._on_calc_type_help)
# Run
self.run_btn.on_click(self._on_run_clicked)
+ # Run re-enabled however the run ended: back to its idle label (UX-34).
+ self.run_btn.observe(
+ self._safe_cb(lambda ch: _run_on_run_button_disabled_changed(self, ch)),
+ names="disabled",
+ )
self._slurm_reconnect_btn.on_click(
self._safe_cb(lambda _btn: _slurm_on_reconnect_clicked(self, _btn))
)
@@ -4151,7 +4169,7 @@ def _preview_file_path(self, path: Path) -> None:
"
| Small single points | "
" Roughly neutral, sometimes slightly "
@@ -1602,8 +1602,8 @@ def help_panel(topic: str) -> widgets.HTML:
entry = HELP_TOPICS[topic]
html = (
f''
- f''
- f'ℹ️ {entry["title"]}'
+ f''
+ f' {entry["title"]}'
f'{entry["body"]} '
f" "
)
diff --git a/quantui/ir_plot.py b/quantui/ir_plot.py
index 8452a31..f24bf26 100644
--- a/quantui/ir_plot.py
+++ b/quantui/ir_plot.py
@@ -57,6 +57,8 @@
import numpy as np
import plotly.graph_objects as go
+from quantui.theme import PLOT_DATA_COLORS, plot_chrome
+
# x-axis range is low → high wavenumber; ``plot_ir_spectrum(descending=True)``
# flips it to the FTIR convention (high → low), which the app uses by default.
# This used to be the FIXED plot range/grid
@@ -195,7 +197,7 @@ def plot_ir_spectrum(
scale_factor: float = 1.0,
lineshape: str = "lorentzian",
yaxis_mode: str = "intensity",
- color: str = "#2563eb",
+ color: str = PLOT_DATA_COLORS["blue"],
) -> go.Figure:
"""Return a Plotly figure for the IR absorption spectrum.
@@ -222,7 +224,8 @@ def plot_ir_spectrum(
``"transmittance"`` (%T, bands pointing down).
color: Line, stick and marker colour. The app passes the theme's
info accent so the spectrum reads on every palette (UX-20); the
- default suits a white page.
+ default is a mid-tone blue that keeps 3:1 on light and dark
+ backgrounds (UX-32).
Returns:
:class:`plotly.graph_objects.Figure` ready for display or wrapping
@@ -245,21 +248,21 @@ def plot_ir_spectrum(
title="Transmittance (%)",
range=[0, 105],
showgrid=True,
- gridcolor="#e5e7eb",
+ gridcolor=plot_chrome()["grid_color"],
)
else:
yaxis = dict(
title=yaxis_title,
rangemode="tozero",
showgrid=True,
- gridcolor="#e5e7eb",
+ gridcolor=plot_chrome()["grid_color"],
)
_base_layout = dict(
xaxis=dict(
title=x_title,
range=xrange[::-1] if descending else xrange,
showgrid=True,
- gridcolor="#e5e7eb",
+ gridcolor=plot_chrome()["grid_color"],
),
yaxis=yaxis,
template="plotly_white",
diff --git a/quantui/molecule.py b/quantui/molecule.py
index a68444e..0795b53 100644
--- a/quantui/molecule.py
+++ b/quantui/molecule.py
@@ -141,7 +141,7 @@ def _validate(self):
num_electrons = self.get_electron_count()
if num_electrons < 1:
raise ValueError(
- f"❌ Charge Error: charge {self.charge:+d} leaves "
+ f"Charge Error: charge {self.charge:+d} leaves "
f"{num_electrons} electrons — the atoms only have "
f"{num_electrons + self.charge}. Lower the charge."
)
@@ -150,7 +150,7 @@ def _validate(self):
# (H2 has 2 electrons, so multiplicity 5 is impossible).
if self.multiplicity - 1 > num_electrons:
raise ValueError(
- f"❌ Multiplicity Error: Multiplicity {self.multiplicity} needs "
+ f"Multiplicity Error: Multiplicity {self.multiplicity} needs "
f"{self.multiplicity - 1} unpaired electrons, but this molecule "
f"has only {num_electrons}. Lower the multiplicity."
)
@@ -170,11 +170,11 @@ def _validate(self):
valid_str = ", ".join(str(m) for m in valid_mults)
raise ValueError(
- f"❌ Multiplicity Error: Multiplicity {self.multiplicity} is incompatible with "
+ f"Multiplicity Error: Multiplicity {self.multiplicity} is incompatible with "
f"{num_electrons} electrons.\n\n"
- f"💡 Explanation: This molecule has {num_electrons} electrons (an "
+ f"Explanation: This molecule has {num_electrons} electrons (an "
f"{'even' if num_electrons % 2 == 0 else 'odd'} number), so the {explanation}.\n\n"
- f"✅ Valid multiplicities for this molecule: {valid_str}\n\n"
+ f"Valid multiplicities for this molecule: {valid_str}\n\n"
f"Common values:\n"
f" • Multiplicity 1 (singlet) = all electrons paired\n"
f" • Multiplicity 2 (doublet) = 1 unpaired electron (radical)\n"
@@ -448,7 +448,7 @@ def parse_xyz_input(xyz_text: str) -> Tuple[List[str], List[List[float]]]:
xyz_text = normalize_xyz_text(xyz_text)
if not xyz_text or not xyz_text.strip():
raise ValueError(
- "❌ Empty Input: Please provide XYZ coordinates.\n\n"
+ "Empty Input: Please provide XYZ coordinates.\n\n"
"Expected format:\n"
" ATOM X Y Z\n\n"
"Example:\n"
@@ -498,10 +498,10 @@ def parse_xyz_input(xyz_text: str) -> Tuple[List[str], List[List[float]]]:
# The second frame's count line used to fail as
# "Line N: not enough values", which says nothing useful.
raise ValueError(
- f"❌ This looks like a multi-frame XYZ file ({n_frames} "
+ f"This looks like a multi-frame XYZ file ({n_frames} "
f"structures of {expected_atoms} atoms each, e.g. an "
"optimization trajectory).\n\n"
- "💡 Paste only one structure (one count line, one title line, "
+ "Tip: paste only one structure (one count line, one title line, "
"then the atom lines), or load the whole file with the "
"Upload File tab, which takes the last structure."
)
@@ -536,7 +536,7 @@ def parse_xyz_input(xyz_text: str) -> Tuple[List[str], List[List[float]]]:
if not processed_lines:
raise ValueError(
- "❌ No Data: All lines are empty or comments.\n\n"
+ "No Data: All lines are empty or comments.\n\n"
"Please provide at least 1 atom with coordinates."
)
@@ -552,11 +552,11 @@ def parse_xyz_input(xyz_text: str) -> Tuple[List[str], List[List[float]]]:
# Check minimum parts (atom symbol + 3 coordinates)
if len(parts) < 4:
raise ValueError(
- f"❌ Line {orig_line_num}: Invalid format - not enough values.\n\n"
+ f"Line {orig_line_num}: Invalid format - not enough values.\n\n"
f"Got: {line}\n"
f"Expected format: ATOM X Y Z\n\n"
f"Example: H 0.0 0.0 0.74\n\n"
- f"💡 Make sure each line has:\n"
+ f"Make sure each line has:\n"
f" 1. Atom symbol (H, C, N, O, etc.)\n"
f" 2. Three coordinate values (X, Y, Z)"
)
@@ -607,17 +607,17 @@ def parse_xyz_input(xyz_text: str) -> Tuple[List[str], List[List[float]]]:
# Build error message
error_msg = (
- f"❌ Line {orig_line_num}: Invalid atom symbol '{atom_symbol}'.\n\n"
+ f"Line {orig_line_num}: Invalid atom symbol '{atom_symbol}'.\n\n"
f"Got: {line}\n"
)
if suggestions:
- error_msg += "\n💡 Suggestions:\n"
+ error_msg += "\nSuggestions:\n"
for suggestion in suggestions:
error_msg += f" • {suggestion}\n"
else:
error_msg += (
- "\n💡 Valid atom symbols include:\n"
+ "\nValid atom symbols include:\n"
" • H, C, N, O, F, P, S, Cl, Br, I\n"
" • Li, Be, B, Na, Mg, Al, Si\n"
" • K, Ca, Fe, Cu, Zn, etc.\n"
@@ -631,19 +631,19 @@ def parse_xyz_input(xyz_text: str) -> Tuple[List[str], List[List[float]]]:
x, y, z = _xyz_float(parts[1]), _xyz_float(parts[2]), _xyz_float(parts[3])
except ValueError as e:
raise ValueError(
- f"❌ Line {orig_line_num}: Could not parse coordinates as numbers.\n\n"
+ f"Line {orig_line_num}: Could not parse coordinates as numbers.\n\n"
f"Got: {line}\n"
f"Values: X={parts[1]}, Y={parts[2]}, Z={parts[3]}\n\n"
- f"💡 Coordinates must be numbers (integers or decimals).\n"
+ f"Coordinates must be numbers (integers or decimals).\n"
f"Examples: 0.0, 1.5, -2.3, 0.757\n\n"
f"Error details: {e}"
) from e
if not all(math.isfinite(v) for v in (x, y, z)):
raise ValueError(
- f"❌ Line {orig_line_num}: Coordinates must be finite numbers.\n\n"
+ f"Line {orig_line_num}: Coordinates must be finite numbers.\n\n"
f"Got: {line}\n\n"
- f"💡 'nan' and 'inf' are not positions — re-export the "
+ f"Tip: 'nan' and 'inf' are not positions — re-export the "
f"structure or fix this line."
)
@@ -653,7 +653,7 @@ def parse_xyz_input(xyz_text: str) -> Tuple[List[str], List[List[float]]]:
# Validate we got atoms
if not atoms:
raise ValueError(
- "❌ No atoms found in input after parsing.\n\n"
+ "No atoms found in input after parsing.\n\n"
"Please check your coordinate format."
)
@@ -662,9 +662,9 @@ def parse_xyz_input(xyz_text: str) -> Tuple[List[str], List[List[float]]]:
# calculation on the wrong molecule.
if expected_atoms is not None and len(atoms) != expected_atoms:
raise ValueError(
- f"❌ Atom count mismatch: the XYZ header says {expected_atoms} "
+ f"Atom count mismatch: the XYZ header says {expected_atoms} "
f"atoms, but {len(atoms)} atom line(s) were found.\n\n"
- "💡 The paste may be truncated. Paste the complete structure, or "
+ "Tip: the paste may be truncated. Paste the complete structure, or "
"fix (or delete) the count line at the top."
)
diff --git a/quantui/mulliken_plot.py b/quantui/mulliken_plot.py
index ca34215..1ab085a 100644
--- a/quantui/mulliken_plot.py
+++ b/quantui/mulliken_plot.py
@@ -11,6 +11,8 @@
import plotly.graph_objects as go
+from quantui.theme import PLOT_DATA_COLORS, plot_chrome
+
def plot_mulliken_charges(
atom_symbols: Sequence[str],
@@ -30,7 +32,10 @@ def plot_mulliken_charges(
"""
labels: List[str] = [f"{sym}{i + 1}" for i, sym in enumerate(atom_symbols)]
values = [float(c) for c in charges]
- colors = ["#2563eb" if c >= 0 else "#dc2626" for c in values]
+ colors = [
+ PLOT_DATA_COLORS["blue"] if c >= 0 else PLOT_DATA_COLORS["red"] for c in values
+ ]
+ chrome = plot_chrome()
fig = go.Figure(
data=[
@@ -47,15 +52,15 @@ def plot_mulliken_charges(
title=f"{scheme} charge (e)",
zeroline=True,
zerolinewidth=1.5,
- zerolinecolor="#9ca3af",
+ zerolinecolor=chrome["axis_line_color"],
showgrid=True,
- gridcolor="#e5e7eb",
+ gridcolor=chrome["grid_color"],
),
template="plotly_white",
showlegend=False,
margin=dict(l=60, r=20, t=20, b=55),
height=height,
- plot_bgcolor="#fafafa",
+ plot_bgcolor=chrome["plot_bgcolor"],
),
)
return fig
diff --git a/quantui/nmr_plot.py b/quantui/nmr_plot.py
index bd20c87..92e49ac 100644
--- a/quantui/nmr_plot.py
+++ b/quantui/nmr_plot.py
@@ -11,6 +11,8 @@
import plotly.graph_objects as go
+from quantui.theme import PLOT_DATA_COLORS, plot_chrome
+
# Typical display windows (ppm) when peaks are sparse.
_DEFAULT_XRANGE = {
"¹H": (0.0, 12.0),
@@ -179,7 +181,7 @@ def plot_nmr_spectrum(
title="Chemical shift δ (ppm)",
range=[xmax, xmin] if descending else [xmin, xmax],
showgrid=True,
- gridcolor="#e5e7eb",
+ gridcolor=plot_chrome()["grid_color"],
),
yaxis=dict(
title="",
@@ -192,7 +194,7 @@ def plot_nmr_spectrum(
showlegend=False,
margin=dict(l=60, r=20, t=20, b=55),
height=300,
- plot_bgcolor="#fafafa",
+ plot_bgcolor=plot_chrome()["plot_bgcolor"],
)
)
@@ -231,7 +233,7 @@ def plot_nmr_spectrum(
x=stick_x,
y=stick_y,
mode="lines",
- line=dict(color="#0d9488", width=2),
+ line=dict(color=PLOT_DATA_COLORS["teal"], width=2),
name=f"{nucleus_label} (stick)",
hoverinfo="skip",
)
@@ -243,7 +245,7 @@ def plot_nmr_spectrum(
mode="markers+text",
text=hover_labels,
textposition="top center",
- marker=dict(color="#0f766e", size=7),
+ marker=dict(color=PLOT_DATA_COLORS["teal"], size=7),
showlegend=False,
customdata=[len(g) for g in groups],
hovertemplate=(
diff --git a/quantui/optimizer.py b/quantui/optimizer.py
index 8e97320..350777f 100644
--- a/quantui/optimizer.py
+++ b/quantui/optimizer.py
@@ -283,7 +283,7 @@ def calculate(
if not self.gpu_used:
try:
self.progress_stream.write(
- f"\n🚀 GPU offload active — running on {_gpu_name}\n"
+ f"\nGPU offload active — running on {_gpu_name}\n"
)
except Exception: # noqa: BLE001 — stream is user-owned
pass
@@ -467,7 +467,7 @@ def summary(self) -> str:
"=" * 60,
f" Molecule : {self.formula}",
f" Method/Basis : {self.method}/{self.basis}",
- f" Converged : {'Yes' if self.converged else '❌ NO — max steps reached'}",
+ f" Converged : {'Yes' if self.converged else 'NO — max steps reached'}",
f" Steps taken : {self.n_steps}",
f" Final energy : {self.energy_hartree:.8f} Ha",
f" Energy change : {self.energy_change_hartree:+.6f} Ha",
@@ -475,10 +475,10 @@ def summary(self) -> str:
"=" * 60,
]
if self.converged:
- lines.append("✅ Optimization converged successfully!")
+ lines.append("Optimization converged successfully.")
else:
lines.append(
- "⚠️ Optimization did not converge.\n"
+ "Warning: Optimization did not converge.\n"
" Try increasing Max Steps, loosening Force Threshold,\n"
" or using LJ pre-optimization to improve the starting geometry."
)
@@ -842,7 +842,7 @@ def optimize_geometry(
if _pyfock_use_gpu:
_write_stream(
_stream,
- f"\n🚀 PyFock GPU acceleration active — running on "
+ f"\nPyFock GPU acceleration active — running on "
f"{_pyfock_gpu_name}. GPU force evaluation uses numerical "
"gradients because PyFock analytical GPU gradients are not "
"available in the installed release.\n",
diff --git a/quantui/orbital_visualization.py b/quantui/orbital_visualization.py
index a5f3456..87fea13 100644
--- a/quantui/orbital_visualization.py
+++ b/quantui/orbital_visualization.py
@@ -30,6 +30,15 @@
logger = logging.getLogger(__name__)
+# Energy-level diagram colours: mid-tones that keep 3:1 on light and dark
+# plot backgrounds (UX-32; the old #2171b5 was 2.85:1 on Dark and the grey
+# virtual levels 1.7:1 on Bright).
+_C_OCC = _theme.PLOT_DATA_COLORS["blue"]
+_C_LUMO = _theme.PLOT_DATA_COLORS["orange"]
+_C_VIRT = _theme.PLOT_DATA_COLORS["grey"]
+# Chrome defaults for figures built outside the app (the app re-themes).
+_CHROME = _theme.plot_chrome()
+
# Conversion factor — PySCF stores MO energies in Hartree
HARTREE_TO_EV: float = 27.211386245988
BOHR_PER_ANGSTROM: float = 1.8897261254578281
@@ -280,7 +289,7 @@ def plot_orbital_diagram(
# Draw energy levels
line_half_width = 0.3
for i, (e, occ) in enumerate(zip(subset, subset_occ)):
- color = "#2171b5" if occ else "#bdbdbd"
+ color = _C_OCC if occ else _C_VIRT
lw = 2.5 if (start + i == n_occ - 1 or start + i == n_occ) else 1.5
ax.plot(
[-line_half_width, line_half_width],
@@ -304,7 +313,7 @@ def plot_orbital_diagram(
ax.plot(
[beta_dx - line_half_width, beta_dx + line_half_width],
[e_b[j], e_b[j]],
- color="#2171b5" if j < n_occ_b else "#bdbdbd",
+ color=_C_OCC if j < n_occ_b else _C_VIRT,
linewidth=2.5 if j in (n_occ_b - 1, n_occ_b) else 1.5,
solid_capstyle="round",
)
@@ -321,7 +330,7 @@ def plot_orbital_diagram(
xy=(beta_dx + line_half_width + 0.05, info.homo_energy_ev),
fontsize=10,
fontweight="bold",
- color="#2171b5",
+ color=_C_OCC,
va="center",
)
@@ -331,7 +340,7 @@ def plot_orbital_diagram(
xy=(beta_dx + line_half_width + 0.05, info.lumo_energy_ev),
fontsize=10,
fontweight="bold",
- color="#e6550d",
+ color=_C_LUMO,
va="center",
)
@@ -342,7 +351,7 @@ def plot_orbital_diagram(
"",
xy=(mid_x, info.lumo_energy_ev),
xytext=(mid_x, info.homo_energy_ev),
- arrowprops=dict(arrowstyle="<->", color="#e6550d", lw=1.5),
+ arrowprops=dict(arrowstyle="<->", color=_C_LUMO, lw=1.5),
)
gap_mid = (info.homo_energy_ev + info.lumo_energy_ev) / 2.0
ax.text(
@@ -350,7 +359,7 @@ def plot_orbital_diagram(
gap_mid,
f"{info.homo_lumo_gap_ev:.2f} eV",
fontsize=9,
- color="#e6550d",
+ color=_C_LUMO,
ha="right",
va="center",
fontweight="bold",
@@ -372,8 +381,8 @@ def plot_orbital_diagram(
)
# Legend
- occ_patch = mpatches.Patch(color="#2171b5", label="Occupied")
- virt_patch = mpatches.Patch(color="#bdbdbd", label="Virtual")
+ occ_patch = mpatches.Patch(color=_C_OCC, label="Occupied")
+ virt_patch = mpatches.Patch(color=_C_VIRT, label="Virtual")
ax.legend(handles=[occ_patch, virt_patch], loc="lower right", fontsize=9)
fig.tight_layout()
@@ -524,16 +533,16 @@ def _sym(idx: int) -> str:
name = f"MO #{idx + 1}{tag}{ch_sym(idx)}"
if is_homo:
- color, lw = "#2171b5", 3.0
+ color, lw = _C_OCC, 3.0
hover = f"{name} — HOMO {e:+.4f} eV"
elif is_lumo:
- color, lw = "#e6550d", 3.0
+ color, lw = _C_LUMO, 3.0
hover = f"{name} — LUMO {e:+.4f} eV"
elif is_occ:
- color, lw = "#2171b5", 1.5
+ color, lw = _C_OCC, 1.5
hover = f"{name} (occupied) {e:+.4f} eV"
else:
- color, lw = "#9e9e9e", 1.5
+ color, lw = _C_VIRT, 1.5
hover = f"{name} (virtual) {e:+.4f} eV"
traces.append(
@@ -579,7 +588,7 @@ def _sym(idx: int) -> str:
yref="y",
text=f"HOMO{homo_lbl}",
showarrow=False,
- font=dict(size=fs_label, color="#2171b5"),
+ font=dict(size=fs_label, color=_C_OCC),
xanchor="left",
yanchor="middle",
),
@@ -593,7 +602,7 @@ def _sym(idx: int) -> str:
yref="y",
text=f"LUMO{lumo_lbl}",
showarrow=False,
- font=dict(size=fs_label, color="#e6550d"),
+ font=dict(size=fs_label, color=_C_LUMO),
xanchor="left",
yanchor="middle",
),
@@ -607,10 +616,10 @@ def _sym(idx: int) -> str:
axref="x",
ayref="y",
text=f"{gap:.2f} eV",
- font=dict(size=fs_gap, color="#e6550d"),
+ font=dict(size=fs_gap, color=_C_LUMO),
arrowhead=2,
arrowwidth=1.5,
- arrowcolor="#e6550d",
+ arrowcolor=_C_LUMO,
xanchor="right",
),
]
@@ -692,7 +701,7 @@ def _sym(idx: int) -> str:
title=dict(text="Energy (eV)", font=dict(size=fs_axis)),
range=[y_min, y_max],
showgrid=True,
- gridcolor="#e5e7eb",
+ gridcolor=_CHROME["grid_color"],
tickformat=".1f",
tickfont=dict(size=fs_axis),
),
@@ -717,8 +726,8 @@ def orbital_summary_html(info: OrbitalInfo) -> str:
"""
a = " (α)" if _is_unrestricted(info) else "" # counts below are alpha-only
return (
- ''
+ ' '
f" Orbital Summary — {_html_escape(info.formula)}"
f"Occupied MOs{a}: {info.n_occupied} | "
f"Virtual MOs{a}: {info.n_virtual} | "
@@ -1605,7 +1614,7 @@ def orbital_colors(scheme: str) -> tuple[str, str]:
range:__RANGE__};
function v(){ return window["viewer_"+UID]; }
- // ⚠️ Isosurfaces are SHAPES, not surfaces. viewer.addVolumetricData() routes
+ // NOTE: Isosurfaces are SHAPES, not surfaces. viewer.addVolumetricData() routes
// to addIsosurface(), which does this.shapes.push(...) — so
// removeAllSurfaces() iterates this.surfaces, finds nothing, and removes
// nothing. Using it meant every update stacked another layer on the old one:
@@ -2162,10 +2171,10 @@ def plot_cube_isosurface(
show_molecule: bool = False,
show_grid: bool = True,
scene_bgcolor: str = "white",
- axis_color: str = "#111827",
+ axis_color: str = _CHROME["font_color"],
max_points: Optional[int] = None,
title_color: Optional[str] = None,
- bond_color: str = "#6b7280",
+ bond_color: str = _CHROME["axis_line_color"],
):
"""
Render an orbital isosurface from a cube file using Plotly.
diff --git a/quantui/pes_scan_2d_plot.py b/quantui/pes_scan_2d_plot.py
index 1b9464b..909e0fc 100644
--- a/quantui/pes_scan_2d_plot.py
+++ b/quantui/pes_scan_2d_plot.py
@@ -14,6 +14,8 @@
import plotly.graph_objects as go
+from quantui.theme import PLOT_DATA_COLORS
+
def _none_if_nan(v: float) -> Optional[float]:
return float(v) if math.isfinite(v) else None
@@ -123,7 +125,7 @@ def build_pes_2d_figure(result: Any, *, link_hint: bool = True) -> go.Figure:
y=bad_y,
mode="markers",
name="Failed",
- marker=dict(size=11, color="#dc2626", symbol="x"),
+ marker=dict(size=11, color=PLOT_DATA_COLORS["red"], symbol="x"),
hovertext=bad_hover,
hoverinfo="text",
)
@@ -144,11 +146,17 @@ def build_pes_2d_figure(result: Any, *, link_hint: bool = True) -> go.Figure:
def click_link_js(div_id: str, n2: int) -> str:
"""Script sending a clicked grid point to the Trajectory panel.
+ With the workspace on, the click also reaches the kernel (a hidden inbox,
+ ``app_pane_views.pes_pick_js``), which shows the point in the viewer pane.
+
A marker carries its point index in ``customdata``; a click on the map
itself reports ``pointIndex = [row (coordinate 2), column (coordinate
1)]``, which is turned into the same index.
"""
- return """
+ from quantui.app_pane_views import pes_pick_js
+
+ return (
+ """
""".replace("__N2__", str(int(n2))).replace("__DIV__", div_id)
+""".replace("__N2__", str(int(n2)))
+ .replace("__DIV__", div_id)
+ .replace("__PANE_PICK__", pes_pick_js("i"))
+ )
diff --git a/quantui/populations_overlay.py b/quantui/populations_overlay.py
index 1d6b6d5..3baabc8 100644
--- a/quantui/populations_overlay.py
+++ b/quantui/populations_overlay.py
@@ -344,7 +344,7 @@ def _mulliken_vividness(app: Any) -> float:
def _mulliken_viewer_unavailable_html() -> str:
- style = "padding:12px 16px;color:#6b7280;font-size:13px;font-style:italic"
+ style = "padding:12px 16px;color:var(--q-text-muted, #666);font-size:13px;font-style:italic"
return (
f' '
"3D structure unavailable: this result has no saved coordinates. "
diff --git a/quantui/progress.py b/quantui/progress.py
index eb3f039..2aae213 100644
--- a/quantui/progress.py
+++ b/quantui/progress.py
@@ -30,6 +30,7 @@
import ipywidgets as widgets
from quantui import theme as _theme
+from quantui.utils import fa_icon
class StepProgress:
@@ -38,20 +39,22 @@ class StepProgress:
Each step shows an icon reflecting its state:
- - ⬜ not started
- - ⏳ in progress
- - ✅ completed
- - ❌ failed
+ - an empty square: not started
+ - an hourglass: in progress
+ - a check mark: completed
+ - a cross: failed
+
+ The icons are Font Awesome, not emoji (UI/UX review 2026-12-05, UX-31).
Args:
step_labels: Human-readable labels for each step.
"""
_ICONS = {
- "pending": "⬜",
- "active": "⏳",
- "done": "✅",
- "fail": "❌",
+ "pending": fa_icon("square-o"),
+ "active": fa_icon("hourglass-half"),
+ "done": fa_icon("check-circle"),
+ "fail": fa_icon("times-circle"),
}
def __init__(self, step_labels: List[str], *, horizontal: bool = False) -> None:
diff --git a/quantui/pubchem.py b/quantui/pubchem.py
index 7ccbc88..0c9fa51 100644
--- a/quantui/pubchem.py
+++ b/quantui/pubchem.py
@@ -556,7 +556,7 @@ def student_friendly_fetch(name: str) -> Tuple[Optional[str], str]:
except MoleculeNotFoundError:
message = (
- f"❌ Could not find '{name}' in PubChem.\n"
+ f"Could not find '{name}' in PubChem.\n"
f" Try:\n"
f" • Check spelling (e.g., 'ethanol' not 'ethonal')\n"
f" • Use IUPAC name (e.g., 'ethanol' not 'alcohol')\n"
@@ -567,7 +567,7 @@ def student_friendly_fetch(name: str) -> Tuple[Optional[str], str]:
except PubChemAPIError:
message = (
- "❌ Connection to PubChem failed.\n"
+ "Connection to PubChem failed.\n"
" • Check your internet connection\n"
" • Try again in a moment\n"
" • Use preset molecules if problem persists"
@@ -576,7 +576,7 @@ def student_friendly_fetch(name: str) -> Tuple[Optional[str], str]:
except Exception as e:
message = (
- f"❌ Error fetching molecule: {str(e)}\n"
+ f"Error fetching molecule: {str(e)}\n"
f" Please try a different molecule or contact your instructor."
)
logger.error(f"Unexpected error in student_friendly_fetch: {e}", exc_info=True)
@@ -803,7 +803,7 @@ def student_friendly_smiles_to_xyz(smiles: str) -> Tuple[Optional[str], str]:
except ValueError as e:
message = (
- f"❌ Invalid SMILES string: {smiles}\n"
+ f"Invalid SMILES string: {smiles}\n"
f" Error: {str(e)}\n\n"
f" SMILES Tips:\n"
f" • Check syntax (use RDKit/OpenBabel style)\n"
@@ -819,14 +819,14 @@ def student_friendly_smiles_to_xyz(smiles: str) -> Tuple[Optional[str], str]:
except ImportError:
message = (
- "❌ RDKit is required for SMILES conversion.\n"
+ "RDKit is required for SMILES conversion.\n"
" Install with: conda install -c conda-forge rdkit"
)
return None, message
except Exception as e:
message = (
- f"❌ Error converting SMILES: {str(e)}\n"
+ f"Error converting SMILES: {str(e)}\n"
f" Please try a different molecule or contact your instructor."
)
logger.error(
@@ -972,16 +972,16 @@ def display_2d_structure(
ipython_display(SVG(svg))
return True
else:
- print("⚠️ Could not generate 2D structure")
+ print("Warning: Could not generate 2D structure")
return False
except ImportError as e:
logger.warning(f"Could not display 2D structure: {e}")
- print("⚠️ IPython display not available")
+ print("Warning: IPython display not available")
return False
except Exception as e:
logger.error(f"2D structure display failed: {e}")
- print(f"⚠️ 2D structure display failed: {e}")
+ print(f"Warning: 2D structure display failed: {e}")
return False
@@ -1176,28 +1176,28 @@ def student_friendly_resolve(query: str) -> Tuple[Optional[str], str]:
xyz_string, metadata = fetch_structure(query, conformer_3d=True)
except (MoleculeNotFoundError, ValueError) as exc:
return None, (
- f"❌ Could not resolve '{query}'.\n"
+ f"Could not resolve '{query}'.\n"
f" {exc}\n"
f" Try a different name, a SMILES (e.g. CCO), or check spelling.\n"
f" Search manually at: https://pubchem.ncbi.nlm.nih.gov/"
)
except PubChemAPIError:
return None, (
- "❌ Connection to PubChem failed.\n"
+ "Connection to PubChem failed.\n"
" • Check your internet connection\n"
" • Try again in a moment\n"
" • Use a preset molecule if the problem persists"
)
except ImportError:
return None, (
- "❌ RDKit is required for SMILES / InChI input.\n"
+ "RDKit is required for SMILES / InChI input.\n"
" Install with: conda install -c conda-forge rdkit"
)
except Exception as exc: # pragma: no cover - unexpected
logger.error(
f"Unexpected error in student_friendly_resolve: {exc}", exc_info=True
)
- return None, f"❌ Error resolving '{query}': {exc}"
+ return None, f"Error resolving '{query}': {exc}"
source = {
"rdkit-smiles": "generated locally from SMILES",
diff --git a/quantui/raman_plot.py b/quantui/raman_plot.py
index 712d5ca..f2db1f7 100644
--- a/quantui/raman_plot.py
+++ b/quantui/raman_plot.py
@@ -23,6 +23,7 @@
import plotly.graph_objects as go
from quantui.ir_plot import _default_xrange, _grid_for_range, _peak_labels
+from quantui.theme import PLOT_DATA_COLORS, plot_chrome
def plot_raman_spectrum(
@@ -54,13 +55,13 @@ def plot_raman_spectrum(
title="Wavenumber (cm⁻¹)",
range=xrange[::-1] if descending else xrange,
showgrid=True,
- gridcolor="#e5e7eb",
+ gridcolor=plot_chrome()["grid_color"],
),
yaxis=dict(
title=yaxis_title,
rangemode="tozero",
showgrid=True,
- gridcolor="#e5e7eb",
+ gridcolor=plot_chrome()["grid_color"],
),
template="plotly_white",
showlegend=False,
@@ -89,7 +90,7 @@ def plot_raman_spectrum(
x=_xgrid,
y=y_broad,
mode="lines",
- line=dict(color="#059669", width=1.5),
+ line=dict(color=PLOT_DATA_COLORS["green"], width=1.5),
name="Raman (broadened)",
hovertemplate="%{x:.0f} cm⁻¹ | %{y:.2f} Å⁴/amu ",
)
@@ -106,7 +107,7 @@ def plot_raman_spectrum(
x=x_stick,
y=y_stick,
mode="lines",
- line=dict(color="#059669", width=2),
+ line=dict(color=PLOT_DATA_COLORS["green"], width=2),
name="Raman (stick)",
hoverinfo="skip",
)
@@ -116,7 +117,7 @@ def plot_raman_spectrum(
x=list(freqs_real),
y=list(acts_real),
mode="markers",
- marker=dict(color="#047857", size=6),
+ marker=dict(color=PLOT_DATA_COLORS["green"], size=6),
name="Raman (peaks)",
showlegend=False,
customdata=sym,
diff --git a/quantui/session_calc.py b/quantui/session_calc.py
index b0ec9fb..21a385d 100644
--- a/quantui/session_calc.py
+++ b/quantui/session_calc.py
@@ -220,7 +220,7 @@ def summary(self) -> str:
f" Molecule : {self.formula}",
f" Engine : {self.engine_id}",
f" Method/Basis : {self.method}/{self.basis}",
- f" SCF converged : {'Yes' if self.converged else '❌ NO — treat results with caution'}",
+ f" SCF converged : {'Yes' if self.converged else 'NO — treat results with caution'}",
f" Iterations : {self.n_iterations}",
f" Total energy : {self.energy_hartree:.8f} Ha",
]
@@ -228,21 +228,21 @@ def summary(self) -> str:
lines.append(f" HOMO-LUMO gap : {self.homo_lumo_gap_ev:.4f} eV")
if self.dispersion_applied is False:
lines.append(
- f" ⚠️ {self.method} requires D3 dispersion, but no D3 backend "
+ f" Warning: {self.method} requires D3 dispersion, but no D3 backend "
"(pyscf-dispersion) was installed — this result has NO "
"dispersion correction."
)
if self.cc_converged is False:
lines.append(
- " ⚠️ CCSD amplitude iterations did NOT converge — the "
+ " Warning: CCSD amplitude iterations did NOT converge — the "
"correlation energy above is unreliable."
)
lines += [
"=" * 60,
(
- "✅ Calculation completed successfully!"
+ "Calculation completed successfully."
if self.converged
- else "⚠️ SCF did not converge — try a different starting geometry, basis, or method."
+ else "Warning: SCF did not converge — try a different starting geometry, basis, or method."
),
"=" * 60,
]
@@ -922,7 +922,7 @@ def _run_session_calc_body(
if density_fit_used and progress_stream is not None:
try:
progress_stream.write(
- "\n⚡ Density fitting (RI) active — approximate integrals\n"
+ "\nDensity fitting (RI) active — approximate integrals\n"
)
except Exception: # noqa: BLE001 — cleanup (stream may be closed)
pass
@@ -941,7 +941,7 @@ def _run_session_calc_body(
mf, gpu_used, gpu_name = _try_to_gpu(mf, method_upper)
if gpu_used and progress_stream is not None:
try:
- progress_stream.write(f"\n🚀 GPU offload active — running on {gpu_name}\n")
+ progress_stream.write(f"\nGPU offload active — running on {gpu_name}\n")
except Exception: # noqa: BLE001 — cleanup (progress stream may be closed)
pass
diff --git a/quantui/structure_providers.py b/quantui/structure_providers.py
index c942bd6..16ae588 100644
--- a/quantui/structure_providers.py
+++ b/quantui/structure_providers.py
@@ -288,7 +288,7 @@ def resolve_structure_with_details(
return (
None,
(
- f"❌ Could not resolve '{query}'.\n"
+ f"Could not resolve '{query}'.\n"
f" {exc}\n"
f" Try a different name, a SMILES (e.g. CC(=O)O), a CAS "
f"number, or check spelling.\n"
@@ -297,7 +297,7 @@ def resolve_structure_with_details(
)
except Exception as exc: # pragma: no cover - unexpected
logger.error(f"Unexpected error resolving '{query}': {exc}", exc_info=True)
- return None, f"❌ Error resolving '{query}': {exc}"
+ return None, f"Error resolving '{query}': {exc}"
return result, _resolved_message(query, result)
diff --git a/quantui/theme.py b/quantui/theme.py
index 2a000cf..cef86b8 100644
--- a/quantui/theme.py
+++ b/quantui/theme.py
@@ -52,7 +52,8 @@
ACCENT_WARNING_LIGHT = "#f59e0b"
ACCENT_INFO = "#2563eb"
ACCENT_PURPLE = "#7c3aed"
-ACCENT_TEAL = "#0d9488"
+# #0d9488 was 3.58:1 on BG_PANEL; the run log uses teal as text (UX-32).
+ACCENT_TEAL = "#0f766e"
SURFACE_INFO_BG = "#eff6ff"
SURFACE_PURPLE_BG = "#f5f3ff"
@@ -61,6 +62,9 @@
SURFACE_GREEN_BG = "#f0fdf4"
SURFACE_ORANGE_BG = "#fff7ed"
SURFACE_MUTED_BG = "#e0e7ef"
+# Error boxes (run failed, result not saved); was a light-only #fef2f2 in
+# app.py (UX-32).
+SURFACE_ERROR_BG = "#fef2f2"
_TOKEN_FIELDS: Tuple[str, ...] = (
"page_bg",
@@ -96,6 +100,7 @@
"surface_green_bg",
"surface_orange_bg",
"surface_muted_bg",
+ "surface_error_bg",
)
@@ -139,6 +144,7 @@ class ThemePalette:
surface_green_bg: str
surface_orange_bg: str
surface_muted_bg: str
+ surface_error_bg: str
def css_variables(self) -> Dict[str, str]:
"""Map ``--q-*`` custom-property names to hex values."""
@@ -293,6 +299,64 @@ def focus_ring_css() -> str:
)
+def scrollbar_css() -> str:
+ """Scrollbars in the palette's colours, not the browser's light default.
+
+ ``scrollbar-color`` (Firefox, Chrome 121+) plus ``::-webkit-scrollbar``
+ for older WebKit/Blink. Thumb ``border_strong`` on a ``bg_panel`` track:
+ >= 3:1 in every palette (tests/test_theme_contrast.py), so the thumb is
+ findable (UI/UX review 2026-12-05, §4: scrollbars left unthemed).
+ """
+ return (
+ "html, body, * "
+ "{ scrollbar-color: var(--q-border-strong) var(--q-bg-panel) !important; }\n"
+ "::-webkit-scrollbar { width: 12px; height: 12px; "
+ "background: var(--q-bg-panel); }\n"
+ "::-webkit-scrollbar-track, ::-webkit-scrollbar-corner "
+ "{ background: var(--q-bg-panel); }\n"
+ "::-webkit-scrollbar-thumb { background: var(--q-border-strong); "
+ "border-radius: 6px; border: 3px solid var(--q-bg-panel); }\n"
+ "::-webkit-scrollbar-thumb:hover { background: var(--q-text-subtle); }\n"
+ )
+
+
+def selection_css() -> str:
+ """Selected text in the palette's accent (was the browser default).
+
+ ``page_bg`` text on ``accent_info``: the accent-button pair, >= 4.5:1 in
+ every palette.
+ """
+ return (
+ "::selection { background: var(--q-accent-info) !important; "
+ "color: var(--q-page-bg) !important; }\n"
+ )
+
+
+# Tab sets inside another tab's panel (Calculate → Molecule Input → Library
+# was three borders deep; review §4). ipywidgets 8 class first, then the
+# deprecated one.
+NESTED_TAB_SELECTORS: Tuple[str, ...] = (
+ ".widget-tab-contents .jupyter-widget-tab > .widget-tab-contents",
+ ".widget-tab-contents .widget-tab > .widget-tab-contents",
+)
+
+
+def nested_box_css() -> str:
+ """Flatten a box that sits directly inside another box.
+
+ The inner tab panel loses its frame and its own background; one line
+ under its tab bar still groups the tabs with their content.
+ """
+ sel = ", ".join(NESTED_TAB_SELECTORS)
+ return (
+ f"{sel} "
+ "{ border: none !important; "
+ "border-top: 1px solid var(--q-border) !important; "
+ "background: transparent !important; "
+ "padding: 12px 0 4px !important; }\n"
+ )
+
+
def _neutral_button_css() -> str:
"""Default/neutral buttons blend with unified chrome surfaces."""
return (
@@ -326,39 +390,31 @@ def slider_chrome_css() -> str:
styling ``input[type=range]`` alone is often ignored. Thumb uses the accent
colour with a page-bg ring so it stays visible on every palette.
"""
- selectors = (
- ".jupyter-widgets input[type=range], "
- ".widget-slider input[type=range], "
- ".widget-hslider input[type=range], "
- "input.quantui-range[type=range]"
- )
- thumb = (
- f"{selectors}::-webkit-slider-thumb, "
- ".jupyter-widgets input[type=range]::-moz-range-thumb, "
- ".widget-slider input[type=range]::-moz-range-thumb, "
- ".widget-hslider input[type=range]::-moz-range-thumb, "
- "input.quantui-range[type=range]::-moz-range-thumb"
+ bases = (
+ ".jupyter-widgets input[type=range]",
+ ".widget-slider input[type=range]",
+ ".widget-hslider input[type=range]",
+ "input.quantui-range[type=range]",
)
- track = (
- f"{selectors}::-webkit-slider-runnable-track, "
- ".jupyter-widgets input[type=range]::-moz-range-track, "
- ".widget-slider input[type=range]::-moz-range-track, "
- ".widget-hslider input[type=range]::-moz-range-track, "
- "input.quantui-range[type=range]::-moz-range-track"
- )
- return (
- f"{selectors} "
- "{ -webkit-appearance: none !important; appearance: none !important; "
- "width: 100% !important; height: 20px !important; "
- "background: transparent !important; "
- "accent-color: var(--q-accent-info) !important; "
- "cursor: pointer !important; }\n"
- f"{track} "
+ selectors = ", ".join(bases)
+
+ def pseudo(name: str) -> str:
+ return ", ".join(f"{b}::{name}" for b in bases)
+
+ # One rule per engine: a selector list that mixes ::-webkit-* and
+ # ::-moz-* pseudo-elements is invalid as a whole, so the combined rule was
+ # dropped and Chromium drew no track at all.
+ webkit_track = pseudo("-webkit-slider-runnable-track")
+ webkit_thumb = pseudo("-webkit-slider-thumb")
+ moz_track = pseudo("-moz-range-track")
+ moz_thumb = pseudo("-moz-range-thumb")
+ track_body = (
"{ height: 10px !important; border-radius: 5px !important; "
"background: var(--q-border-strong) !important; "
"border: 1px solid var(--q-border) !important; "
"box-shadow: inset 0 0 0 1px var(--q-page-bg) !important; }\n"
- f"{thumb} "
+ )
+ thumb_body = (
"{ -webkit-appearance: none !important; appearance: none !important; "
"width: 20px !important; height: 20px !important; "
"border-radius: 50% !important; "
@@ -367,6 +423,18 @@ def slider_chrome_css() -> str:
"box-shadow: 0 0 0 1px var(--q-accent-info), "
"0 1px 4px rgba(0,0,0,0.45) !important; "
"cursor: pointer !important; margin-top: -6px !important; }\n"
+ )
+ return (
+ f"{selectors} "
+ "{ -webkit-appearance: none !important; appearance: none !important; "
+ "width: 100% !important; height: 20px !important; "
+ "background: transparent !important; "
+ "accent-color: var(--q-accent-info) !important; "
+ "cursor: pointer !important; }\n"
+ f"{webkit_track} {track_body}"
+ f"{moz_track} {track_body}"
+ f"{webkit_thumb} {thumb_body}"
+ f"{moz_thumb} {thumb_body.replace(' margin-top: -6px !important;', '')}"
".widget-hslider .widget-readout, "
".widget-slider .widget-readout, "
".widget-float-slider .widget-readout "
@@ -453,6 +521,9 @@ def _widget_chrome_css() -> str:
f"{_accent_button_css()}"
f"{focus_ring_css()}"
f"{slider_chrome_css()}"
+ f"{scrollbar_css()}"
+ f"{selection_css()}"
+ f"{nested_box_css()}"
".quantui-info-box "
f"{{ background: {surface} !important; "
"color: var(--q-text-body) !important; "
@@ -503,6 +574,7 @@ def _light_palette() -> ThemePalette:
surface_green_bg=SURFACE_GREEN_BG,
surface_orange_bg=SURFACE_ORANGE_BG,
surface_muted_bg=SURFACE_MUTED_BG,
+ surface_error_bg=SURFACE_ERROR_BG,
)
@@ -545,6 +617,7 @@ def _dark_palette() -> ThemePalette:
surface_green_bg="#14532d",
surface_orange_bg="#431407",
surface_muted_bg="#334155",
+ surface_error_bg="#450a0a",
)
@@ -587,6 +660,7 @@ def _midnight_palette() -> ThemePalette:
surface_green_bg="#000000",
surface_orange_bg="#000000",
surface_muted_bg="#111111",
+ surface_error_bg="#1a0000",
)
@@ -629,6 +703,7 @@ def _dark_blue_palette() -> ThemePalette:
surface_green_bg="#0d3320",
surface_orange_bg="#3d1a0a",
surface_muted_bg="#1a3352",
+ surface_error_bg="#2a1530",
)
@@ -671,6 +746,7 @@ def _hot_pink_palette() -> ThemePalette:
surface_green_bg="#1a3320",
surface_orange_bg="#3d2010",
surface_muted_bg="#4a1548",
+ surface_error_bg="#4a0d2a",
)
@@ -713,6 +789,7 @@ def _dark_maroon_palette() -> ThemePalette:
surface_green_bg="#1a3320",
surface_orange_bg="#3d2010",
surface_muted_bg="#3d2430",
+ surface_error_bg="#3d1015",
)
@@ -760,6 +837,7 @@ def _warm_palette() -> ThemePalette:
surface_green_bg="#e9f3e2",
surface_orange_bg="#fcecdc",
surface_muted_bg="#efe6d6",
+ surface_error_bg="#f9e3dc",
)
@@ -885,6 +963,55 @@ def plotly_colors(palette_id: str) -> dict:
}
+# Data colours for plot traces (UI/UX review 2026-12-05, UX-32). Plots sit
+# on the palette's surfaces (a cream page to pure black), and the same
+# figure goes into standalone exports, so these are mid-tones: each keeps
+# >= 3:1 against bg_panel, page_bg and the 3D scene colour of every palette
+# (tests/test_theme_contrast.py). The old #2563eb / #2171b5 blues were 2.8:1
+# on Dark, the grey "virtual" levels 1.7:1 on Bright.
+PLOT_DATA_COLORS: Dict[str, str] = {
+ "blue": "#3b82f6",
+ "red": "#ef4444",
+ "orange": "#e6550d",
+ "green": "#059669",
+ "teal": "#0d9488",
+ "purple": "#8b5cf6",
+ "grey": "#808080",
+}
+
+
+def plot_chrome(palette_id: str = DEFAULT_PALETTE_ID) -> dict:
+ """Grid, axis-line and font colours for a plot module's own defaults.
+
+ The app re-themes every in-app figure (``QuantUIApp._apply_plotly_theme``);
+ this gives the plot modules the same palette-derived chrome when they are
+ used on their own, instead of fixed light-theme greys.
+ """
+ return plotly_colors(palette_id)
+
+
+_ALERT_TOKENS: Dict[str, Tuple[str, str]] = {
+ "error": ("surface-error-bg", "accent-error"),
+ "warning": ("surface-warning-bg", "accent-warning"),
+ "info": ("surface-info-bg", "accent-info"),
+}
+
+
+def alert_box_style(kind: str = "error", *, padding: str = "14px") -> str:
+ """Inline style for a run error / warning / info box, from theme tokens.
+
+ Replaces light-only boxes (#fef2f2 on a dark page, UX-32). Text inside
+ uses ``text_body`` and the accent; both clear 4.5:1 on the box surface in
+ every palette (tests/test_theme_contrast.py).
+ """
+ bg, edge = _ALERT_TOKENS[kind]
+ return (
+ f"background:var(--q-{bg});border:1px solid var(--q-{edge});"
+ f"border-radius:8px;padding:{padding};margin:8px 0;"
+ "color:var(--q-text-body)"
+ )
+
+
class _CssVarRefs:
"""CSS ``var(--q-*)`` references for inline HTML — theme-switchable."""
@@ -921,6 +1048,7 @@ class _CssVarRefs:
SURFACE_GREEN_BG = "var(--q-surface-green-bg)"
SURFACE_ORANGE_BG = "var(--q-surface-orange-bg)"
SURFACE_MUTED_BG = "var(--q-surface-muted-bg)"
+ SURFACE_ERROR_BG = "var(--q-surface-error-bg)"
css = _CssVarRefs()
@@ -938,6 +1066,9 @@ def frame_viewer_html(view_html: str, *, width: int, controls: str = "") -> str:
__all__ = [
+ "PLOT_DATA_COLORS",
+ "alert_box_style",
+ "plot_chrome",
"ACCENT_ERROR",
"ACCENT_ERROR_ALT",
"ACCENT_INFO",
@@ -972,6 +1103,9 @@ def frame_viewer_html(view_html: str, *, width: int, controls: str = "") -> str:
"css",
"disabled_button_css",
"focus_ring_css",
+ "nested_box_css",
+ "scrollbar_css",
+ "selection_css",
"frame_viewer_html",
"LOGO_CLASS",
"logo_css",
diff --git a/quantui/utils.py b/quantui/utils.py
index ae486cd..4c885fe 100644
--- a/quantui/utils.py
+++ b/quantui/utils.py
@@ -260,6 +260,29 @@ def path_html(path: "os.PathLike[str] | str") -> str:
)
+# Font Awesome 4 icons for status in HTML messages, instead of emoji (UI/UX
+# review 2026-12-05, UX-31). Plain-text messages use words instead.
+STATUS_ICONS = {
+ "error": "times-circle",
+ "warning": "exclamation-triangle",
+ "info": "info-circle",
+ "ok": "check",
+ "tip": "lightbulb-o",
+ "resume": "refresh",
+ "stop": "stop",
+}
+
+
+def fa_icon(name: str) -> str:
+ """Inline Font Awesome 4 icon (decorative: hidden from screen readers)."""
+ return f' '
+
+
+def status_icon(kind: str) -> str:
+ """:func:`fa_icon` for a status kind in :data:`STATUS_ICONS`."""
+ return fa_icon(STATUS_ICONS[kind])
+
+
def get_timestamp() -> str:
"""
Get current timestamp in ISO format.
diff --git a/quantui/visualization_py3dmol.py b/quantui/visualization_py3dmol.py
index 083d94e..70946f8 100644
--- a/quantui/visualization_py3dmol.py
+++ b/quantui/visualization_py3dmol.py
@@ -570,7 +570,7 @@ def _unavailable_html(molecule) -> str:
"""HTML fallback when no 3D visualization backend is installed."""
return (
' '
- " ⚠️ 3D visualization not available. "
+ ' 3D visualization not available. '
" To enable visualization, install one of: "
" pip install py3dmol (recommended) "
"pip install plotlymol
"
@@ -724,7 +724,7 @@ def display_molecule(
if not is_visualization_available():
# Fallback: show text representation
- print("⚠️ 3D visualization not available")
+ print("Warning: 3D visualization not available")
print("\nTo enable visualization, install one of:")
print(" pip install py3dmol (recommended)")
print(" pip install plotlymol")
diff --git a/tests/test_app_pane_views.py b/tests/test_app_pane_views.py
index f5864a0..1d3952e 100644
--- a/tests/test_app_pane_views.py
+++ b/tests/test_app_pane_views.py
@@ -71,6 +71,21 @@ def _available(app, name):
app._activate_ana_panel(name, auto_select=False)
+def _prepare(app, name):
+ """The Trajectory panel draws its viewer (or its note) per result."""
+ if name == "Trajectory":
+ from types import SimpleNamespace
+
+ frames = [
+ Molecule(["H", "H"], [[0.0, 0.0, 0.0], [0.0, 0.0, z]]) for z in (0.70, 0.74)
+ ]
+ app._show_opt_trajectory(
+ SimpleNamespace(
+ trajectory=frames, energies_hartree=[-1.0, -1.1], formula="H2"
+ )
+ )
+
+
# ---------------------------------------------------------------------------
# Panel viewers live in the pane, not in their panels
# ---------------------------------------------------------------------------
@@ -79,6 +94,7 @@ def _available(app, name):
class TestPlacement:
@pytest.mark.parametrize("name", list(PANE_VIEWS))
def test_panel_viewer_is_not_in_its_panel(self, app, name):
+ _prepare(app, name)
acc = _acc(app, name)
assert not _in(acc, _viewer(app, name))
# DEC-009: the panel stays; a note takes the viewer's place.
@@ -87,11 +103,13 @@ def test_panel_viewer_is_not_in_its_panel(self, app, name):
@pytest.mark.parametrize("name", list(PANE_VIEWS))
def test_fallback_keeps_each_panel_viewer(self, app_off, name):
+ _prepare(app_off, name)
acc = _acc(app_off, name)
assert _in(acc, _viewer(app_off, name))
assert not _in(acc, app_off._pv_notes[name][0])
def test_turning_the_workspace_off_puts_viewers_back(self, app):
+ _prepare(app, "Trajectory")
_available(app, "Vibrational")
assert claim(app, "Vibrational")
app.workspace_layout_cb.value = False
diff --git a/tests/test_app_pane_views_steppers.py b/tests/test_app_pane_views_steppers.py
new file mode 100644
index 0000000..f5c2bb5
--- /dev/null
+++ b/tests/test_app_pane_views_steppers.py
@@ -0,0 +1,530 @@
+"""Trajectory, Geometries and PES Scan drive the workspace pane's viewer
+(DEC-036: pane viewer, controls in the panel).
+
+Mirrors ``test_app_pane_views.py``: the viewer moves into the pane with the
+"Showing … — Back to structure" banner, the panel keeps a note, and the same
+lifecycle (collapse / new result / pick mode → the structure). New here: the
+stepper is built in two halves, the viewer for the pane and the controls for
+the panel, and a PES-plot click reaches the kernel through a hidden inbox.
+
+Widget-level checks; the browser side (the pane viewer following the
+panel's stepper, a click on a plotted point) needs a Voila look.
+"""
+
+from __future__ import annotations
+
+import json
+from types import SimpleNamespace
+
+import pytest
+
+from quantui.app_pane_views import (
+ GEOMETRIES,
+ PES_PICK_INBOX_CLASS,
+ PES_SCAN,
+ TRAJECTORY,
+ claim,
+ holder,
+ show_pes_point,
+)
+from quantui.molecule import Molecule
+
+pytest.importorskip("py3Dmol")
+
+WATER = [[0.0, 0.0, 0.117], [0.0, 0.757, -0.469], [0.0, -0.757, -0.469]]
+
+
+def _water() -> Molecule:
+ return Molecule(["O", "H", "H"], WATER)
+
+
+def _make_app(tmp_path, monkeypatch, *, workspace: bool = True):
+ path = tmp_path / "settings.json"
+ path.write_text(
+ json.dumps({"_schema_version": 1, "ui": {"workspace_layout": workspace}})
+ )
+ monkeypatch.setenv("QUANTUI_SETTINGS_PATH", str(path))
+ from quantui.app import QuantUIApp
+
+ return QuantUIApp()
+
+
+@pytest.fixture
+def app(tmp_path, monkeypatch):
+ return _make_app(tmp_path, monkeypatch)
+
+
+@pytest.fixture
+def app_off(tmp_path, monkeypatch):
+ return _make_app(tmp_path, monkeypatch, workspace=False)
+
+
+def _walk(w):
+ yield w
+ for c in getattr(w, "children", ()):
+ yield from _walk(c)
+
+
+def _in(root, widget) -> bool:
+ return any(w is widget for w in _walk(root))
+
+
+def _count(root, widget) -> int:
+ return sum(1 for w in _walk(root) if w is widget)
+
+
+def _html(out) -> str:
+ return "".join(o["data"]["text/html"] for o in out.outputs)
+
+
+def _acc(app, name):
+ return app._ana_accordions[app._ana_panel_names.index(name)]
+
+
+def _available(app, *names):
+ for name in names:
+ app._activate_ana_panel(name, auto_select=False)
+
+
+def _traj_result(n: int = 3):
+ frames = [
+ Molecule(["H", "H"], [[0.0, 0.0, 0.0], [0.0, 0.0, 0.70 + 0.02 * k]])
+ for k in range(n)
+ ]
+ return SimpleNamespace(
+ trajectory=frames,
+ energies_hartree=[-1.0 - 0.01 * k for k in range(n)],
+ formula="H2",
+ )
+
+
+def _pending_trajectory(app, n: int = 3):
+ """Like a populate step: data waiting for the panel to open."""
+ _available(app, TRAJECTORY)
+ res = _traj_result(n)
+ app._pending_traj_result = res
+ app._last_traj_result = res
+ return res
+
+
+def _geoms():
+ return [
+ {
+ "label": "R_neutral — neutral optimized",
+ "atoms": ["H", "H"],
+ "coordinates": [[0.0, 0.0, 0.0], [0.0, 0.0, 0.74]],
+ "note": "E_neutral(R_neutral)",
+ },
+ {
+ "label": "R_cation — cation optimized",
+ "atoms": ["H", "H"],
+ "coordinates": [[0.0, 0.0, 0.0], [0.0, 0.0, 0.80]],
+ "note": "E_cation(R_cation)",
+ },
+ ]
+
+
+def _with_geometries(app):
+ from quantui.app_analysis import render_reorg_geometries
+
+ _available(app, GEOMETRIES)
+ app._reorg_geometries = _geoms()
+ render_reorg_geometries(app)
+
+
+# ---------------------------------------------------------------------------
+# The split builders
+# ---------------------------------------------------------------------------
+
+
+class TestViewerParts:
+ def test_trajectory_halves(self):
+ from quantui.app_visualization import build_trajectory_viewer_parts
+
+ xyz = ["2\nH2\nH 0 0 0\nH 0 0 0.74", "2\nH2\nH 0 0 0\nH 0 0 0.70"]
+ parts = build_trajectory_viewer_parts(xyz, formula="H2")
+ # One fragment for the single-column layout: viewer + stepper.
+ assert "3dmolviewer_" in parts.combined and "st_play_" in parts.combined
+ # The pane half has no buttons, and follows the panel's stepper.
+ assert "3dmolviewer_" in parts.viewer
+ assert "st_play_" not in parts.viewer
+ assert "__quantuiStepCur_" in parts.viewer
+ # The panel half: buttons, slider, label; no viewer of its own.
+ for el in ("st_prev_", "st_play_", "st_next_", "st_slider_", "st_lbl_"):
+ assert el in parts.controls
+ assert ' 200)", 1)[1]
+ assert 'document.getElementById("3dmolviewer_"+UID)' in tail
+ assert 'window["__quantuiStepCur_"+UID]=cur;' in _STEPPER_JS
+
+
+# ---------------------------------------------------------------------------
+# Trajectory
+# ---------------------------------------------------------------------------
+
+
+class TestTrajectory:
+ def test_opening_the_panel_plays_in_the_pane(self, app):
+ _pending_trajectory(app)
+ acc = _acc(app, TRAJECTORY)
+ acc.selected_index = 0
+ assert holder(app) == TRAJECTORY
+ assert app._ws_body.children[0] is app._traj_viewer_output
+ assert "Trajectory" in app._pv_banner_text.value
+ # The panel: energy chart and controls stay, the viewer is a note.
+ assert not _in(acc, app._traj_viewer_output)
+ assert _in(acc, app._pv_notes[TRAJECTORY][0])
+ assert _in(acc, app._traj_controls_output)
+ assert app._traj_controls_output.layout.display == ""
+ assert "st_play_" in _html(app._traj_controls_output)
+ assert "st_play_" not in _html(app._traj_viewer_output)
+ assert "Step or play it" in app._pv_notes[TRAJECTORY][1].value
+ # One viewer: the pane's copy is the only one.
+ assert _count(app._ws_shell, app._traj_viewer_output) == 1
+
+ def test_controls_hide_while_the_pane_shows_the_structure(self, app):
+ _pending_trajectory(app)
+ _acc(app, TRAJECTORY).selected_index = 0
+ app._pv_back_btn.click()
+ assert holder(app) == ""
+ assert app._ws_body.children[0] is app._ana_viewer_row
+ assert app._traj_controls_output.layout.display == "none"
+ # "Show in viewer" brings it (and the controls) back.
+ note_btn = app._pv_notes[TRAJECTORY][2]
+ assert note_btn.layout.display == ""
+ note_btn.click()
+ assert holder(app) == TRAJECTORY
+ assert app._traj_controls_output.layout.display == ""
+
+ def test_collapsing_the_panel_releases(self, app):
+ _pending_trajectory(app)
+ acc = _acc(app, TRAJECTORY)
+ acc.selected_index = 0
+ acc.selected_index = None
+ assert holder(app) == ""
+ assert not _in(app._ws_pane, app._traj_viewer_output)
+
+ def test_rerender_while_in_the_pane_keeps_one_viewer(self, app):
+ res = _pending_trajectory(app)
+ acc = _acc(app, TRAJECTORY)
+ acc.selected_index = 0
+ app._show_opt_trajectory(res) # e.g. a theme switch
+ assert holder(app) == TRAJECTORY
+ assert app._ws_body.children[0] is app._traj_viewer_output
+ assert not _in(acc, app._traj_viewer_output)
+ assert _count(app._ws_shell, app._traj_viewer_output) == 1
+ assert _count(acc, app._pv_notes[TRAJECTORY][0]) == 1
+
+ def test_new_result_gives_the_pane_back_and_drops_the_viewer(self, app):
+ from quantui.app import _AnalysisContext
+
+ _pending_trajectory(app)
+ _acc(app, TRAJECTORY).selected_index = 0
+ ctx = _AnalysisContext(
+ calc_type="nmr", formula="H2O", method="RHF", basis="STO-3G"
+ )
+ app._apply_analysis_context(ctx)
+ assert holder(app) == ""
+ assert app._ws_body.children[0] is app._ana_viewer_row
+ assert app._traj_viewer_output.outputs == ()
+ assert app._traj_controls_output.outputs == ()
+
+ def test_pick_mode_takes_the_structure_back(self, app):
+ app._set_molecule(_water())
+ _pending_trajectory(app)
+ _acc(app, TRAJECTORY).selected_index = 0
+ app.root_tab.selected_index = app._tab_index("calculate")
+ app.calc_type_dd.value = "PES Scan"
+ assert holder(app) == ""
+ assert claim(app, TRAJECTORY) is False
+
+ def test_another_panel_replaces_it(self, app):
+ _pending_trajectory(app)
+ _available(app, "Vibrational")
+ _acc(app, TRAJECTORY).selected_index = 0
+ claim(app, "Vibrational")
+ assert holder(app) == "Vibrational"
+ assert not _in(app._ws_pane, app._traj_viewer_output)
+ assert app._traj_controls_output.layout.display == "none"
+
+ def test_fallback_keeps_the_viewer_with_its_stepper(self, app_off):
+ _pending_trajectory(app_off)
+ acc = _acc(app_off, TRAJECTORY)
+ acc.selected_index = 0
+ assert holder(app_off) == ""
+ assert _in(acc, app_off._traj_viewer_output)
+ assert "st_play_" in _html(app_off._traj_viewer_output)
+ assert app_off._traj_controls_output.outputs == ()
+ assert not _in(acc, app_off._pv_notes[TRAJECTORY][0])
+
+ def test_workspace_toggle_rebuilds_the_halves(self, app):
+ _pending_trajectory(app)
+ acc = _acc(app, TRAJECTORY)
+ acc.selected_index = 0
+ app.workspace_layout_cb.value = False
+ assert holder(app) == ""
+ assert _in(acc, app._traj_viewer_output)
+ assert "st_play_" in _html(app._traj_viewer_output)
+ assert app._traj_controls_output.outputs == ()
+ assert app._traj_controls_output.layout.display == ""
+ app.workspace_layout_cb.value = True
+ assert not _in(acc, app._traj_viewer_output)
+ assert _in(acc, app._pv_notes[TRAJECTORY][0])
+ assert "st_play_" not in _html(app._traj_viewer_output)
+ assert "st_play_" in _html(app._traj_controls_output)
+
+
+# ---------------------------------------------------------------------------
+# Geometries (reorganization energy)
+# ---------------------------------------------------------------------------
+
+
+class TestGeometries:
+ def test_opening_the_panel_claims(self, app):
+ _with_geometries(app)
+ acc = _acc(app, GEOMETRIES)
+ acc.selected_index = 0
+ assert holder(app) == GEOMETRIES
+ assert app._ws_body.children[0] is app._reorg_geom_output
+ assert "Relaxation geometries" in app._pv_banner_text.value
+ assert "st_ab_" in _html(app._reorg_controls_output)
+ assert "st_ab_" not in _html(app._reorg_geom_output)
+ assert app._reorg_controls_output.layout.display == ""
+ acc.selected_index = None
+ assert holder(app) == ""
+
+ def test_switching_the_view_claims_and_relabels(self, app):
+ _with_geometries(app)
+ app._reorg_view_toggle.value = "overlay"
+ assert holder(app) == GEOMETRIES
+ assert "Relaxation overlay" in app._pv_banner_text.value
+ # The overlay has no stepper.
+ assert app._reorg_controls_output.outputs == ()
+ app._reorg_view_toggle.value = "step"
+ assert "Relaxation geometries" in app._pv_banner_text.value
+ assert "st_ab_" in _html(app._reorg_controls_output)
+
+ def test_populating_does_not_claim(self, app):
+ app._pv_suppress = True # as while a result is applied
+ try:
+ _with_geometries(app)
+ app._reorg_view_toggle.value = "overlay"
+ finally:
+ app._pv_suppress = False
+ assert holder(app) == ""
+
+ def test_fallback(self, app_off):
+ _with_geometries(app_off)
+ acc = _acc(app_off, GEOMETRIES)
+ app_off._reorg_view_toggle.value = "overlay"
+ app_off._reorg_view_toggle.value = "step"
+ assert _in(acc, app_off._reorg_geom_output)
+ assert "st_ab_" in _html(app_off._reorg_geom_output)
+ assert app_off._reorg_controls_output.outputs == ()
+
+
+# ---------------------------------------------------------------------------
+# PES Scan: a click on a point shows its geometry in the pane
+# ---------------------------------------------------------------------------
+
+
+def _pes_ready(app, n: int = 4):
+ _pending_trajectory(app, n)
+ _available(app, PES_SCAN)
+ from quantui.app_pane_views import set_pes_linked
+
+ set_pes_linked(app, True)
+
+
+class TestPesScan:
+ def test_the_note_takes_the_hint_place(self, app, app_off):
+ acc = _acc(app, PES_SCAN)
+ assert _in(acc, app._pv_notes[PES_SCAN][0])
+ assert not _in(acc, app._pes_plot_hint)
+ acc_off = _acc(app_off, PES_SCAN)
+ assert _in(acc_off, app_off._pes_plot_hint)
+ assert not _in(acc_off, app_off._pv_notes[PES_SCAN][0])
+
+ def test_opening_the_panel_keeps_the_structure(self, app):
+ _pes_ready(app)
+ _acc(app, PES_SCAN).selected_index = 0
+ assert holder(app) == ""
+
+ def test_a_click_builds_and_shows_the_point(self, app):
+ _pes_ready(app)
+ assert app._traj_viewer_output.outputs == ()
+ app._pv_pes_inbox.value = "2 1700000000000"
+ assert holder(app) == PES_SCAN
+ assert app._ws_body.children[0] is app._traj_viewer_output
+ # Built on the clicked point, though the Trajectory panel never opened.
+ assert "START=2" in _html(app._traj_viewer_output)
+ assert "Scan geometry" in app._pv_banner_text.value
+ assert "PES Scan panel" in app._pv_banner_text.value
+ assert "Click another point" in app._pv_notes[PES_SCAN][1].value
+ assert app._traj_controls_output.layout.display == ""
+
+ def test_further_clicks_do_not_rebuild(self, app):
+ _pes_ready(app)
+ show_pes_point(app, 1)
+ first = app._traj_viewer_output.outputs
+ app._pv_pes_inbox.value = "3 1700000000001"
+ assert holder(app) == PES_SCAN
+ assert app._traj_viewer_output.outputs is first
+
+ def test_then_opening_trajectory_keeps_the_same_viewer(self, app):
+ _pes_ready(app)
+ show_pes_point(app, 1)
+ first = app._traj_viewer_output.outputs
+ _acc(app, TRAJECTORY).selected_index = 0
+ assert holder(app) == TRAJECTORY
+ assert app._ws_body.children[0] is app._traj_viewer_output
+ assert app._traj_viewer_output.outputs is first
+ assert _count(app._ws_shell, app._traj_viewer_output) == 1
+
+ def test_collapsing_the_pes_panel_releases(self, app):
+ _pes_ready(app)
+ acc = _acc(app, PES_SCAN)
+ acc.selected_index = 0
+ show_pes_point(app, 0)
+ acc.selected_index = None
+ assert holder(app) == ""
+
+ def test_unlinked_profile_hides_the_note(self, app):
+ from quantui.app_pane_views import set_pes_linked
+
+ _pes_ready(app)
+ set_pes_linked(app, False)
+ assert app._pv_notes[PES_SCAN][0].layout.display == "none"
+ set_pes_linked(app, True)
+ assert app._pv_notes[PES_SCAN][0].layout.display == ""
+
+ def test_the_inbox_sits_in_the_note(self, app):
+ assert app._pv_pes_inbox in app._pv_notes[PES_SCAN][0].children
+ assert PES_PICK_INBOX_CLASS in app._pv_pes_inbox._dom_classes
+
+ def test_garbage_in_the_inbox_is_ignored(self, app):
+ _pes_ready(app)
+ app._pv_pes_inbox.value = "not-a-number"
+ assert holder(app) == ""
+
+ def test_no_pane_without_the_workspace(self, app_off):
+ _pes_ready(app_off)
+ assert show_pes_point(app_off, 1) is False
+ assert holder(app_off) == ""
+
+ def test_new_result_forgets_the_link(self, app):
+ from quantui.app import _AnalysisContext
+
+ _pes_ready(app)
+ show_pes_point(app, 1)
+ ctx = _AnalysisContext(
+ calc_type="nmr", formula="H2O", method="RHF", basis="STO-3G"
+ )
+ app._apply_analysis_context(ctx)
+ assert holder(app) == ""
+ assert app._pv_pes_linked is False
+
+
+class TestPesClickScripts:
+ def test_1d_profile_posts_the_click(self, app):
+ from quantui.pes_scan import PESScanResult
+
+ res = PESScanResult(
+ scan_type="bond",
+ atom_indices=[0, 1],
+ scan_parameter_values=[0.7, 0.8, 0.9],
+ energies_hartree=[-1.0, -1.1, -1.05],
+ coordinates_list=[],
+ formula="H2",
+ method="RHF",
+ basis="STO-3G",
+ converged_all=True,
+ )
+ app._show_pes_scan_result(res)
+ html = _html(app._pes_plot_html)
+ assert "__quantuiTrajGoTo" in html
+ assert PES_PICK_INBOX_CLASS in html
+ assert app._pv_pes_linked is True
+
+ def test_1d_star_carries_its_point_index(self, app):
+ from quantui.pes_scan import PESScanResult
+
+ res = PESScanResult(
+ scan_type="bond",
+ atom_indices=[0, 1],
+ scan_parameter_values=[0.7, 0.8, 0.9],
+ energies_hartree=[-1.0, -1.1, -1.05],
+ coordinates_list=[],
+ formula="H2",
+ method="RHF",
+ basis="STO-3G",
+ converged_all=True,
+ )
+ app._show_pes_scan_result(res)
+ star = next(t for t in app._last_pes_fig.data if t.marker.symbol == "star")
+ # The minimum is scan point 1; a click on the star opens that point.
+ assert list(star.customdata) == [1]
+ # Markers without an index (failed points) open nothing.
+ assert 'typeof pt.customdata!=="number"' in _html(app._pes_plot_html)
+
+ def test_2d_map_posts_the_click(self):
+ from quantui.pes_scan_2d_plot import click_link_js
+
+ js = click_link_js("quantui-pes-plot", 3)
+ assert "__quantuiTrajGoTo" in js
+ assert PES_PICK_INBOX_CLASS in js
+ assert "Date.now()" in js # a repeat click is a change too
diff --git a/tests/test_comparison.py b/tests/test_comparison.py
index c14f148..906b95f 100644
--- a/tests/test_comparison.py
+++ b/tests/test_comparison.py
@@ -197,16 +197,19 @@ def test_contains_gap(self, two_summaries):
assert "12.5000" in html
assert "13.1000" in html
- def test_converged_icon(self, two_summaries):
+ def test_converged_says_yes(self, two_summaries):
+ # Words, not emoji (UX-31).
html = comparison_table_html(two_summaries)
- assert "✅" in html
+ assert ">Yes | " in html
+ assert "✅" not in html
def test_not_converged_icon(self):
s = CalcSummary(
label="x", formula="H2", method="RHF", basis="STO-3G", converged=False
)
html = comparison_table_html([s])
- assert "❌" in html
+ assert "No" in html
+ assert "❌" not in html
def test_none_converged_dash(self):
s = CalcSummary(label="x", formula="H2", method="RHF", basis="STO-3G")
diff --git a/tests/test_progress.py b/tests/test_progress.py
index dd65456..5d722fe 100644
--- a/tests/test_progress.py
+++ b/tests/test_progress.py
@@ -18,7 +18,7 @@ def test_all_steps_start_pending(self):
sp = StepProgress(["A", "B"])
html = sp.widget.value
# Both should show the pending icon (⬜)
- assert html.count("⬜") == 2
+ assert html.count("fa-square-o") == 2
def test_widget_is_html(self):
import ipywidgets as widgets
@@ -47,23 +47,23 @@ def test_start_shows_active_icon(self):
sp = StepProgress(["A", "B"])
sp.start(0)
html = sp.widget.value
- assert "⏳" in html
+ assert "fa-hourglass-half" in html
# Step B still pending
- assert "⬜" in html
+ assert "fa-square-o" in html
def test_complete_shows_done_icon(self):
sp = StepProgress(["A", "B"])
sp.start(0)
sp.complete(0)
html = sp.widget.value
- assert "✅" in html
+ assert "fa-check-circle" in html
def test_fail_shows_fail_icon(self):
sp = StepProgress(["A", "B"])
sp.start(0)
sp.fail(0)
html = sp.widget.value
- assert "❌" in html
+ assert "fa-times-circle" in html
def test_complete_with_message(self):
sp = StepProgress(["A"])
@@ -92,8 +92,8 @@ def test_multi_step_workflow(self):
sp.complete(1, "OK")
sp.start(2)
html = sp.widget.value
- assert html.count("✅") == 2
- assert html.count("⏳") == 1
+ assert html.count("fa-check-circle") == 2
+ assert html.count("fa-hourglass-half") == 1
def test_reset_returns_all_to_pending(self):
sp = StepProgress(["A", "B"])
@@ -102,9 +102,9 @@ def test_reset_returns_all_to_pending(self):
sp.start(1)
sp.reset()
html = sp.widget.value
- assert html.count("⬜") == 2
- assert "✅" not in html
- assert "⏳" not in html
+ assert html.count("fa-square-o") == 2
+ assert "fa-check-circle" not in html
+ assert "fa-hourglass-half" not in html
class TestStepProgressEdgeCases:
@@ -114,13 +114,13 @@ def test_single_step(self):
sp = StepProgress(["Only step"])
sp.start(0)
sp.complete(0)
- assert "✅" in sp.widget.value
+ assert "fa-check-circle" in sp.widget.value
def test_empty_message_ok(self):
sp = StepProgress(["A"])
sp.complete(0, "")
# Empty message should not crash
- assert "✅" in sp.widget.value
+ assert "fa-check-circle" in sp.widget.value
def test_html_special_chars_in_message(self):
sp = StepProgress(["A"])
diff --git a/tests/test_theme_contrast.py b/tests/test_theme_contrast.py
index a62d51e..930eeee 100644
--- a/tests/test_theme_contrast.py
+++ b/tests/test_theme_contrast.py
@@ -304,6 +304,7 @@ def test_the_standalone_export_is_left_unframed(self):
("app_builders.py", "app.viz_output"),
("app_builders.py", "app.preopt_preview_output"),
("app_builders.py", "app.vib_output"),
+ ("app_builders.py", "app._traj_viewer_output"),
("app_visualization.py", "viewer_output"),
],
)
@@ -559,3 +560,14 @@ def test_no_migrated_value_appears_as_a_raw_literal(self):
assert offenders == [], (
"raw hex reintroduced where a theme.py token exists: " f"{offenders}"
)
+
+
+def test_slider_rules_do_not_mix_engine_pseudo_elements():
+ """A selector list with both ::-webkit-* and ::-moz-* is invalid as a
+ whole, so the browser drops the rule (the scrubber track vanished)."""
+ css = theme.slider_chrome_css()
+ for rule in css.split("}"):
+ selector = rule.split("{")[0]
+ assert not ("::-webkit-" in selector and "::-moz-" in selector), selector
+ assert "input.quantui-range[type=range]::-webkit-slider-runnable-track" in css
+ assert ".widget-slider input[type=range]::-webkit-slider-thumb" in css
diff --git a/tests/test_ux_backlog_polish.py b/tests/test_ux_backlog_polish.py
new file mode 100644
index 0000000..b4f2c62
--- /dev/null
+++ b/tests/test_ux_backlog_polish.py
@@ -0,0 +1,621 @@
+"""UX backlog polish for 0.15.0 (UI/UX review 2026-12-05, DEC-036).
+
+Menu reasons shown inline (UX-22), icons instead of emoji (UX-31), theme
+colours in plots and run boxes (UX-32), themed scrollbars and selection,
+flatter nested boxes, instant run feedback (UX-34) and accessible names for
+icon-only controls.
+
+The browser side (how the lines look, what a screen reader says) needs a
+human check; these tests pin the widget state, the CSS and the page script.
+"""
+
+from __future__ import annotations
+
+import pathlib
+import re
+
+import pytest
+
+from quantui import app_menubar as mb
+from quantui import theme
+
+PKG = pathlib.Path(theme.__file__).parent
+
+
+@pytest.fixture
+def app(tmp_path, monkeypatch):
+ monkeypatch.setenv("QUANTUI_SETTINGS_PATH", str(tmp_path / "settings.json"))
+ from quantui.app import QuantUIApp
+
+ return QuantUIApp()
+
+
+def _hex_rgb(h: str) -> tuple:
+ h = h.lstrip("#")
+ if len(h) == 3:
+ h = "".join(c * 2 for c in h)
+ return tuple(int(h[i : i + 2], 16) for i in (0, 2, 4))
+
+
+def _lum(c: tuple) -> float:
+ def ch(v: int) -> float:
+ s = v / 255
+ return s / 12.92 if s <= 0.03928 else ((s + 0.055) / 1.055) ** 2.4
+
+ r, g, b = (ch(x) for x in c)
+ return 0.2126 * r + 0.7152 * g + 0.0722 * b
+
+
+def _ratio(fg: str, bg: str) -> float:
+ a, b = _lum(_hex_rgb(fg)), _lum(_hex_rgb(bg))
+ return (max(a, b) + 0.05) / (min(a, b) + 0.05)
+
+
+# ---------------------------------------------------------------------------
+# UX-22: the reason under an unavailable menu item
+# ---------------------------------------------------------------------------
+
+
+class TestMenuReasons:
+ def test_disabled_item_shows_its_reason_line(self, app):
+ mb.open_menu(app, "Calculate")
+ _item, btn = app._mb_items["run"]
+ line = app._mb_reasons["run"]
+ assert btn.disabled
+ assert line.layout.display == ""
+ assert "Load a molecule first" in line.value
+ assert f'id="{mb.reason_id("run")}"' in line.value
+ assert mb.MENU_REASON_TEXT_CLASS in line.value
+ # The tooltip stays too.
+ assert btn.tooltip.startswith("Unavailable: ")
+
+ def test_enabled_item_has_no_reason_line(self, app):
+ mb.open_menu(app, "Calculate")
+ btn = app._mb_items["setup_dialog"][1]
+ line = app._mb_reasons["setup_dialog"]
+ assert not btn.disabled
+ assert line.layout.display == "none"
+ assert line.value == ""
+
+ def test_reason_line_follows_its_item(self, app):
+ lst = app._mb_lists["Calculate"]
+ kids = list(lst.children)
+ btn = app._mb_items["run"][1]
+ assert kids[kids.index(btn) + 1] is app._mb_reasons["run"]
+
+ def test_reason_clears_when_item_becomes_available(self, app):
+ mb.open_menu(app, "Calculate")
+ assert app._mb_reasons["run"].layout.display == ""
+ app.run_btn.disabled = False # observer refreshes the open menu
+ assert app._mb_reasons["run"].layout.display == "none"
+ assert not app._mb_items["run"][1].disabled
+
+ def test_reason_text_is_escaped(self):
+ html = mb.reason_html("x", "&")
+ assert "<b>&" in html
+
+ def test_reason_id_is_a_valid_dom_id(self):
+ assert mb.reason_id("ana panel/1") == "quantui-mr-ana-panel-1"
+
+ def test_css_styles_the_line_with_a_text_token(self):
+ assert f".{mb.MENU_REASON_CLASS}" in mb.MENUBAR_CSS
+ token = mb.MENU_REASON_TOKEN.replace("_", "-")
+ assert f"color: var(--q-{token}) !important" in mb.MENUBAR_CSS
+ # Not faded like the disabled item itself.
+ rule = mb.MENUBAR_CSS[mb.MENUBAR_CSS.index(f".{mb.MENU_REASON_CLASS} {{") :]
+ rule = rule[: rule.index("}")]
+ assert "opacity" not in rule
+
+ @pytest.mark.parametrize("palette_id", theme.PALETTE_IDS)
+ def test_reason_line_contrast_on_menu_background(self, palette_id):
+ p = theme.get_palette(palette_id)
+ fg = getattr(p, mb.MENU_REASON_TOKEN)
+ # The drop-down list sits on bg_panel.
+ assert _ratio(fg, p.bg_panel) >= 4.5, palette_id
+
+ def test_page_script_links_reason_as_description(self):
+ from quantui import app_a11y
+
+ js = app_a11y.a11y_js()
+ assert f".{mb.MENU_REASON_CLASS}" in js
+ assert '"aria-describedby"' in js
+ assert "__REASON__" not in js
+
+
+# ---------------------------------------------------------------------------
+# UX-32: theme colours in run boxes, the live log and plot traces
+# ---------------------------------------------------------------------------
+
+# (box surface, text tokens drawn on it)
+ALERT_PAIRS = {
+ "error": ("surface_error_bg", ("accent_error", "text_body", "text_strong")),
+ "warning": ("surface_warning_bg", ("accent_warning", "text_body")),
+ "info": ("surface_info_bg", ("accent_info", "text_body", "text_strong")),
+}
+# Colours the run log (QuantUIApp._render_log) draws text in, on bg_panel.
+LOG_TEXT_TOKENS = (
+ "text_heading",
+ "text_body",
+ "text_strong",
+ "text_slate",
+ "text_slate_dark",
+ "text_subtle",
+ "accent_info",
+ "accent_purple",
+ "accent_teal",
+ "accent_success",
+ "accent_warning",
+ "accent_error",
+)
+
+
+class TestAlertBoxes:
+ @pytest.mark.parametrize("palette_id", theme.PALETTE_IDS)
+ @pytest.mark.parametrize("kind", sorted(ALERT_PAIRS))
+ def test_box_text_clears_aa(self, palette_id, kind):
+ p = theme.get_palette(palette_id)
+ bg, fgs = ALERT_PAIRS[kind]
+ for fg in fgs:
+ ratio = _ratio(getattr(p, fg), getattr(p, bg))
+ assert ratio >= 4.5, f"{palette_id}: {fg} on {bg} {ratio:.2f}:1"
+
+ def test_error_surface_is_a_css_variable(self):
+ block = theme.theme_css_block("Dark")
+ assert "--q-surface-error-bg: #450a0a" in block
+ assert theme.css.SURFACE_ERROR_BG == "var(--q-surface-error-bg)"
+
+ @pytest.mark.parametrize("kind", sorted(ALERT_PAIRS))
+ def test_style_uses_tokens_only(self, kind):
+ style = theme.alert_box_style(kind)
+ assert "#" not in style
+ assert "var(--q-surface-" in style
+ assert "var(--q-text-body)" in style
+
+ LIGHT_ONLY = re.compile(
+ r"#(fef2f2|fca5a5|7f1d1d|991b1b|fffbeb|fcd34d|92400e|fffbe6|fff5f5"
+ r"|d32f2f|eff6ff|93c5fd|0366d6|1e3a5f|6d28d9|1d4ed8|0f766e|d97706"
+ r"|0891b2|166534|374151)(?![0-9a-fA-F])",
+ re.IGNORECASE,
+ )
+
+ @pytest.mark.parametrize(
+ "name",
+ [
+ "app.py",
+ "app_slurm.py",
+ "app_runflow.py",
+ "help_content.py",
+ "backends/slurm_errors.py",
+ ],
+ )
+ def test_no_light_only_box_or_log_colours(self, name):
+ text = (PKG / name).read_text(encoding="utf-8")
+ assert self.LIGHT_ONLY.findall(text) == [], name
+
+ def test_failed_and_cancelled_boxes_use_tokens(self):
+ src = (PKG / "app.py").read_text(encoding="utf-8")
+ for title in (
+ "⚠ Calculation Failed",
+ "■ Calculation cancelled",
+ "⚠ Result NOT saved",
+ "⚠ Dependency Not Available",
+ ):
+ i = src.index(title)
+ window = src[max(0, i - 400) : i]
+ assert "alert_box_style(" in window, title
+
+ def test_slurm_error_panel_is_themed(self):
+ from quantui.backends.slurm_errors import format_error_html
+
+ html = format_error_html("SCF not converged")
+ assert "var(--q-surface-error-bg)" in html
+ assert "fa-times-circle" in html
+
+
+class TestLogColours:
+ @pytest.mark.parametrize("palette_id", theme.PALETTE_IDS)
+ @pytest.mark.parametrize("token", LOG_TEXT_TOKENS)
+ def test_log_text_on_panel(self, palette_id, token):
+ p = theme.get_palette(palette_id)
+ ratio = _ratio(getattr(p, token), p.bg_panel)
+ assert ratio >= 4.5, f"{palette_id}: {token} {ratio:.2f}:1"
+
+ def test_render_log_uses_only_tokens(self, app):
+ app._render_log(
+ "=" * 50
+ + "\n ✗ failed\n Molecule: H2O\n Energy: -76\n"
+ + "Warning: x\nError here\nMO energies\n occupied: 1\n"
+ + "E(MP2) = 1\n── Final SCF\n"
+ )
+ html = app._log_output_html.value
+ colours = re.findall(r"color:([^;\"]+)", html)
+ assert colours and all(c.startswith("var(--q-") for c in colours), colours
+
+
+class TestPlotDataColours:
+ @pytest.mark.parametrize("name", sorted(theme.PLOT_DATA_COLORS))
+ @pytest.mark.parametrize("palette_id", theme.PALETTE_IDS)
+ def test_trace_colour_keeps_3_to_1(self, name, palette_id):
+ colour = theme.PLOT_DATA_COLORS[name]
+ p = theme.get_palette(palette_id)
+ tc = theme.plotly_colors(palette_id)
+ for bg in (p.bg_panel, p.page_bg, tc["scene_bgcolor"]):
+ ratio = _ratio(colour, bg)
+ assert ratio >= 3.0, f"{name} on {palette_id} {bg}: {ratio:.2f}:1"
+
+ # Literal colours still allowed in the plot modules: the PES minimum star
+ # (gold, outlined) and the white grid-point markers on the 2-D heatmap.
+ ALLOWED = {"ca8a04", "1c1915", "1f2937"}
+ PLOT_MODULES = (
+ "ecd_plot.py",
+ "ir_plot.py",
+ "mulliken_plot.py",
+ "nmr_plot.py",
+ "pes_scan_2d_plot.py",
+ "raman_plot.py",
+ "comparison.py",
+ )
+
+ @pytest.mark.parametrize("name", PLOT_MODULES)
+ def test_plot_modules_take_colours_from_the_theme(self, name):
+ text = (PKG / name).read_text(encoding="utf-8")
+ found = {
+ m.group(1).lower()
+ for m in re.finditer(r"(?= 3.0
+ assert _ratio(p.page_bg, p.accent_info) >= 4.5
+
+
+class TestNestedBoxes:
+ def test_inner_tab_panel_loses_its_frame(self):
+ css = theme.nested_box_css()
+ assert css in theme._widget_chrome_css()
+ for sel in theme.NESTED_TAB_SELECTORS:
+ assert sel in css
+ # Only a tab panel inside another tab's panel.
+ assert sel.startswith(".widget-tab-contents ")
+ assert "border: none" in css
+ assert "background: transparent" in css
+ # The tabs still read as a group: one line under the tab bar.
+ assert "border-top: 1px solid var(--q-border)" in css
+
+ def test_overrides_the_general_panel_rule(self):
+ chrome = theme._widget_chrome_css()
+ assert chrome.index(theme.nested_box_css()) > chrome.index(
+ ".widget-tab-contents "
+ )
+
+ def test_molecule_input_is_a_tab_inside_the_root_tab(self, app):
+ import ipywidgets as widgets
+
+ def walk(w):
+ yield w
+ for c in getattr(w, "children", ()):
+ yield from walk(c)
+
+ inner = [
+ w
+ for w in walk(app.root_tab)
+ if isinstance(w, widgets.Tab) and w is not app.root_tab
+ ]
+ assert inner, "expected a nested tab set (Molecule Input)"
+
+
+# ---------------------------------------------------------------------------
+# UX-34: instant feedback on Run
+# ---------------------------------------------------------------------------
+
+
+def _water():
+ from quantui.molecule import Molecule
+
+ return Molecule(
+ ["O", "H", "H"],
+ [[0.0, 0.0, 0.117], [0.0, 0.757, -0.469], [0.0, -0.757, -0.469]],
+ )
+
+
+@pytest.fixture
+def water_app(app):
+ app._set_molecule(_water())
+ app.method_dd.value = "RHF"
+ app.basis_dd.value = "STO-3G"
+ return app
+
+
+class TestInstantRunFeedback:
+ def test_click_shows_starting_before_the_worker_runs(self, water_app):
+ from unittest.mock import patch
+
+ from quantui import app_runflow as rf
+ from quantui.app_workspace import job_state
+
+ app = water_app
+ seen = {}
+
+ def worker():
+ # What the page shows the moment the worker thread starts.
+ seen["button"] = (app.run_btn.disabled, app.run_btn.description)
+ seen["icon"] = app.run_btn.icon
+ seen["status"] = app.run_status.value
+ seen["job"] = job_state(app)
+ seen["chip"] = app._activity_btn.value
+
+ with patch.object(app, "_run_in_thread", side_effect=worker):
+ app._on_run_clicked(None)
+ import time
+
+ time.sleep(0.2)
+ assert seen["button"] == (True, rf.RUN_STARTING_LABEL)
+ assert seen["icon"] == rf.RUN_BUSY_ICON
+ assert seen["status"] == "Starting…"
+ assert seen["job"] == ("starting", "Starting…")
+ assert "Starting…" in seen["chip"]
+ assert rf.RUN_BUSY_CLASS in app.run_btn._dom_classes
+
+ def test_click_is_announced_politely(self, water_app):
+ from unittest.mock import patch
+
+ from quantui import app_a11y
+
+ app = water_app
+ region = app_a11y.build_live_region(app) # built in display()
+ with patch.object(app, "_run_in_thread"):
+ app._on_run_clicked(None)
+ assert "Starting the calculation" in region.value
+
+ def test_worker_hands_over_to_the_running_state(self, water_app):
+ from quantui import app_runflow as rf
+ from quantui.app_workspace import job_state
+
+ app = water_app
+ rf.mark_run_starting(app)
+ app._begin_run_lock()
+ rf.mark_run_running(app)
+ assert app.run_btn.description == rf.RUN_RUNNING_LABEL
+ assert job_state(app)[0] == "running"
+ assert "Running" in app._ws_footer.value
+
+ def test_end_of_run_restores_the_button(self, water_app):
+ from quantui import app_runflow as rf
+
+ app = water_app
+ idle = (app.run_btn.description, app.run_btn.icon)
+ rf.mark_run_starting(app)
+ app._begin_run_lock()
+ rf.mark_run_running(app)
+ app._end_run_lock()
+ assert not app.run_btn.disabled
+ assert (app.run_btn.description, app.run_btn.icon) == idle
+ assert rf.RUN_BUSY_CLASS not in app.run_btn._dom_classes
+
+ def test_validation_failure_restores_the_button(self, water_app):
+ from unittest.mock import patch
+
+ from quantui.app_workspace import job_state
+
+ app = water_app
+ idle = (app.run_btn.description, app.run_btn.icon)
+ with (
+ patch(
+ "quantui.inorganic_guards.preflight_messages",
+ return_value=["No basis for Xx"],
+ ),
+ patch.object(app, "_run_in_thread") as worker,
+ ):
+ app._on_run_clicked(None)
+ assert worker.call_count == 0
+ assert not app.run_btn.disabled
+ assert (app.run_btn.description, app.run_btn.icon) == idle
+ assert job_state(app)[0] == "idle"
+ assert "Adjust the settings" in app.run_status.value
+
+ def test_error_in_validation_still_restores_the_button(self, water_app):
+ from unittest.mock import patch
+
+ app = water_app
+ with (
+ patch("quantui.app_runflow._start_run", side_effect=RuntimeError("boom")),
+ pytest.raises(RuntimeError),
+ ):
+ from quantui.app_runflow import on_run_clicked
+
+ on_run_clicked(app, None)
+ assert not app.run_btn.disabled
+ assert not app._run_starting
+
+ def test_worker_that_fails_early_restores_the_button(self, water_app):
+ from unittest.mock import patch
+
+ from quantui import app_runflow as rf
+
+ app = water_app
+ idle = app.run_btn.description
+ rf.mark_run_starting(app)
+ app._begin_run_lock()
+ with patch.object(app, "_do_run", side_effect=OSError(28, "disk full")):
+ app._run_in_thread()
+ assert not app.run_btn.disabled
+ assert app.run_btn.description == idle
+ assert not app._run_starting
+
+ def test_busy_style_outranks_the_disabled_style(self):
+ from quantui.app import _APP_CSS
+
+ assert "button.jupyter-button.mod-success.quantui-run-busy:disabled" in _APP_CSS
+ assert "cursor: progress" in _APP_CSS
+
+
+# ---------------------------------------------------------------------------
+# Accessible names for icon-only buttons and unlabelled fields
+# ---------------------------------------------------------------------------
+
+
+def _app_roots(app):
+ import ipywidgets as widgets
+
+ roots = []
+ for v in vars(app).values():
+ if isinstance(v, widgets.Widget):
+ roots.append(v)
+ elif isinstance(v, (list, tuple)):
+ roots += [x for x in v if isinstance(x, widgets.Widget)]
+ elif isinstance(v, dict):
+ roots += [x for x in v.values() if isinstance(x, widgets.Widget)]
+ return roots
+
+
+class TestAccessibleNames:
+ def test_every_built_control_can_be_named(self, app):
+ from quantui.app_a11y import unnamed_controls
+
+ names = {id(v): k for k, v in vars(app).items()}
+ bad = [
+ f"{names.get(id(w), type(w).__name__)}: {why}"
+ for w, why in unnamed_controls(_app_roots(app))
+ ]
+ assert bad == []
+
+ def test_after_a_molecule_loads_too(self, app):
+ from quantui.app_a11y import unnamed_controls
+
+ app._set_molecule(_water())
+ assert unnamed_controls(_app_roots(app)) == []
+
+ def test_the_scan_catches_unnamed_controls(self):
+ import ipywidgets as widgets
+
+ from quantui.app_a11y import unnamed_controls
+
+ box = widgets.VBox(
+ [
+ widgets.Button(icon="refresh"),
+ widgets.Button(description="?"),
+ widgets.Button(description="?", tooltip="Help on methods"),
+ widgets.Button(description="Run"),
+ widgets.Dropdown(options=["a"]),
+ widgets.Dropdown(options=["a"], tooltip="Format"),
+ widgets.ToggleButtons(options=["▶", "Stop"]),
+ widgets.Text(placeholder="search name or formula"),
+ widgets.Textarea(),
+ ]
+ )
+ bridge = widgets.Textarea()
+ bridge.add_class("quantui-orb-png-inbox")
+ box.children = (*box.children, bridge)
+ found = unnamed_controls([box])
+ # refresh icon, "?", bare Dropdown, "▶" option, bare Textarea.
+ assert len(found) == 5, found
+
+ def test_bridge_fields_leave_the_tab_order(self):
+ from quantui import app_a11y
+
+ js = app_a11y.a11y_js()
+ assert '[class$="-inbox"] textarea' in js
+ assert '"tabindex","-1"' in js
+
+ def test_help_buttons_have_a_tooltip_for_their_name(self, app):
+ helps = [
+ w
+ for k, w in vars(app).items()
+ if k.endswith("_help_btn") and hasattr(w, "description")
+ ]
+ assert helps
+ for w in helps:
+ assert w.tooltip.strip(), w
+
+ def test_page_script_names_icon_buttons_from_tooltips(self):
+ from quantui import app_a11y
+
+ js = app_a11y.a11y_js()
+ assert "iconNames()" in js
+ assert 'setAttribute("aria-label", tip)' in js
+ assert "GLYPH" in js
+
+ def test_atom_table_fields_are_named(self, app):
+ import ipywidgets as widgets
+
+ from quantui.app_a11y import _walk_widgets
+
+ tips = {
+ w.tooltip
+ for w in _walk_widgets(_app_roots(app))
+ if isinstance(w, (widgets.FloatText, widgets.Text)) and w.tooltip
+ }
+ assert {"Element symbol", "x coordinate (Å)", "z coordinate (Å)"} <= tips
+
+
+def test_long_menus_scroll_inside_their_frame():
+ # The bar's overflow:visible rule (0,2,0) used to outrank the list's own
+ # overflow, so a long Results menu spilled past its frame (headless
+ # Voilà check, 2026-12-06).
+ css = mb.MENUBAR_CSS
+ rule = f".{mb.MENUBAR_CLASS} .widget-box.{mb.MENU_LIST_CLASS} {{"
+ assert rule in css
+ body = css[css.index(rule) :]
+ body = body[: body.index("}")]
+ assert "overflow-y: auto !important" in body
+ assert css.index(rule) > css.index(f".{mb.MENUBAR_CLASS} .widget-box {{")
diff --git a/tests/test_uxrev_polish.py b/tests/test_uxrev_polish.py
index 86fad31..5c8a37d 100644
--- a/tests/test_uxrev_polish.py
+++ b/tests/test_uxrev_polish.py
@@ -133,21 +133,30 @@ def test_labels_do_not_wrap_and_no_side_stripe(self, app):
class TestIconsNotEmoji:
- # Colour emoji used as status icons in the app's own UI modules (UX-31).
- # (molecule.py / pubchem.py error texts are left to the XYZ-error work.)
- FILES = (
- "app_formatters.py",
- "app_builders.py",
- "app_runflow.py",
- "app_visualization.py",
- "app_slurm.py",
- "visualization_py3dmol.py",
- "orbital_visualization.py",
- "app.py",
+ # Colour emoji used as status icons (UX-31). 0.14 covered the app's own
+ # UI modules; 0.15 extends this to every module in the package
+ # (molecule.py XYZ errors, pubchem.py, comparison.py, the Slurm error
+ # panel, run summaries). Text-style glyphs (check marks, the warning
+ # triangle without VS16) are not colour emoji and stay.
+ FILES = tuple(
+ sorted(
+ p.relative_to(PKG).as_posix()
+ for p in PKG.rglob("*.py")
+ if "__pycache__" not in p.parts
+ )
)
# (The plain arrow glyph on the viewers' Save PNG buttons stays: those
# buttons also live in standalone exports, which have no icon font.)
- EMOJI = re.compile("[\U0001f300-\U0001faff\u23f3\u2705\u274c]")
+ # Characters that render as colour emoji by default (Emoji_Presentation),
+ # plus the VS16 selector that turns a text glyph (ℹ, ⚠) into emoji.
+ EMOJI = re.compile(
+ "[\U0001f300-\U0001faff\u231a\u231b\u23e9-\u23ec\u23f0\u23f3"
+ "\u25fd\u25fe\u2614\u2615\u2648-\u2653\u267f\u2693\u26a1"
+ "\u26aa\u26ab\u26bd\u26be\u26c4\u26c5\u26ce\u26d4\u26ea"
+ "\u26f2\u26f3\u26f5\u26fa\u26fd\u2705\u270a\u270b\u2728"
+ "\u274c\u274e\u2753-\u2755\u2757\u2795-\u2797\u27b0\u27bf"
+ "\u2b1b\u2b1c\u2b50\u2b55\ufe0f]"
+ )
@pytest.mark.parametrize("name", FILES)
def test_no_status_emoji_in_string_literals(self, name):
diff --git a/tests/test_viz_low_audit.py b/tests/test_viz_low_audit.py
index b9571ea..45ab7a7 100644
--- a/tests/test_viz_low_audit.py
+++ b/tests/test_viz_low_audit.py
@@ -400,6 +400,8 @@ def boom(*a, **k):
raise RuntimeError(_EVIL)
monkeypatch.setattr(av, "build_trajectory_viewer_html", boom)
+ # The on-screen viewer is built in parts (pane + panel halves).
+ monkeypatch.setattr(av, "build_trajectory_viewer_parts", boom)
app = Mock()
app._traj_render_token = 0
app._plotly_theme_colors.return_value = {"scene_bgcolor": "white"}