UI refactor#13
Merged
Merged
Conversation
Replace hiding/showing of analysis accordions with in-DOM placeholders and collapsed state. Introduces a _PANEL_META class var and per-panel unavailable message + content wrappers so panels remain in the DOM but start collapsed (selected_index=None) and show an inline "not available" note until activated. Update activate/deactivate logic to toggle selected_index and swap placeholders, refresh IR and Energies views when panels are expanded, and read tooltips from _PANEL_META. Also tweak some checkbox descriptions. Tests updated to expect visible-but-collapsed accordions and to verify placeholder/content swapping.
Update Copilot instructions to reflect UI and test changes: add new utility modules (issue_tracker, log_utils, benchmarks) to the file list; change Analysis tab panels to be always present in the DOM with "Not available" placeholders; revise panel metadata to use (panel_name, accordion_attr_name, placeholder) as the single source of truth; simplify panel activation/deactivation semantics (collapse/restore placeholders, never remove from DOM); update developer steps for adding panels. Add critical quality rules: ban include_plotlyjs="cdn" (prefer "require" or inline) and require wrapping .observe() callbacks with _safe_cb to surface exceptions to the Log tab. Update __init__ attributes (unavail placeholders, content boxes, pending button removal) and refresh tests list/baseline to match new behavior. These changes improve offline reliability (Plotly), error visibility in Voilà, and make panel lifecycle explicit for history replay.
Introduce a _safe_cb wrapper to .observe() handlers so exceptions are logged instead of silently dropped, and wire many widget observers through it (trajectory, IR/orb accordions, viz/theme/preset/calc inputs, orbital controls, vibrational controls, slider/frame updates, etc.). Refactor the Analysis panel switcher: remove the button-based switcher UI and per-button logic, simplify _select_ana_panel/_activate/_deactivate behavior to use accordion selected_index and add accordion observers to re-render Plotly charts when shown. Replace several include_plotlyjs='cdn' usages with 'require' to avoid silent failures when offline. Tighten exception handling in pubchem.smiles_to_xyz and check_pubchem_availability (catch Exception instead of bare except). Update tests to match the refactor and add tests/test_code_quality.py to forbid use of include_plotlyjs='cdn' and bare except/pass patterns.
Refresh .github/copilot-instructions.md to match recent code changes: document new QuantUI app build flow (new widgets, _wire_callbacks ordering, _assemble_tabs producing 7 root tabs), update root-tab order and note Help is a floating overlay, and add/rename helper builders (status, theme, welcome, issue widgets). Adjust Analysis panel registry and panel metadata (reorder/availability for frequency panels), tighten thread-safety guidance for Plotly rendering, and update supported methods/bases list. Update test invocation to run tests/ without coverage, bump collected test count and baseline, and add/rename several test modules (issue tracker, visualization, templates, analysis history variants), plus stricter code-quality entry. Revise dependency section into explicit groups with version hints and a new install extras command to reflect runtime and dev extras. Overall: keep the developer-facing instructions consistent with the current implementation and test matrix.
Replace widgets.HTML with widgets.Output for Plotly/matplotlib displays to ensure JS execution and proper display. Add helpers (_set_html_output, _set_plotly_figure_output, _render_plotly_figure, _clear_output_widget) and update code paths to render/clear Output widgets. Make IR control wiring main-thread safe (_wire_ir_controls, _on_ir_mode_changed, _on_ir_fwhm_changed) and queue callbacks where needed. Change IR plot x-axis ordering to low→high (400→4000) and update tests to assert Output.outputs usage and new x-axis orientation.
Introduce a module-level _LAYOUT_TRAITS set and a _layout(...) helper that normalizes legacy/alternate layout kwargs (overflow_y -> overflow, gap -> grid_gap, flex_wrap -> flex_flow) and filters out unsupported traits before constructing widgets.Layout. Replace direct widgets.Layout(...) calls across quantui/app.py with _layout(...) to avoid traitlets warnings/noise and improve compatibility with varied layout argument names. No behavioral changes intended beyond suppressing trait warnings and normalizing inputs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request makes significant improvements to the QuantUI documentation and codebase to clarify the app’s architecture, enforce best practices, and enhance test coverage. The changes include a major overhaul of
.github/copilot-instructions.mdto reflect the current UI structure, new developer guidelines, expanded test coverage, and several code quality and UX fixes.Documentation and Architecture Updates:
Updated the
.github/copilot-instructions.mdto reflect the new app structure, including a detailed breakdown of the UI widget hierarchy, tab order, and analysis panel management. The documentation now emphasizes always-visible analysis panels, improved placeholder handling, and the introduction of new widgets like the status panel and issue tracker. [1] [2] [3] [4] [5] [6] [7] [8]Added new developer guidelines, including rules for widget updates in threads, mandatory use of
_safe_cbfor.observe()callbacks, and requirements for pre-commit/test runs before handoff. [1] [2]Testing and Coverage Improvements:
Expanded the test suite from ~700 to ~875 tests, with new tests for issue tracking, notebook interactions, analysis panel history replay, IR plotting, and static code quality (e.g., banning CDN Plotly.js usage). [1] [2]
Updated test expectations for IR accordion widgets to match the new always-visible, collapsed-by-default behavior.
Analysis Panel and UI Behavior:
Refactored the analysis panel registry and panel activation logic to ensure all panels are always present in the DOM, with unavailable panels showing a placeholder message instead of being hidden. The
_PANEL_METAstructure is now the single source of truth for panel metadata. [1] [2] [3] [4]Updated the ordering and activation logic for frequency calculation panels in
_PANEL_REGISTRY, ensuring correct display order and default selection.Code Quality and UX Fixes:
Changed the IR plot x-axis range in
ir_plot.pyto match the user-facing convention (low to high wavenumber).Replaced bare
except:withexcept Exception:inpubchem.pyfor safer error handling and to pass static analysis checks. [1] [2]Dependency Management:
These changes bring the documentation, tests, and codebase into alignment with the current and planned QuantUI architecture, improve reliability and maintainability, and enforce best practices for future development.