WasatchPhotonics / ENLIGHTEN

Open-source spectroscopy application for controlling and taking measurements from Wasatch Photonics spectrometers.
https://wasatchphotonics.com/product-category/software/
MIT License
3 stars 6 forks source link

Persistent save data location #338

Closed samiebee43 closed 9 months ago

samiebee43 commented 9 months ago
C:\Users\Sbee\Documents\EnlightenSpectra

The save data location can be changed in Enlighten, but it does not persist with restarts. It should.

samiebee43 commented 9 months ago

This was observed on Enlighten 3.2.36.

Step 1 is to see if this applies to the latest release.

samiebee43 commented 9 months ago

It does apply to the latest release.

The setting for save directory does not really do anything. Most of enlighten relies on get_default_save_directory

the user setting is in the save options instance.

So now we have a function that is called from all over the place that takes no parameters (normally just returns the string C:\Documents\EnlightenSpectra) that now needs awareness of a specific instance.

This can be done most easily using the get_ctl function discussed in #337

samiebee43 commented 9 months ago

Note that MeasurementFactory and Measurement do actually reference the directory saved in SaveOptions. So when the user set that param their spectra would save to the location for the duration of that session.

I'm going to change it so get_default_save_directory is aware of the user setting and I will make it persistent. Measurement could probably call it from common as well and not need the instance passed in.

samiebee43 commented 9 months ago

Ended up not using get_ctl.

It's concerning that there'd be no way for the caller to know if Controller has been instantiated yet.