Check Addons settings fields
#1
Hi,
I`ve implemented a subtitle addon to a website that requires login.
It looks like that:
Image
So in the addons settings i`ve added a email & password field, I want to check users credentials when he clicks on check login details.
When he clicks on that i`m executing script, but the problem with it is that xbmcaddon.Addon().getSettings() not getting the values that the user entered till he saves the settings panel.

There is any best practice for my scenario?
Reply
#2
(2016-07-23, 18:57)CaTz Wrote: Hi,
I`ve implemented a subtitle addon to a website that requires login.
It looks like that:
Image
So in the addons settings i`ve added a email & password field, I want to check users credentials when he clicks on check login details.
When he clicks on that i`m executing script, but the problem with it is that xbmcaddon.Addon().getSettings() not getting the values that the user entered till he saves the settings panel.

There is any best practice for my scenario?


You need to add the close option, see very bottom of this page:

http://kodi.wiki/view/Add-on_settings

This will cause the settings dialog to close and therefore save the settings.

I'm pretty sure in this instance you'll also need to pass the addon id into the xbmcaddon.Addon, i.e.

Code:
xbmcaddon.Addon('xxxxxxx').getSetting

When I do this sort of thing, I also reopen the settings dialog at the end of the script for a better user experience.

And if you want to jump thru a few hoops you can even put focus back to the button they originally clicked on, for the ultimate user experience Smile


Sent from my iPhone
Reply
#3
There's xbmc.Monitor.onSettingsChanged() callback that fires on setting changes. But beware that it fires when a setting is changed programmatically too via Addon.setSetting(), so never ever save any settings in your re-implemented onSettingsChanged method or you will end up in an endless loop.
Reply

Logout Mark Read Team Forum Stats Members Help
Check Addons settings fields0