TaurusLabel

Inheritance diagram of TaurusLabel
class TaurusLabel(parent=None, designMode=False)[source]

Import from taurus.qt.qtgui.display as:

from taurus.qt.qtgui.display import TaurusLabel
DefaultAlignment = <PyQt5.QtCore.Qt.Alignment object>
DefaultAutoTrim = True
DefaultBgRole = 'quality'
DefaultFgRole = 'rvalue'
DefaultModelIndex = None
DefaultPrefix = ''
DefaultShowText = True
DefaultSuffix = ''
autoTrim

Specifies wether the text will be trimmed when it doesn’t fit in the available space

Access functions:

bgRole

This property holds the background role. Valid values are ‘’/’None’, ‘quality’, ‘state’

Access functions:

controller()[source]
controllerUpdate()[source]
displayValue(v)[source]

Reimplementation of displayValue for TaurusLabel

dragEnabled

Specifies whether the user can drag data from this widget

Access functions:

  • TaurusLabel.isDragEnabled()

  • TaurusLabel.setDragEnabled()

  • TaurusLabel.resetDragEnabled()

fgRole

This property holds the foreground role (the text). Valid values are:

  1. ‘’/’None’ - no value is displayed

  2. ‘rvalue’ - the value is displayed

  3. ‘wvalue’ - the write value is displayed

  4. ‘quality’ - the quality is displayed

  5. ‘state’ - the device state is displayed

Access functions:

getAutoTrim()[source]

Whether auto-trimming of the text is enabled.

Returns:

Return type:

bool

getBgRole()[source]
getFgRole()[source]

get the foreground role for this label (see setFgRole())

getModelIndex()[source]
getModelIndexValue()[source]

Called inside getDisplayValue to use with spectrum attributes. By default not used, but some widget might want to support this feature.

Note

getModelIndexValue() is only supported for the default model key

Override when needed.

getModelMimeData()[source]

Returns a MimeData object containing the model data. The default implementation fills the TAURUS_MODEL_MIME_TYPE. If the widget’s Model class is Attribute or Device, it also fills TAURUS_ATTR_MIME_TYPE or TAURUS_DEV_MIME_TYPE, respectively

Returns:

MimeData object containing the model data.

Return type:

QMimeData

getPermanentText()[source]
getPrefixText()[source]
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 [Unclassified]',
  'icon'      : 'logos:taurus.png',
  'container' : False }
Returns:

a map with pertinent designer information

Return type:

dict

getSuffixText()[source]
handleEvent(evt_src, evt_type, evt_value)[source]

very basic and generalistic handling of events.

Override when necessary.

Parameters:
  • evt_src (object or None) – object that triggered the event

  • evt_type (taurus.core.taurusbasetypes.TaurusEventType or None) – type of event

  • evt_value (object or None) – event value

hasDynamicTextInteractionFlags()[source]
isReadOnly()[source]

Determines if this component is read-only or not in the sense that the user can interact with it. Default implementation returns True.

Override when necessary.

Returns:

whether or not this component is read-only

Return type:

bool

model

This property holds the unique URI string representing the model name with which this widget will get its data from. The convention used for the string can be found here.

Access functions:

See also

Model concept

modelIndex

This property holds the index inside the model value that should be displayed

Access functions:

See also

Model concept

prefixText

This property holds a prefix text

Access functions:

resetAutoTrim()[source]

Reset auto-trimming to its default value

resetBgRole()[source]

Reset the background role to its default value

resetFgRole()[source]

Reset the foreground role to its default value

resetFormat()[source]

reimplement to update controller if format is changed

resetModelIndex()[source]
resetPrefixText()[source]
resetSuffixText()[source]
resetTextInteractionFlags()[source]
resizeEvent(self, a0: Optional[QResizeEvent])[source]
setAutoTrim(trim)[source]

Enable/disable auto-trimming of the text. If trim is True, the text in the label will be trimmed when it doesn’t fit in the available space

Parameters:

trim (bool)

setBgRole(bgRole)[source]

Set the background role. The label background will be set according to the current palette and the role. Valid roles are: - ‘none’ : no background - ‘state’ a color depending on the device state - ‘quality’ a color depending on the attribute quality - ‘rvalue’ a color depending on the rvalue of the attribute - <arbitrary member name> a color based on the value of an arbitrary member of the model object (warning: experimental feature!)

Warning

the <arbitrary member name> support is still experimental and its API may change in future versions

setDynamicTextInteractionFlags(flags)[source]
setFgRole(fgRole)[source]

Set what is shown as the foreground (the text) of the label Valid Roles are:

  • ‘rvalue’ the read value of the attribute

  • ‘wvalue’ the write value of the attribute

  • ‘none’ : no text

  • ‘quality’ - the quality of the attribute is displayed

  • ‘state’ - the device state

setModel(m, **kwargs)[source]

Sets/unsets the model name for the given key. If key is MLIST, a model is set for each name in the model sequence, new model keys are automatically added to the object’s modelList attribute and the corresponding models are attached using those keys. The new keys are of the form (MLIST, i) where i is the index of the corresponding model name in the model sequence.

Parameters:
  • model (str (or sequence of str if key is MLIST)) – the new model name. If key is MLIST, model is expected to be a sequence of model names.

  • key (object) – the model key. Defaults to first element of .modelKeys

setModelIndex(modelIndex)[source]
setPrefixText(prefix)[source]
setSuffixText(suffix)[source]
setText(text)[source]

Reimplementation of setText to set permanentText

setTextInteractionFlags(self, flags: Qt.TextInteractionFlags | Qt.TextInteractionFlag)[source]
setText_(text)[source]

Method to expose QLabel.setText

showValueDialog(*args)[source]
suffixText

This property holds a suffix text

Access functions:

textInteractionFlags

Specifies how the label should interact with user input if it displays text.

Access functions:

useParentModel

(deprecated))