TaurusValue

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

Bases: PyQt5.QtWidgets.QWidget, taurus.qt.qtgui.base.taurusbase.TaurusBaseWidget

Internal TaurusValue class

Warning

TaurusValue (and any derived class from it) should never be instantiated directly. It is designed to be instantiated by a TaurusForm class, since it breaks some conventions on the way it manages layouts of its parent model.

addCustomWidgetToLayout()[source]
addExtraWidgetToLayout()[source]
addLabelWidgetToLayout()[source]
addReadWidgetToLayout()[source]
addUnitsWidgetToLayout()[source]
addWriteWidgetToLayout()[source]
allowWrite
applyConfig(configdict, **kwargs)[source]

extending TaurusBaseWidget.applyConfig() to restore the subwidget’s classes

Parameters

configdict (dict) –

See also

TaurusBaseWidget.applyConfig(), createConfig()

createConfig(allowUnpickable=False)[source]

extending TaurusBaseWidget.createConfig() to store also the class names for subwidgets

Parameters

alllowUnpickable (bool) –

Return type

dict <str, object>

Returns

configurations (which can be loaded with applyConfig()).

customWidget()[source]

Returns the custom widget

customWidgetClassFactory(classID)[source]
extraWidget()[source]

Returns the extra widget

extraWidgetClass
extraWidgetClassFactory(classID)[source]
getAllowWrite()[source]
getCustomWidgetClass()[source]
getCustomWidgetMap()[source]

Returns the map used to create custom widgets.

Return type

dict <str, QWidget>

Returns

a dictionary whose keys are device type strings (i.e. see PyTango.DeviceInfo) and whose values are widgets to be used

getDefaultCustomWidgetClass()[source]
getDefaultExtraWidgetClass()[source]
getDefaultLabelWidgetClass()[source]
getDefaultReadWidgetClass(returnAll=False)[source]

Returns the default class (or classes) to use as read widget for the current model.

Parameters

returnAll (bool) – if True, the return value is a list of valid classes instead of just one class

Return type

class or list <class>

Returns

the default class to use for the read widget (or, if returnAll==True, a list of classes that can show the attribute ). If a list is returned, it will be loosely ordered by preference, being the first element always the default one.

getDefaultUnitsWidgetClass()[source]
getDefaultWriteWidgetClass(returnAll=False)[source]

Returns the default class (or classes) to use as write widget for the current model.

Parameters

returnAll (bool) – if True, the return value is a list of valid classes instead of just one class

Return type

class or list <class>

Returns

the default class to use for the write widget (or, if returnAll==True, a list of classes that can show the attribute ). If a list is returned, it will be loosely ordered by preference, being the first element always the default one.

getExtraWidgetClass()[source]
getLabelConfig()[source]
getLabelWidgetClass()[source]
getModelClass()[source]

Return the class object for the widget. Default behavior is to do a ‘best effort’ to determine which model type corresponds to the current model name. Overwrite as necessary.

Return type

class TaurusModel or None

Returns

The class object corresponding to the type of Taurus model this widget handles or None if no valid class is found.

getPreferredRow()[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 }
Return type

dict

Returns

a map with pertinent designer information

getReadWidgetClass()[source]
getRow()[source]
getSwitcherClass()[source]

Returns the TaurusValue switcher class (used in compact mode). Override this method if you want to use a custom switcher in TaurusValue subclasses.

getUnitsWidgetClass()[source]
getWriteWidgetClass()[source]
handleEvent(evt_src, evt_type, evt_value)[source]

Reimplemented from TaurusBaseWidget.handleEvent() to update subwidgets on config events

hasPendingOperations()[source]

self.getPendingOperations will always return an empty list, but still self.hasPendingOperations will look at the writeWidget’s operations. If you want to ask the TaurusValue for its pending operations, call self.writeWidget().getPendingOperations()

isCompact()[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.

Return type

bool

Returns

whether or not this component is read-only

isValueChangedByUser()[source]
labelConfig
labelWidget()[source]

Returns the label widget

labelWidgetClass
labelWidgetClassFactory(classID)[source]
minimumHeight(self) → int[source]
model

Returns the model name for this component.

Return type

str

Returns

the model name.

modifiableByUser

whether the user can change the contents of the widget

Return type

bool

Returns

True if the user is allowed to modify the look&feel

onChangeLabelConfig()[source]
onChangeReadWidget()[source]
onChangeWriteWidget()[source]
onSetFormatter()[source]

Reimplemented to call onSetFormatter of the read widget (if provided)

parentModelChanged(parentmodel_name)[source]

Invoked when the parent model changes

Parameters

parentmodel_name (str) – the new name of the parent model

preferredRow
readWidget(followCompact=False)[source]

Returns the read widget. If followCompact=True, and compact mode is used, it returns the switcher’s readWidget instead of the switcher itself.

readWidgetClass
readWidgetClassFactory(classID)[source]
resetAllowWrite()[source]
resetCustomWidgetClass()[source]
resetExtraWidgetClass()[source]
resetLabelConfig()[source]
resetLabelWidgetClass()[source]
resetPreferredRow()[source]
resetReadWidgetClass()[source]
resetUnitsWidgetClass()[source]
resetWriteWidgetClass()[source]
setAllowWrite(mode)[source]
setCompact(compact)[source]
setCustomWidgetClass(classID)[source]

substitutes the current widget by a new one. classID can be one of: None, ‘Auto’, a TaurusWidget class name, or any class

setCustomWidgetMap(cwmap)[source]

Sets a map map for custom widgets.

Parameters

cwmap (dict <str, QWidget>) – a dictionary whose keys are device class strings (see PyTango.DeviceInfo) and whose values are widget classes to be used

setDangerMessage(dangerMessage=None)[source]

Sets the danger message when applying an operation. If dangerMessage is None, the apply operation is considered safe

Parameters

dangerMessage (str or None) – the danger message. If None is given (default) the apply operation is considered safe

setExtraWidgetClass(classID)[source]

substitutes the current widget by a new one. classID can be one of: None, ‘Auto’, a TaurusWidget class name, or any class

setForceDangerousOperations(yesno)[source]

Forces/clears the dangerous operations

Parameters

yesno (bool) – force or not the dangerous operations

setFormat(format)[source]

Reimplemented to call setFormat of the read widget (if provided)

setLabelConfig(config)[source]

Sets fragment configuration to the label widget.

Parameters

config (str) – fragment

setLabelWidgetClass(classID)[source]

substitutes the current widget by a new one. classID can be one of: None, ‘Auto’, a TaurusWidget class name, or any class

setMinimumHeight(self, int)[source]
setModel(model)[source]

extending TaurusBaseWidget.setModel() to change the modelclass dynamically and to update the subwidgets

setParent(self, QWidget)[source]

setParent(self, QWidget, Union[Qt.WindowFlags, Qt.WindowType])

setPreferredRow(row)[source]
setReadWidgetClass(classID)[source]

substitutes the current widget by a new one. classID can be one of: None, ‘Auto’, a TaurusWidget class name, or any class

setUnitsWidgetClass(classID)[source]

substitutes the current widget by a new one. classID can be one of: None, ‘Auto’, a TaurusWidget class name, or any class

setVisible(self, bool)[source]
setWriteWidgetClass(classID)[source]

substitutes the current widget by a new one. classID can be one of: None, ‘Auto’, a TaurusWidget class name, or any class

unitsWidget()[source]

Returns the units widget

unitsWidgetClass
unitsWidgetClassFactory(classID)[source]
updateCustomWidget()[source]
updateExtraWidget()[source]
updateLabelWidget()[source]
updatePendingOpsStyle()[source]

This method should be reimplemented by derived classes that want to change their appearance depending whether there are pending operations or not

updateReadWidget()[source]
updateUnitsWidget()[source]
updateWriteWidget()[source]
writeWidget(followCompact=False)[source]

Returns the write widget. If followCompact=True, and compact mode is used, it returns the switcher’s writeWidget instead of None.

writeWidgetClass
writeWidgetClassFactory(classID, ignoreCompact=False)[source]