Class ComboRadioSelector
PyQt4.QtGui.QWidget --+
|
ComboRadioSelector
This is compound widget for selecting categorized choices. The
categories are presented in a combo box, and the choices are shown below
as a set of radio buttons that is dynamically generated every time the
category is changed.
When a category is selected, the previous choice for that category is
remembered and re-selected.
The choiceChanged signal is emitted any time the current choice is
changed. This includes when the category combo is changed by the user and
when the current choice is changed programmatically via the
setCurrentChoice() method.
|
__init__(self,
category_dict,
parent=None)
Initializes the widget with source data. |
|
|
|
setData(self,
category_dict)
Set the source data for this widget. |
|
|
|
onCategoryChanged(self,
index)
Responds to changes in the combobox selection by updating radio
buttons with the choices for the selected category. |
|
|
|
currentChoice(self)
Returns the currently selected choice as a string. |
|
|
|
setCurrentChoice(self,
choice)
Sets the currently selected choice, changing the category if
necessary. |
|
|
|
currentCategory(self)
Returns the currently selected category. |
|
|
|
choiceChanged = QtCore.pyqtSignal()
|
__init__(self,
category_dict,
parent=None)
(Constructor)
|
|
Initializes the widget with source data.
- Parameters:
category_dict (dict of str mapped to list of str) - a dictionary mapping category name to a list of strings
representing all the choices for that category. To specify an
ordering for categories in the combobox, use an OrderedDict.
|
setData(self,
category_dict)
|
|
Set the source data for this widget. See the constructor documentation
for details on the category_dict argument.
|
onCategoryChanged(self,
index)
|
|
Responds to changes in the combobox selection by updating radio
buttons with the choices for the selected category.
- Parameters:
index (int) - index of selected category in combobox.
|
setCurrentChoice(self,
choice)
|
|
Sets the currently selected choice, changing the category if
necessary. If a choice appears in more than one category, the first
occurrence will be selected.
- Parameters:
choice (str) - the choice to be selected
|