I am writing a qgis plugin to display spectral information stored in a geodatabase (Spectre Viewer). For this, I need calibration factors to get from channel values to energies. I want the end users to be able to set their own calibration factors that will vary depending on the layer and field name selected to plot the spectra.
So I need to store some persistent data. I would prefer to either store it in the directory where the plugin is stored, store it in the active project or store it in the general QGIS settings. I do see pros and cons of all those designs.
The data I want to store will be a tree structure:
Layer1 -- field1_1 -- [set of numeric calibration values ] \- field1_2 -- [set of numeric calibration values ] Layer2 -- field2_1 ...
Are there any way to store custom data in the QGIS project file or in general QGIS settings?
For a while I was thinking about storing the data as a json file in the plugin directory, then I discovered that this file was erased when I update the plugin, which kind of makes it useless. I can of course save the file anywhere the user running qgis can save a file, but I feel that would be a bit too much "messing around where I am not supposed to be messing around".