Getting notified about my plugins settings changed
#1
Is it possible to run my script with a certain parameter when the user changes the addons settings?

I have this simple settings file:
Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
  <setting id="prefix" type="text" label="Media Prefix" default="HD" />
</settings>

I need to change the current skins xml file and reload the skin when the user changed this setting. Is this currently possible?
Reply
#2
Walter Sobchak Wrote:...
I need to change the current skins xml file and reload the skin when the user changed this setting. Is this currently possible?

You can do the following on plugin start to check for changed settings::
Code:
if getSetting('prefix_old') != getSetting('prefix'):
    foo('something_has_changed')
    setSetting('prefix_old', getSetting('prefix'))

If you have to check more options you can do something like this:
https://github.com/dersphere/script.game...ui.py#L637

regards,
sphere
My GitHub. My Add-ons:
Image
Reply
#3
Thanks for your reply.
But there is no way my plugin is called by the settings dialog when settings are changed? The user would have to start my plugin again after the settings were changed?
Reply
#4
Hi,

no - as far is I know there is no automically way.

You could add a something like:
<setting id="apply" type="action" label="Apply changes" default="RunPlugin(plugin.video.foobar/?action='apply')" />

I saw this on other plugins and typed it as I remember, please test/fix before use.

But this would be more like a hack.

What dou you exactly want to do? Maybe there is a better way...

regards,
sphere
My GitHub. My Add-ons:
Image
Reply

Logout Mark Read Team Forum Stats Members Help
Getting notified about my plugins settings changed0