GraphicalChoiceWidget

Inheritance diagram of GraphicalChoiceWidget
class GraphicalChoiceWidget(parent=None, designMode=False, choices=None, pixmaps=None, iconSize=128, defaultPixmap=None, horizontalScrollBarPolicy=0, verticalScrollBarPolicy=0)[source]

Bases: PyQt5.QtWidgets.QScrollArea

A widget that presents a 2D grid of buttons

choiceMade
getChosen()[source]

returns the choice :rtype: str :return:

classmethod getQtDesignerPluginInfo()[source]

Returns pertinent information in order to be able to build a valid QtDesigner widget plugin

The dictionary returned by this method should contain at least the following keys and values: - ‘module’ : a string representing the full python module name (ex.: ‘taurus.qt.qtgui.base’) - ‘icon’ : a string representing valid resource icon (ex.: ‘designer:combobox.png’) - ‘container’ : a bool telling if this widget is a container widget or not.

This default implementation returns the following dictionary:

{ 'group'     : 'Taurus Widgets',
  'icon'      : 'logos:taurus.png',
  'container' : False }
Return type

dict

Returns

a map with pertinent designer information

onClick()[source]

slot called when a button is clicked

setChoice(row, col, text, pixmap=None, tooltip=None)[source]

sets the option for a given row,column coordinate in the grid

Parameters
  • row (int) – row in the grid for this option

  • col (int) – column in the grid for this option

  • text (str) – name for this option

  • pixmap (QPixmap or None) – If no valid pixmap is provided for a given choice, the default one will be used

  • tooltip (str) – tooltip for this option (if None given, the text is used)

setChoices(choices, pixmaps=None)[source]

sets the available options

Parameters
  • choices (list <list>) – a list of lists of strings to be used as choices names. The (possibly sparse) 2D array defined by the nested lists will be used to present the choices in a grid. The choice names will be used as keys for pixmaps

  • pixmaps (dict <str, QPixmap>) – dictionary mapping the choices text to corresponding pixmap. If no valid pixmap is provided for a given choice, a default pixmap will be used