Python: module rox.options

rox.options | index

`To use the Options system:
1. Create an OptionGroup:
options = OptionGroup('MyProg', 'Options')
You can also use the handy rox.setup_app_options() in most applications.
2. Create the options:
colour = Option('colour', 'red', options)
size = Option('size', 3, options)
icons = ListOption('icons', ('circle', 'square', 'triangle'), options)
3. Register any callbacks (notification of options changing):
def my_callback():
if colour.has_changed:
print "The colour is now", colour.value
options.add_notify(my_callback)
4. Notify any changes from defaults:
options.notify()
See OptionsBox for editing options. Do not change the value of options
yourself.`

Classes
`` |  | Option ListOption OptionGroup
class ListOption(Option)
`` | `A ListOption stores a list of values. Every option is part of exactly one OptionGroup. The read-only attribute list_value can be used to get the current setting for the ListOption. value will be str(list_value) and int_value wille be -1. The has_changed attribute is used during notify() calls to indicate whether this ListOption's value has changed since the last notify (or option creation). You may set has_changed = 1 right after creating an option if you want to force notification the first time even if the default is used.`
| Methods defined here: __init__(self, name, value, group=None)
class Option
`` | `An Option stores a single value. Every option is part of exactly one OptionGroup. The read-only attributes value and int_value can be used to get the current setting for the Option. int_value will be -1 if the value is not a valid integer. The has_changed attribute is used during notify() calls to indicate whether this Option's value has changed since the last notify (or option creation). You may set has_changed = 1 right after creating an option if you want to force notification the first time even if the default is used.`
| Methods defined here: __init__(self, name, value, group=None) `Create a new option with this name and default value. Add to 'group', or to rox.app_options if no group is given. The value cannot be used until the first notify() call to the group.`
class OptionGroup
`` |
| Methods defined here: __init__(self, program, leaf, site=None) `program/leaf is a Choices pair for the saved options. If site is given, the basedir module is used for saving choices (the new system). Otherwise, the deprecated choices module is used.` add_notify(self, callback) `Call callback() after one or more options have changed value.` notify(self) `Call this after creating any new options or changing their values.` remove_notify(self, callback) `Remove a callback added with add_notify().` save(self) `Save all option values. Usually called by OptionsBox().`

Functions
`` |  | data(node) `Return all the text directly inside this DOM Node.`