HOW-TO write GUI settings for XBMC python plugins and scripts (addons) - Printable Version +- Kodi Community Forum (https://forum.kodi.tv) +-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32) +--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26) +--- Thread: HOW-TO write GUI settings for XBMC python plugins and scripts (addons) (/showthread.php?tid=29577) |
HOW-TO write GUI settings for XBMC python plugins and scripts (addons) - yuvalt - 2007-11-07 If you have written a plugin/script and you want to have GUI settings attached to it (by right-clicking on it and selecting "Plugin Settings/Script Settings"), do the following: 1. Under your plugin/script dir create a "resources" dir. 2. Create the file resources/settings.xml. An example of how such a file would look like for a Flickr plugin: Code: <settings> 3. As you can see the labels use a resource file. To create one for english (for example), create the file: resources/language/english/strings.xml. For example: Code: <strings> 4. The user edited plugin/script settings are stored at special://profile/ settings.xml. For example: Code: <settings> 5a. To get the settings values in the plugin do xbmcplugin.getSetting(id). For example: theKey = xbmcplugin.getSetting("api_key") 5a. To get the settings values in the script do xbmc.getSetting(id). For example: theKey = xbmc.getSetting("api_key") check the pydocs. Good luck! - asg - 2007-11-08 Thanks! This is a really neat "new?" feature .. but did you missed a svn commit or something? Theres no 'getSetting' in xbmcplugin yet Quote:'module' object has no attribute 'getSetting'Regards asg - yuvalt - 2007-11-08 Did you try it with the linuxport? - asg - 2007-11-08 No..tried with "normal" rev10688. Ive also checked out the linuxport, but i cant find any reference to getSettings in xbmcplugin. asg - Nuka1195 - 2007-11-08 I think we need more than luck - yuvalt - 2007-11-08 :-) You're right, my commit failed earlier and I did not notice. Please try again.. - Nuka1195 - 2007-11-08 they work great. one thing that should be mentioned is to get your bool or integer, do the following: Code: bool Now to backport it for the masses Edit: just wanted to say good job, this is really a nice feature. Online Manual Documentation - Gamester17 - 2007-11-08 WIKI updated? ...does the wiki even have a plugin/plugins section or article already? - Unbehagen - 2007-11-08 Thanks! This is awesome! - Nuka1195 - 2007-11-08 Ok, plugins settings has been backported to the main trunk, thanks yuvalt. - Nuka1195 - 2007-11-10 You may now use the browse dialog for a setting. (not merged in linux branch) You may also use separators now The following types are now valid: keyboard: "text" ip dialog "ipaddress" numeric dialog "integer" browse dialogs: "video", "music", "pictures", "folder", "programs", "files" radio button: "bool" spinners "enum" separator "sep" There are two new attributes "option", "source": eg. "option" can be "hidden" for type "text", this will hide the text, though it still displays in the dialog, so this needs looking at. eg. "source" is used for the browse dialog Code: <setting id="path" type="folder" source="video" label="30000" default="F:\videos" /> source can be:"video", "music", "pictures", "programs", "files", "local" or blank. if source is blank it will use the type for shares if it is a valid share if not a valid share it will use, both local and network drives. Code: [SIZE=2][SIZE=2]<?xml version="1.0" encoding="utf-8" standalone="yes"?>[/SIZE] - asg - 2007-11-11 What do you guys think about adding a settings dialog to "normal" scripts? - Nuka1195 - 2007-11-15 Quote:[SIZE=1] Some additions [/SIZE] - hani - 2007-11-27 It would be nice if we have conditional visibility. I think Its more useful than the enable option. I have many settings in my plugin and they only need to be visible if the user select one option. I guess I could do that in the plugin itself. I will try to submit a batch if you guys accept the idea.:confused2: - Nuka1195 - 2007-12-04 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. |