opensourcejason.info
deskbar applet configurator

Creating configuration dialogs for Deskbar Applets is a little bit messier than it really needs to be. So, I've started an API that allows for easy Configuration creation.

#Must be called after HANDLERS is defined
myconfig=Configurator(HANDLERS)
item={ 'type' : 'string',
       'name' : 'username',
       'desc' : 'Enter your username',
       'default' : '',
       'required' : 'You must configure a username for this handler' }
myconfig.add_config_item(**item)

Then later, in your Handler or Match code you can retreive the value using:

myconfig.get_value('username')

Here's an example showing how the configurator can be used. This basic example allows you to configure your name, and will greet you in the query results list.

Much cleaner!


Add Comment 
Sign as Author 
Enter code 754