| |
- gtk.Button(gtk.Bin)
-
- ColourButton
- FontButton
- gtk.Dialog(gtk.Window)
-
- OptionsBox
class OptionsBox(gtk.Dialog) |
|
OptionsBox can be sub-classed to provide your own widgets, by
creating extra build_* functions. Each build funtion takes a DOM
Element from the <app_dir>/Options.xml file and returns a list of
GtkWidgets to add to the box. The function should be named after
the element (<foo> -> def build_foo()).
When creating the widget, self.handlers[option] should be set to
a pair of functions (get, set) called to get and set the value
shown in the widget.
When the widget is modified, call check_widget(option) to
update the stored values. |
|
Methods defined here:
- __init__(self, options_group, options_xml)
- options_xml is an XML file, usually <app_dir>/Options.xml,
which defines the layout of the OptionsBox.
It contains an <options> root element containing (nested)
<section> elements. Each <section> contains a number of widgets,
some of which correspond to options. The build_* functions are
used to create them.
Example:
<?xml version='1.0'?>
<options>
<section title='First section'>
<label>Here are some options</label>
<entry name='default_name' label='Default file name'>
When saving an untitled file, use this name as the default.
</entry>
<section title='Nested section'>
...
</section>
</section>
</options>
- build_colour(self, node, label, option)
- <colour name='...' label='...'>Tooltip</colour>
- build_entry(self, node, label, option)
- <entry name='...' label='...'>Tooltip</entry>
- build_font(self, node, label, option)
- <font name='...' label='...'>Tooltip</font>
- build_frame(self, node, label)
- <frame label='Title'>...</frame> to group options under a heading.
- build_hbox(self, node, label)
- <hbox>...</hbox> to layout child widgets horizontally.
- build_label(self, node, label)
- <label>Text</label>
- build_numentry(self, node, label, option)
- <numentry name='...' label='...' min='0' max='100' step='1'>Tooltip</numentry>.
Lets the user choose a number from min to max.
- build_radio_group(self, node, label, option)
- Build a list of radio buttons, only one of which may be selected.
<radio-group name='...'>
<radio value='...' label='...'>Tooltip</radio>
<radio value='...' label='...'>Tooltip</radio>
</radio-group>
- build_section(self, section, parent)
- Create a new page for the notebook and a new entry in the
sections tree, and build all the widgets inside the page.
- build_spacer(self, node, label)
- <spacer/>
- build_toggle(self, node, label, option)
- <toggle name='...' label='...'>Tooltip</toggle>
- build_vbox(self, node, label)
- <vbox>...</vbox> to layout child widgets vertically.
- build_widget(self, node, box)
- Dispatches the job of dealing with a DOM Node to the
appropriate build_* function.
- build_window_frame(self)
- Create the main structure of the window.
- changed(self)
- Check whether any options have different values (ie, whether Revert
will do anything).
- check_widget(self, option)
- A widgets call this when the user changes its value.
- do_box(self, node, label, widget)
- Helper function for building hbox, vbox and frame widgets.
- may_add_tip(self, widget, node)
- If 'node' contains any text, use that as the tip for 'widget'.
- open(self)
- Show the window, updating all the widgets at the same
time. Use this instead of show().
- update_revert(self)
- Shade/unshade the Revert button. Internal.
- update_widgets(self)
- Make widgets show current values. Internal.
| |