Settings not being saved when using <reuselanguageinvoker>
#1
Hi, when I set <reuselanguageinvoker>true</reuselanguageinvoker> in addon.xml then changes in addon settings are not being saved. Only way to make any change to settings is when I open settings dialog via custom menu item inside plugin dir that calls "ADDON.openSettings()" when clicked. When you open settings dialog from Kodi "Information" window via Configure button then nothing is saved after you click OK.

Is there any particular reason why this can happen?
Reply
#2
When I change any settings from kodi menu, press OK and open settings again then I can see value saved but only until I open the plugin. After that it is in previous state (as it was when plugin was opened last time). 

For example:
1. Open plugin
2. Open plugin settings with plugin action
3. Set bool option to True
4. Press OK
5. Open settings same with plugin action again
6. It is still True
------------------------------------
1. Open plugin settings from Kodi menu
2. Set bool option to False
3. Press OK
4. Open settings from Kodi menu again
5. It is still False
6. Open plugin
7. Open settings with plugin action
8. It is True again
Reply
#3
Can someone help me please? I can donate to the project if its needed first to get some support. I am getting desperate with this bug. I cannot use settings properly in the plugin.
Reply
#4
The settings are not saved if you do not go to it from the add-on or you have to restart Kodi to save it. When you save a setting outside an add-on (Kodi menu) and then open it, it overwrites the settings the add-on had when it was last opened.
Reply
#5
So I managed to find why this can happen. For anyone else struggling with this make sure that your service script is not calling Addon.getSetting() over and over in each monitor tick.
Reply
#6
It's happens, if you make addon object at start of your service and use it all times.
You should create new addon object all time, when you read settings.
I'm use such construction in my addons:

python:

class MyMonitor(xbmc.Monitor):

    def __init__(self):
        super(MyMonitor, self).__init__()

        self._settings = self._get_settings()

    def onSettingsChanged(self):
        super(MyMonitor, self).onSettingsChanged()

        new_settings = self._get_settings()

        #Checking changed settings

        self._settings.update(new_settings)

    def _get_settings(self):
        addon = Addon()

        settings = {'setting1': addon.get_setting('setting1),
                          'setting2': addon.get_setting('setting2'),
                          }
        return settings

if __name__ == '__main__':

    sleep_sec = 10

    monitor = MyMonitor()
    while not monitor.abortRequested():
        if monitor.waitForAbort(sleep_sec):
            break
My addons: Gismeteo
Reply

Logout Mark Read Team Forum Stats Members Help
Settings not being saved when using <reuselanguageinvoker>0