MDANSE icon indicating copy to clipboard operation
MDANSE copied to clipboard

GUI warning for trajectories without a fixed cell

Open MBartkowiakSTFC opened this issue 10 months ago • 2 comments

Description of work The GUI should detect trajectories which do not have a fixed unit cell, and warn the user that the analysis results may be incorrect.

closes #764

Fixes

  1. Added a warning string to the configurators.
  2. WidgetBase has a method for marking warnings.
  3. Both the input widget and the run button are highlighted in case of a warning.

To test Load a fixed-cell trajectory, an NPT trajectory, and (optionally) a trajectory without a unit cell, or with a unit cell set to 0. When an analysis is picked in the GUI, the trajectory widget should be highlighted for all the trajectories except the one with a fixed cell, and the tooltip text should show a warning relevant to each trajectory.

MBartkowiakSTFC avatar May 15 '25 13:05 MBartkowiakSTFC

I will rewrite it to use warnings instead. There are some pre-defined warning types there. What warning category should it be if the unit cell is missing? Runtime, User, or do we need a new one?

MBartkowiakSTFC avatar May 23 '25 12:05 MBartkowiakSTFC

Given we have a lot of custom exceptions I see no real reason to not use some custom warnings if there's no relevant warning.

oerc0122 avatar May 23 '25 12:05 oerc0122

At the moment it is not guaranteed that the Configurator.configure method will be called by the widget. For trajectories, we try to load them as little as possible, and so we will be re-using an HDFTrajectoryConfigurator instance. For this reason, it still makes sense to store the warning status as an attribute in the Configurator. The mechanism of catching a warning requires the widget to exist already when the configure is called.

The current version of this PR still uses the warning_status attribute. The setter of warning_status now produces also a Python warning and logs the warning, to make sure that the warning information is available also outside of the GUI.

Also, in an attempt to clean up the code, most @property decorators have been removed from the Configurator classes.

MBartkowiakSTFC avatar Jun 11 '25 15:06 MBartkowiakSTFC