Skip to content
This repository has been archived by the owner on Jun 4, 2020. It is now read-only.

Customization : override some plugin default settings #43

Closed
ymoisan opened this issue Feb 22, 2016 · 9 comments
Closed

Customization : override some plugin default settings #43

ymoisan opened this issue Feb 22, 2016 · 9 comments

Comments

@ymoisan
Copy link
Contributor

ymoisan commented Feb 22, 2016

There is a need to add organization-specific items to customize the plugin installation. Two such items for the versioning plugin are :

  • disable the use of branches
  • provide a different url for the documentation

Second url below says "global settings ... provided directly by Qt framework by the means of QSettings class. By default, this class stores settings in system’s “native” way of storing settings, that is — registry (on Windows), .plist file (on Mac OS X) or .ini file (on Unix)." so it would be a matter of defining those settings for the plugin, have default values for those settings and those would be writtent at the right location in users computers.

Useful urls :

@ymoisan
Copy link
Contributor Author

ymoisan commented Feb 22, 2016

Question : what if the user installing the plugin on Windows does not have write access to the registry ? Can we have a default value in the plugin runtime then until sys admins fill in values for those settings as registry keys ?

@vmora
Copy link
Contributor

vmora commented Feb 22, 2016

1 Only the one setting up qgis for health will need writting
2 Normally QSetting will deal with those kind of problems (to be tested) because qgis makes use of those, and there is no problem that I know about.

@ymoisan
Copy link
Contributor Author

ymoisan commented Feb 22, 2016

Thanx. To avoid problems for non admin Windows users, I would check in the plugin if a value is set. If not, I'd give it the default (hardcoded in Python). Else I'd take whatever QSettings.value() returns.

@vmora
Copy link
Contributor

vmora commented Feb 23, 2016

The value(name, default) is meant for that, no need to check, it will return the default if value is not defined.

@ymoisan
Copy link
Contributor Author

ymoisan commented Feb 23, 2016

Excellent, thanx ! I'd still have to check for valid url in the case of the help button though.

@ymoisan
Copy link
Contributor Author

ymoisan commented Feb 24, 2016

Two (2) QSettings implemented : 04e66e4 (plus recent edit c89e1b9)

'qgis-versioning/use-branches'

branches disabled if value is "False" or "false" (booleans cast to str to make sure we catch those too); else enabled

'qgis-versioning/help-url'

any well-formed url, else the default RTD site.

Pretty simple. Works whether system wide (e.g. registry keys) settings exist or not. Tested on Ubuntu and Windows 10.

@vmora : does that look OK to you ? If so will add docs for that and I should submit a PR tomorrow.

The general idea is that customization is possible, not compulsory. Therefore I have not written a short one-off Python script to set the variables yet (nor did I add any code in historize to set those QSettings). I think just instructing users how they can customize those two settings in the Python command prompt in QGIS is enough. Active Directory administrators will like the fact they can apply organization wide settings if they wish. See docx below for an example in Windows.

hkey-qgis-versioning-before-after-1.docx

@ymoisan
Copy link
Contributor Author

ymoisan commented Feb 25, 2016

Added documentation : 8424e4c

@vmora
Copy link
Contributor

vmora commented Apr 7, 2017

@ymoisan from the discussion, I think we can close that, can you confirm ?

@SebastienPeillet
Copy link

Project migrated to : https://gitlab.com/Oslandia/qgis/qgis-versioning

@delhomer delhomer closed this as completed Jun 4, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants