Radio

class compas_view2.ui.Radio(app, parent, *, title, items, action)[source]

Bases: object

Class representing a radio button group wrapped in a group box.

Parameters:
  • app (compas_view2.app.App) – The app containing the widget.

  • parent (QtWidgets.QWidget) – The parent widget for the radio button group.

  • title (str) – The label for the radio button group.

  • items (list[dict[str, Any]]) – A list of radio button group items, with each item defined as a dict with a particular structure. See Notes for more info.

  • action (callable) – The action associated with the radio button group.

Attributes:
  • radio (QtWidgets.QButtonGroup) – The button group containing the exclusive radio items.

  • action (callable) – The action associated with the click event of the radio button group.

  • values (dict[QtWidgets.QRadioButton, Any]) – Mapping between radio buttons and their values.

Notes

Every item dict should have the following structure.

item['text']     # str  : The text label of the item.
item['value']    # Any  : The value of the item, if different from the item text.
item['checked']  # bool : If True, the item should be marked as checked.