2005-05-04, 08:22
i have uploaded my first version of settingsmgr.py to http://www.xbmcscripts.com . you can use it if you want to add a control panel so that users can customize your script settings.
it works like this:
settings.xml looks like this:
note, i'm aware of the "name: xxx" bug in v0.1. it is purely visual and will be fixed in the nest version.
please let me know if you find it useful.
it works like this:
Quote:fname=scriptpath+'settings.xml'
settings=settingsmgr.readsettings(fname)
timeout=settings['timeout'] #the dictionary key is the id of the param tag.
print('timeout:'+str(timeout))
settingsmgr.opencontrolpanel(fname) #here a window is opened and the user can change settings.
settings.xml looks like this:
Quote:<?xml version="1.0" ?>
<settings name="ooba settings...">
<settings name="connection">
<param id="hostadress" name="host address" type="string">
<value><![cdata[monkey.com]]></value>
</param>
<param id="secure" name="secure" type="boolean">
<value>false</value>
</param>
<param id="timeout" name="timeout" type="float">
<value>7.0</value>
<desc>socket timeout (seconds)</desc>
</param>
<param id="mode" name="mode" type="select">
<option>server</option>
<option>client</option>
<option>server+client</option>
<value>1</value>
</param>
</settings>
<param id="phase" name="phaseangle" type="select">
<option>0 degrees</option>
<option>90 degrees</option>
<option>180 degrees</option>
<option>-90 degrees</option>
<value>3</value>
</param>
</settings>
note, i'm aware of the "name: xxx" bug in v0.1. it is purely visual and will be fixed in the nest version.
please let me know if you find it useful.