@@ -9,16 +9,81 @@ to a Traits interface, so that you can use them in a cross-toolkit manner.
99
1010Where possible, these classes share a common API for the same functionality.
1111In particular, all classes have a
12- :py:attr: `~pyface.fields.i_field.IField.value ` trait which holds the (usually
13- user-editable) value displayed in the field. Code using the field can listen
14- to changes in this trait to react to the user entering a new value for the
15- field without needing to know anything about the underlying toolkit event
16- signalling mechanisms.
12+ :py:attr: `~pyface.fields.i_field.IField.value ` trait which holds the value
13+ displayed in the field.
1714
18- All fields also provide a trait for setting the
19- :py:attr: `~pyface.fields.i_field.IField.context_menu ` of the field. Context
20- menus should be :py:class: `~pyface.action.menu_manager.MenuManager `
21- instances.
15+ Fields where the value is user-editable rather than simply displayed implement
16+ the :py:attr: `~pyface.fields.i_editable_field.IEditableField ` interface. Code
17+ using the field can listen to changes in the value trait to react to the user
18+ entering a new value for the field without needing to know anything about the
19+ underlying toolkit event signalling mechanisms.
20+
21+ Fields inherit from :py:class: `~pyface.i_widget.IWidget ` and
22+ :py:class: `~pyface.i_layout_item.ILayoutItem ` which have a number of
23+ additional traits with useful features:
24+
25+ :py:attr: `~pyface.i_widget.IWidget.tooltip `
26+ A tooltip for the widget, which should hold string.
27+
28+ :py:attr: `~pyface.i_widget.IWidget.context_menu `
29+ A context menu for the widget, which should hold an
30+ :py:class: `~pyface.action.i_menu_manager.IMenuManager ` instance.
31+
32+ :py:attr: `~pyface.i_layout_item.ILayoutItem.minimum_size `
33+ A tuple holding the minimum size of a layout widget.
34+
35+ :py:attr: `~pyface.i_layout_item.ILayoutItem.maximum_size `
36+ A tuple holding the minimum size of a layout widget.
37+
38+ :py:attr: `~pyface.i_layout_item.ILayoutItem.stretch `
39+ A tuple holding information about the distribution of addtional space into
40+ the widget when growing in a layout. Higher numbers mean proportinally
41+ more space.
42+
43+ :py:attr: `~pyface.i_layout_item.ILayoutItem.size_policy `
44+ A tuple holding information about how the widget can grow and shrink.
45+
46+ :py:attr: `~pyface.fields.i_field.IField.alignment `
47+ A value holding the horizontal alignment of the contents of the field.
48+
49+ ComboField
50+ ==========
51+
52+ The :py:class: `~pyface.fields.i_combo_field.IComboField ` interface has an arbitrary
53+ :py:attr: `~pyface.fields.i_combo_field.IComboField.value ` that must come from a list
54+ of valid :py:attr: `~pyface.fields.i_combo_field.IComboField.values `. For non-text
55+ values, a :py:attr: `~pyface.fields.i_combo_field.IComboField.formatter ` function
56+ should be provided, defaulting to :py:func: `str `.
57+
58+ LabelField
59+ ==========
60+
61+ The :py:class: `~pyface.fields.i_label_field.ILabelField ` interface has a string
62+ for the :py:attr: `~pyface.fields.i_label_field.ILabelField.value ` which is not
63+ user-editable.
64+
65+ In the Qt backend they can have an image for an
66+ :py:attr: `~pyface.fields.i_label_field.ILabelField.icon `.
67+
68+ ImageField
69+ ==========
70+
71+ The :py:class: `~pyface.fields.i_image_field.IImageField ` interface has an
72+ :py:class: `~pyface.i_image.IImage ` for its
73+ :py:attr: `~pyface.fields.i_image_field.IImageField.value ` which is not
74+ user-editable.
75+
76+ SpinField
77+ =========
78+
79+ The :py:class: `~pyface.fields.i_spin_field.ISpinField ` interface has an integer
80+ for the :py:attr: `~pyface.fields.i_spin_field.ISpinField.value `, and also
81+ requires a range to be set, either via setting the min/max values as a tuple to
82+ the :py:attr: `~pyface.fields.i_spin_field.ISpinField.bounds ` trait, or by setting
83+ values individually to :py:attr: `~pyface.fields.i_spin_field.ISpinField.minimum `
84+ and :py:attr: `~pyface.fields.i_spin_field.ISpinField.maximum `. The
85+ :py:attr: `~pyface.fields.i_spin_field.ISpinField.wrap ` trait determines whether
86+ the spinner wraps around at the extreme values.
2287
2388TextField
2489=========
@@ -41,26 +106,6 @@ the Qt backend has a number of other options as well). The text field can be
41106set to read-only mode via the
42107:py:attr: `~pyface.fields.i_text_field.ITextField.read_only ` trait.
43108
44- SpinField
45- =========
46-
47- The :py:class: `~pyface.fields.i_spin_field.ISpinField ` interface has an integer
48- for the :py:attr: `~pyface.fields.i_spin_field.ISpinField.value `, and also
49- requires a range to be set, either via setting the min/max values as a tuple to
50- the :py:attr: `~pyface.fields.i_spin_field.ISpinField.range ` trait, or by setting
51- values individually to :py:attr: `~pyface.fields.i_spin_field.ISpinField.minimum `
52- and :py:attr: `~pyface.fields.i_spin_field.ISpinField.maximum `.
53-
54- ComboField
55- ==========
56-
57- The :py:class: `~pyface.fields.i_combo_field.IComboField ` interface has an arbitrary
58- :py:attr: `~pyface.fields.i_combo_field.IComboField.value ` that must come from a list
59- of valid :py:attr: `~pyface.fields.i_combo_field.IComboField.values `. For non-text
60- values, a :py:attr: `~pyface.fields.i_combo_field.IComboField.formatter ` function
61- should be provided - this defaults to either :py:func: `str ` (Python 3+) or
62- :py:func: `unicode ` (Python 2).
63-
64109TimeField
65110==========
66111
0 commit comments