GIScience / orstools-qgis-plugin

Plugin for QGIS with a set of tools to use openrouteservice API´s, based on openstreetmap
https://plugins.qgis.org/plugins/ORStools/
MIT License
91 stars 31 forks source link

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

Closed merydian closed 1 month ago

MichaelsJP commented 9 months ago

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?

merydian commented 9 months ago

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.

MichaelsJP commented 8 months ago

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?

merydian commented 8 months ago

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?

MichaelsJP commented 8 months ago

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?

merydian commented 8 months ago

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.

MichaelsJP commented 8 months ago

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?

TheGreatRefrigerator commented 8 months ago

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.

koebi commented 7 months ago

Maybe this blog post is of relevance here?

merydian commented 1 month ago

As @TheGreatRefrigerator suggested this now lives here wit QgsSettings: #249