JYU-IBA / potku

Potku is analysis and simulation software for ToF-ERD measurements
https://www.jyu.fi/science/en/physics/research/infrastructures/accelerator-laboratory/pelletron/potku/
GNU General Public License v2.0
7 stars 7 forks source link

Fix simulation resetting settings changes #321

Closed samivout closed 1 year ago

samivout commented 1 year ago

Element simulations were resetting needlessly when changing both request-wide settings or specific settings. This happened due to ScientificSpinBox values for ToF slope, ToF offset, angle offset and angle slope in detector settings in detector settings being initialized with zero value and only after initialization was the actual value from the detector object set in the fields. This caused the change tracking feature to trigger and think that there were changes that require resetting simulations.

This was fixed by initializing the field values with required values, instead of setting them later.

Additionally fixes an issue, where detector settings didn't save after closing request settings dialog. In the function that is called upon clicking ok in the dialog, there was no call to save the updated settings to the request default detector. I added the call to detector.to_file() method to save the updated settings to the default detector file, fixing the problem.