orstools-qgis-plugin icon indicating copy to clipboard operation
orstools-qgis-plugin copied to clipboard

Move the config-yaml to general plugin folder to avoid deletion when plugin is updated.

Open merydian opened this issue 1 year ago • 9 comments

merydian avatar Oct 04 '23 13:10 merydian

What happens if we have an update for the config file, new parameters etc., and there is still an old one in the permanent location?

MichaelsJP avatar Oct 06 '23 07:10 MichaelsJP

Currently there will probably be a permission denied error. One way to solve this could be adding the plugin version to the config file and checking for it, overwriting the old config file when theres a new version.

merydian avatar Oct 06 '23 08:10 merydian

Currently there will probably be a permission denied error. One way to solve this could be adding the plugin version to the config file and checking for it, overwriting the old config file when theres a new version.

Wouldn't that be the opposite of what this issue targets to achieve?

MichaelsJP avatar Oct 16 '23 11:10 MichaelsJP

The way the current code in this PR handles it is every time the plugin is reloaded or QGis is started, in the init, there's a check that compares the plugin version with the version of the config file. If there's a difference, the old providers will be copied. For the case that new parameters (or such) are introduced, @TheGreatRefrigerator and I concluded that a custom logic to incorporate them has to be included. I.e. we can't care for the new parameters in advance. There are warning comments in the init and the config-yaml.

Maybe this is too much trouble for this issue?

merydian avatar Oct 16 '23 15:10 merydian

Right now, we only keep the providers. Imo, that is fine how it is now. Maybe it's worth keeping an additional logic in case we modify the provider selection somehow. Old config structures shouldn't break new configs. If we're not going to change the provider logic, we could also just merge how it is now.

@Merydian What do you think?

MichaelsJP avatar Nov 02 '23 08:11 MichaelsJP

The problem i still see is potential issues with the config-yaml being in the plugin folder. I am not certain on how we can make sure there's nothing wrong with that.

merydian avatar Nov 02 '23 10:11 merydian

The problem i still see is potential issues with the config-yaml being in the plugin folder. I am not certain on how we can make sure there's nothing wrong with that.

@koebi or @TheGreatRefrigerator what do you think?

MichaelsJP avatar Nov 03 '23 09:11 MichaelsJP

Maybe we should look into moving our settings to the QGIS plugin settings: https://docs.qgis.org/3.28/en/docs/pyqgis_developer_cookbook/settings.html?highlight=storing%20settings

We could just JSON.dumps the config object.

TheGreatRefrigerator avatar Nov 03 '23 10:11 TheGreatRefrigerator

Maybe this blog post is of relevance here?

koebi avatar Nov 06 '23 16:11 koebi