Multiple dynamic setting dialogs
#1
Some comments on a good way to write dynamic settings inside a addon without hardcoding a skin xml file? The settings would be for multiple invidual modules within a addon, so the addon built-in addons settings can not be used here, but should work exactly like the addon settings.
Reply
#2
I'll try to explain what I really want here.
I have experimentet with some addons that manages multiple subprocesses/plugins. This was for example a chat client with code for handling each chat "protocol". These all need individual settings for the connection etc. and also settings for each account on that protocol. Another example I stumbled on this challenge was with a game library/launcher thingy I played araound with. I had an idea to manage launchers and scrapers as plugins, and then each of them needed settings and a dialog against the user.

I see a couple of solution, but none of them is very good.

* Add them to the addons settings under a category reflecting the plugin
In this case you need to alter the main addon when adding/modifying the plugins and you are limited to one profile per plugin

* Create a skin xml file with default controls that's fetched from script via a pre-know ID's, then copied for each setting where type are connected to a ID.
The problem here is that the python is very limited in managing this kind of stuff against XBMC, so my solution got limited and ugly.

One could also build the whole dialog from the script I guess, but that's a no go in my opinion.

What I really wish is a more flexible solution of the addon setting dialog where one could pass a setting file and title to manage more than one setting file under a addon. But for now I can settle with a good solution.

I think addon development for XBMC would be much faster and more fun with some more easy to use GUI components. If atleast the most used components was defined in the skin, it would make it easy to make addons that looks good.
Reply
#3
How about a python file that builds a string with string format characters builtin, then just format the relevent values in at runtime. So you have mysettings.py with:
PHP Code:
def get_settings():
    
settings  ='<settings><category label="Meta Data">'
    
settings +='<setting id="%s" type="bool" label="30600" default="%s" />'
    
settings +='</category></settings>'
    
return settings 

Then at run-time you could use something like:
PHP Code:
import mysettings

settings 
mysettings.get_settings()
settings settings %(id,default) 

Then just have each module implements a get_settings() method
Reply
#4
Bstrdsmkr: Would work if you could pass a setting file to XBMC from the addon, else you would have to write the file to the addon directory where you might not have write access or atleast should avoid writing to.
Reply
#5
Just write it to the profile folder and call it from within your main settings. Works pretty well for URLResolver: https://github.com/Eldorados/script.modu..._init__.py
Reply

Logout Mark Read Team Forum Stats Members Help
Multiple dynamic setting dialogs0