XBMC Community Forum
HOW-TO write GUI settings for XBMC python plugins and scripts (addons) - Printable Version

+- XBMC Community Forum (http://forum.xbmc.org)
+-- Forum: Development (/forumdisplay.php?fid=32)
+--- Forum: Python Add-on Development (/forumdisplay.php?fid=26)
+--- Thread: HOW-TO write GUI settings for XBMC python plugins and scripts (addons) (/showthread.php?tid=29577)

Pages: 1 2 3 4 5 6 7 8 9 10


- Nuka1195 - 2009-01-06 00:40

enable="eq(control_count_from_here,value_that_control_should_be)"

eg
enable="eq(-2,2)"

means if the control two positions before this one is equal to 2, enable it

you can also use the ! for not

and gt() for greater than and lt() for less than

hopefully we can better document these in the wiki. i'm not very good at writing.
and you can group commands, i believe only + for and, | for or. i don't think you can mix + and |


- BigBellyBilly - 2009-02-11 15:35

Is there a way of exec a script and/or xbmc function from a setting option ?

ie. option 'View Readme' can launch a script function named viewReadme()

This would allow the of one/same settings dialog instead of having a MainMenu (of actions) which would also have a 'Settings Menu' option.

suggested format:
Quote:<setting id="readme" type="exec" source="viewReadme" label="30000" />

BBB


- Nuka1195 - 2009-02-11 17:27

yes type="action"


- BigBellyBilly - 2009-02-11 17:33

Thanks.
got an example for me ?

or could you point me to the doc for this plugin settings use. Its not in the plugin.html and struggling to find it in the wiki ?


- Nuka1195 - 2009-02-11 18:36

this log message was in the main trunk, so if someone is adding plugin settings doc to xbmcplugin.cpp, you will have to go thru that repo too. i usually added an example.

Quote:
added: new plugin/scraper setting type "action", it allows you to execute a builtin from settings.

"option" may be set to "close" to close the settings dialog when you click the setting.

e.g. <setting type="action" label="30090" option="close" default="RunPlugin(plugin://video/Apple Movie Trailers Plugin/?update=newest)" />



- Temhil - 2009-04-01 04:12

I just discover settings.xml in plugins (I know I am more a script guy and so still a newbie with plugins), and would like to say good job, it is very nice and useful to have this feature.
I was wondering is there (or will be) something similar for scripts?
Thanks!


- BigBellyBilly - 2009-04-01 10:46

Has been discussed already http://forum.xbmc.org/showthread.php?tid=45394

Currently on Nuka's TODO list when he has time.


- Temhil - 2009-04-01 14:14

BigBellyBilly Wrote:Has been discussed already http://forum.xbmc.org/showthread.php?tid=45394

Currently on Nuka's TODO list when he has time.
Thanks for the update BigBellyBilly.


- digitaldesaster - 2009-08-30 11:03

Hi,

nice function. its working in the menu.. so i am able to edit and save my settings. I tried
to use it for my own script..

the only problem: i can't access the setting from my script.

my settings.xml under scripts/myscript/resources


PHP Code:
<settings>
   <
setting id="language" type="enum" label="30000" values="german|english|any" default="german"/>
   <
setting id="choose" type="bool" label="30001" default="false"/>
   <
setting id="resmax" type="enum" label="30002" values="1920|1280|640|480|320|160" default="480"/>
   <
setting id="resmin" type="enum" label="30003" values="1920|1280|640|480|320|160" default="480"/>  
</
settings

settings.xml after edit under userdata/script_data/myscript/
PHP Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<settings>
    <setting id="language" value="0" />
    <setting id="choose" value="false" />
    <setting id="resmax" value="3" />
    <setting id="resmin" value="3" />
</settings> 

my imports...
import xbmc, xbmcgui,xbmcplugin,sys


xbmcplugin.openSettings(sys.argv[0])

language = xbmcplugin.getSetting('language')
choose = xbmcplugin.getSetting('choose')
resmax = xbmcplugin.getSetting('resmax')
resmin = xbmcplugin.getSetting('resmin')

XBMC.log = No settings.xml file could be found!

Whats wrong, please help!

thanks
dd


- digitaldesaster - 2009-08-30 17:39

tested it with a plugin version of my script and it works.. so it doesn't work genreally for scripts??