1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
.. currentmodule:: Orange.widgets.gui
###################################
Library of Common GUI Controls
###################################
:obj:`gui` is a library of functions which allow constructing a control (like
check box, line edit or a combo), inserting it into the parent's layout,
setting tooltips, callbacks and so forth, establishing synchronization with a
Python object's attribute (including saving and retrieving when the widgets is
closed and reopened) ... in a single call.
Almost all functions need three arguments:
* the `widget` into which the control is inserted,
* the `master` widget with one whose attributes the control's value is
synchronized,
* the name of that attribute (`value`).
All other arguments should be given as keyword arguments for clarity and also
for allowing the potential future compatibility-breaking changes in the module.
Several arguments that are common to all functions must always be given as
keyword arguments.
**************
Common options
**************
All controls accept the following arguments that can only be given as
keyword arguments.
:tooltip:
A string for a tooltip that appears when mouse is over the control.
:disabled:
Tells whether the control be disabled upon the initialization.
:addSpace:
Gives the amount of space that is inserted after the control (or the box
that encloses it). If `True`, a space of 8 pixels is inserted. Default is
0.
:addToLayout:
The control is added to the parent's layout unless this flag is set to
`False`.
:stretch:
The stretch factor for this widget, used when adding to the layout.
Default is 0.
:sizePolicy:
The size policy for the box or the control.
****************
Common Arguments
****************
Many functions share common arguments.
:widget:
Widget on which control will be drawn.
:master:
Object which includes the attribute that is used to store the control's
value; most often the `self` of the widget into which the control is
inserted.
:value:
String with the name of the master's attribute that synchronizes with the
the control's value..
:box:
Indicates if there should be a box that around the control. If :obj:`box`
is `False` (default), no box is drawn; if it is a string, it is also used
as the label for the box's name; if :obj:`box` is any other true value
(such as :obj:`True` :), an unlabeled box is drawn.
:callback:
A function that is called when the state of the control is changed. This
can be a single function or a list of functions that will be called in the
given order. The callback function should not change the value of the
controlled attribute (the one given as the :obj:`value` argument described
above) to avoid a cycle (a workaround is shown in the description of
:obj:`listBox` function.
:label:
A string that is displayed as control's label.
:labelWidth:
The width of the label. This is useful for aligning the controls.
:orientation:
When the label is given used, this argument determines the relative
placement of the label and the control. Label can be above the control,
(`"vertical"` or `True` - this is the default) or in the same line with
control, (`"horizontal"` or `False`). Orientation can also be an instance
of :obj:`~PyQt4.QtGui.QLayout`.
**********
Properties
**********
PyQt support settings of properties using keyword arguments. Functions in this
module mimic this functionality. For instance, calling
cb = gui.comboBox(..., editable=True)
has the same effect as
cb = gui.comboBox(...)
cb.setEditable(True)
Any properties that have the corresponding setter in the underlying Qt control
can be set by using keyword arguments.
*****************
Common Attributes
*****************
:box:
If the constructed widget is enclosed into a box, the attribute `box`
refers to the box.
*******
Widgets
*******
This section describes the wrappers for controls like check boxes, buttons
and similar. Using them is preferred over calling Qt directly, for convenience,
readability, ease of porting to newer versions of Qt and, in particular,
because they set up a lot of things that happen in behind.
.. autofunction:: checkBox
.. autofunction:: lineEdit
.. autofunction:: listBox
.. autofunction:: comboBox
.. autofunction:: radioButtonsInBox
.. autofunction:: appendRadioButton
.. autofunction:: spin
.. autofunction:: doubleSpin
.. autofunction:: hSlider
.. autofunction:: button
.. autofunction:: toolButton
.. autofunction:: widgetLabel
.. autofunction:: label
*************
Other widgets
*************
.. autofunction:: widgetBox
.. autofunction:: indentedBox
.. autofunction:: separator
.. autofunction:: rubber
*****************
Utility functions
*****************
.. autodata:: attributeIconDict
.. autofunction:: attributeItem
******************************
Internal functions and classes
******************************
This part of documentation describes some classes and functions that are used
internally. The classes will likely maintain compatibility in the future,
while the functions may be changed.
Wrappers for Python classes
===========================
.. autoclass:: ControlledList
Other functions
===============
.. autofunction:: miscellanea
.. autofunction:: setLayout
.. autofunction:: createAttributePixmap
|