HOW-TO write GUI settings for XBMC python plugins and scripts (addons)

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
hani Offline
Junior Member
Posts: 35
Joined: May 2007
Reputation: 0
Thumbs Up   
Post: #16
Nuka1195 Wrote:There is now a "visible" attribute, works like the "enable" attribute.

Plugins now have localized strings also, same file as plugin settings.

Remember plugins/plugin settings id numbers are 30000-30999.

Wow! Xmas came so early.Thank you guys for the great work.
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #17
Quote:
changed: added "fileenum" plugin setting type with optional "mask". this setting is filled automatically based on the mask and path you set with the "values" attribute. the path is based on your plugins current directory. Use / for your mask to return only folders
eg <setting id="scraper" type="fileenum" mask="/" values="showtimesAPI\scrapers\" label="30510" default="Google" />

Thanks JMarshall and d4rk for your help

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
doze Offline
Junior Member
Posts: 26
Joined: Aug 2004
Reputation: 0
Post: #18
Is there any type to use in plugin settings to input password? I mean that the text would then be displayed as stars or dots or something?

And is there any page in Wiki yet for general info on plugin development?
find quote
doze Offline
Junior Member
Posts: 26
Joined: Aug 2004
Reputation: 0
Post: #19
Hello, anyone?

Also while I'm on the subject, where can I see that what attributes and their values are available for the plugin settings xml for example?

And when I'm creating xbmcgui.ListItem in my plugin and using the setInfo() to set the "attributes" of the video list item, where I can see that in what format should the size and duration and date be, for example?

I cannot seem to find any documentation about plugin development, other than this and that doesn't cover much. I can look from the source too, but I don't know where to look for example when I want to see what's possible to use in plugin settings xml or in what format should the date be when setting it to xbmcgui.ListItem.

Please, help Big Grin
find quote
adityaag Offline
Junior Member
Posts: 31
Joined: Dec 2008
Reputation: 0
Post: #20
I was wondering if there's any place to get more detail on how the enable attribute works? I've tried enable="1" and enable="true" flat out and the option is still disabled. Leaving it out enables it again.

Basically I want a setting to be enabled only if the bool setting above it is true. I played around with some of the eq functions without much avail. Help would be much appreciated.
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #21
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 |

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
BigBellyBilly Offline
Skilled Python Coder
Posts: 900
Joined: Feb 2005
Reputation: 2
Location: UK
Post: #22
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

My Addons (myTV, T3CH Upgrader, DVDProfiler, BBCPodRadio, Comics, Football, GoogleReader, reeplay.it, Metacritic, Phonebin, FileViewer,SVN Repo Installer (contributor)) available at Box.net
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #23
yes type="action"

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
BigBellyBilly Offline
Skilled Python Coder
Posts: 900
Joined: Feb 2005
Reputation: 2
Location: UK
Post: #24
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 ?

My Addons (myTV, T3CH Upgrader, DVDProfiler, BBCPodRadio, Comics, Football, GoogleReader, reeplay.it, Metacritic, Phonebin, FileViewer,SVN Repo Installer (contributor)) available at Box.net
find quote
Nuka1195 Offline
Skilled Python Coder
Posts: 3,910
Joined: Dec 2004
Reputation: 18
Post: #25
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)" />

For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
find quote
Temhil Offline
Skilled Python Coder
Posts: 397
Joined: Apr 2008
Reputation: 1
Location: Canada
Post: #26
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!

[Image: passionxbmc_signature.png]
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

[Image: project_thin_badge.gif]
find quote
BigBellyBilly Offline
Skilled Python Coder
Posts: 900
Joined: Feb 2005
Reputation: 2
Location: UK
Post: #27
Has been discussed already http://forum.xbmc.org/showthread.php?tid=45394

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

My Addons (myTV, T3CH Upgrader, DVDProfiler, BBCPodRadio, Comics, Football, GoogleReader, reeplay.it, Metacritic, Phonebin, FileViewer,SVN Repo Installer (contributor)) available at Box.net
find quote
Temhil Offline
Skilled Python Coder
Posts: 397
Joined: Apr 2008
Reputation: 1
Location: Canada
Post: #28
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.

[Image: passionxbmc_signature.png]
_____________________________

Repositories Installer: select and install unofficial repositories / TAC.TV: watch videos on TAC.TV
Installer Passion-XBMC: Download and Install Add-ons (pre-Dharma only)

[Image: project_thin_badge.gif]
find quote
digitaldesaster Offline
Junior Member
Posts: 33
Joined: Aug 2009
Reputation: 0
Post: #29
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
find quote
digitaldesaster Offline
Junior Member
Posts: 33
Joined: Aug 2009
Reputation: 0
Post: #30
tested it with a plugin version of my script and it works.. so it doesn't work genreally for scripts??
find quote
Post Reply