pypeit.dashboard.util module
Utilities for the PypeIt Dashboard GUI.
The central concern here is loud failures: by default an exception raised inside a Qt slot is swallowed by the C++ event loop, so the application silently misbehaves and the traceback is lost. These helpers ensure such failures are logged with full tracebacks.
The exception hook defined here is installed by the pypeit_dashboard
script (see pypeit.scripts.dashboard.PypeItDashboard.init_log()),
which overrides the general hook installed by
PypeItLogger.
- pypeit.dashboard.util.dashboard_excepthook(exc_type, exc_value, exc_tb)[source]
Exception hook that logs the full traceback through PypeIt’s logger.
Intended to be assigned to
sys.excepthookby the dashboard script’sinit_log. The traceback is emitted via the logger (console stream and any log file), rather than printed raw to stderr, so a failure inside the Qt event loop always leaves a record in the reduction log.- Parameters:
exc_type (type) – The exception class.
exc_value (BaseException) – The exception instance.
exc_tb (traceback) – The associated traceback object.
- pypeit.dashboard.util.safe_slot(func)[source]
Decorate a Qt slot so any exception it raises is logged with a full traceback and then re-raised, instead of being silently swallowed by the Qt event loop.
- Parameters:
func (callable) – The slot method to wrap.
- Returns:
The wrapped slot.
- Return type:
callable