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

+- Kodi Community Forum (http://forum.kodi.tv)
+-- 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


- Dan Dare - 2009-08-31 10:43

@digitaldesaster
The first post says it pretty clearly, this is for plugins, not scripts.


- digitaldesaster - 2009-08-31 10:49

In Germany whe say: "Wer lesen kann ist klar im Vorteil". sorry..

cya
dd


- f3ar007 - 2009-11-14 06:56

Hi, I'm trying to use the "enum" plugin setting; however, it reads the place in "enum" line, for instance:

The settings.xml:
Code:
<settings>
    <setting id="username" type="text" label="Username:" default="enter user"/>
    <setting id="password" type="text" label="Password:" default="enter pass"/>
    <setting id="archiveMonth" type="enum" label="Month:" values="01|02|03|04|05|06|07|08|09|10|11|12" default="01"/>
    <setting id="archiveDay" type="enum" label="Day:" values="01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27​|28|29|30|31" default="01"/>
    <setting id="archiveYear" type="enum" label="Year:" values="2009|2010" default="2009"/>
</settings>

The python code:
Code:
archiveMonth = xbmcplugin.getSetting('archiveMonth')
archiveDay = xbmcplugin.getSetting('archiveDay')
archiveYear = xbmcplugin.getSetting('archiveYear')
archiveDate = '/' + str(archiveMonth) + '-' + str(archiveDay) + '-' + str(archiveYear) + '/'
str(archiveDate)

If 11-13-2009 is selected, the returned value *should* be /11-13-2009/; instead, it returns /10-12-0/ or very similar. **The number in line, beginning at zero. Is there a way to get the actual value from the "enum" setting, instead of its ordinal value?


- jmarshall - 2009-11-14 07:17

I believe that's what the enum does - it returns the index rather than the value. If you want the value you should know it anyway, right (after all, you supplied the values). For consecutive numbers with a min and a max you can probably do it without the enum at all, right? The enum stuff is designed for non-consecutive numbers.

Cheers,
Jonathan


- f3ar007 - 2009-11-14 07:21

Well, I am trying to create a sort of calendar like select. (Should be obvious by the example. Laugh) Although, I'm not sure how I could accomplish this without the "enum" option. Is there a better way?

This is a feature request for one of my plugins. The users mentioned entering dates was a long process, this will hopefully speed it up! Cool

## Figured this one out...

Just checked the length of the "enum" index and returned a zero in front of single digits or nothing in front of double digits.
Checked the year against a string.


- Nuka1195 - 2009-12-01 16:18

<setting id="archiveDay" type="labelenum"


- VictorV - 2009-12-18 18:32

Would it be possible to create a slider option? With min, max and step size?


- spiff - 2009-12-18 18:39

possible, yes, available, no.


- Nuka1195 - 2009-12-18 19:14

i already submitted a ticket for this along time ago. among others.

spiff or anybody check out that settings cleanup ticket. a comment would have been nice.


Drive sselection - D0nR0s4 - 2009-12-27 05:36

Hi, just saw the possibility for the settings.xml and it works like a charm. Only thing that I would like/need for my script, is the possibility to select a hard or cd/dvd drive.
I mainly need the letter(on Windows) of the dvd drive from which I get the state with "getDVDState". I didn't find anything about this so I thought I could use a settings entry but I found no chance to select the dvd drive with the folder or file setting types.

I hope someone can help me,
Greetings,
D0nR0sa

Edit: Sorry, problem was an error in xbmc that prevented me from accessing the dvd drive


- Spaggi - 2010-07-25 19:43

I can't use the settings type "Files". If I use it like this:

Quote: <setting id="Files01" type="files" label="30012" default="" />

It won't show up in the settings menu...what am I doing wrong?


- Nuka1195 - 2010-07-25 20:21

type="file"


- Spaggi - 2010-07-25 20:46

Works, thanks alot!

Another issue: When I use fileenum, I cannot find .m3u playlist files. Txt files work well.


- solexalex - 2010-07-28 17:44

Hello !
three questions :

1 - Any new infos where we can get help on all available settings, how they works, what are the options and their possible values... ?


2 - It looks like bool setting can't get the option 'visible' ... Why ?

3 - I used the setting type 'action' but the default value, which is the command line (RunPlugin(....) ) is showing next to the label. Any way to hide it ?

(I'm using XBMC 9.11 r26017)


- Nuka1195 - 2010-07-28 18:08

1. in guidialogaddonsettings.cpp (i think)
2. it should, maybe a bug
3. put the action in action="RunScript()" leave default blank. default=""