Mixins

A couple of mixin classes were created to help us make it easy to create new symbol widgets and ensure that the code has an uniform behavior.

Interlock

class pcdswidgets.vacuum.mixins.InterlockMixin(interlock_suffix, **kwargs)[source]

The InterlockMixin class adds the interlock channel and interlocked property to the widget.

The interlocked property can be used at stylesheet in the following manner:

*[interlocked="true"] {
    background-color: red;
}
Parameters:

interlock_suffix (str) – The suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the interlock channel address.

create_channels()[source]

This method invokes create_channels from the super classes and adds the interlock_channel to the widget along with a reset for the interlocked and interlock_connected variables.

interlock_connection_changed(conn)[source]

Callback invoked when the connection status changes for the Interlock Channel.

Parameters:

conn (bool) – True if connected, False otherwise.

interlock_value_changed(value)[source]

Callback invoked when the value changes for the Interlock Channel.

Parameters:

value (int) – The value from the channel will be either 0 or 1 with 0 meaning that the widget is interlocked.

interlocked

Property used to query interlock state.

Return type:

bool

status_tooltip()[source]

This method adds the contribution of the interlock mixin into the general status tooltip.

Return type:

str

Error

class pcdswidgets.vacuum.mixins.ErrorMixin(error_suffix, **kwargs)[source]

The ErrorMixin class adds the error channel and error property to the widget.

The error property can be used at stylesheet in the following manner:

*[error="INVALID"] {
    color: purple;
}
Parameters:

error_suffix (str) – The suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the error channel address.

create_channels()[source]

This method invokes create_channels from the super classes and adds the error_channel to the widget along with a reset for the error and error_connected variables.

error

Property used to query the error state.

Return type:

str

error_connection_changed(conn)[source]

Callback invoked when the connection status changes for the Error Channel.

Parameters:

conn (bool) – True if connected, False otherwise.

error_enum_changed(items)[source]

Callback invoked when the enumeration strings change for the Error Channel. This callback triggers the update of the error message and also a repaint of the widget with the new stylesheet guidelines for the current error value.

Parameters:

items (tuple) – The string items

error_value_changed(value)[source]

Callback invoked when the value change for the Error Channel. This callback triggers the update of the error message and also a repaint of the widget with the new stylesheet guidelines for the current error value.

Parameters:

value (int)

status_tooltip()[source]

This method adds the contribution of the error mixin into the general status tooltip.

Return type:

str

State

class pcdswidgets.vacuum.mixins.StateMixin(state_suffix, **kwargs)[source]

The StateMixin class adds the state channel and state property to the widget.

The state property can be used at stylesheet in the following manner:

*[state="Vented"] {
    border: 5px solid blue;
}
Parameters:

state_suffix (str) – The suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the state channel address.

create_channels()[source]

This method invokes create_channels from the super classes and adds the state_channel to the widget along with a reset for the state and state_connected variables.

state

Property used to query the state of the widget.

Return type:

str

state_connection_changed(conn)[source]

Callback invoked when the connection status changes for the State Channel.

Parameters:

conn (bool) – True if connected, False otherwise.

state_enum_changed(items)[source]

Callback invoked when the enumeration strings change for the State Channel. This callback triggers the update of the state message and also a repaint of the widget with the new stylesheet guidelines for the current state value.

Parameters:

items (tuple) – The string items

state_value_changed(value)[source]

Callback invoked when the value change for the State Channel. This callback triggers the update of the state message and also a repaint of the widget with the new stylesheet guidelines for the current state value.

Parameters:

value (int)

status_tooltip()[source]

This method adds the contribution of the state mixin into the general status tooltip.

Return type:

str

State - Open/Close

class pcdswidgets.vacuum.mixins.OpenCloseStateMixin(open_suffix, close_suffix, **kwargs)[source]

The OpenCloseStateMixin class adds two channels (Open and Close State) and a state property based on a combination of the two channels to the widget.

The state property can be used at stylesheet in the following manner:

*[state="Close"] {
    background-color: blue;
}
Parameters:
  • open_suffix (str) – The suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the open state channel address.

  • close_suffix (str) – The suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the close state channel address.

create_channels()[source]

This method invokes create_channels from the super classes and adds the state_open_channel and state_close_channel to the widget along with a reset for the state and interlock_connected variables.

state

Property used to query the state of the widget.

Returns:

The return string will either be Open, Close or INVALID when it was not possible to determine the state.

Return type:

str

state_connection_changed(which, conn)[source]

Callback invoked when the connection status changes for one of the channels in this mixin.

Parameters:
  • which (str) – String defining which channel is sending the information. It must be either “OPEN” or “CLOSE”.

  • conn (bool) – True if connected, False otherwise.

state_value_changed(which, value)[source]

Callback invoked when the value changes for one of the channels in this mixin.

Parameters:
  • which (str) – String defining which channel is sending the information. It must be either “OPEN” or “CLOSE”.

  • value (int) – The value from the channel which will be either 0 or 1 with 1 meaning that a certain state is active.

status_tooltip()[source]

This method adds the contribution of the open close state mixin into the general status tooltip.

Return type:

str

Button Control

class pcdswidgets.vacuum.mixins.ButtonControl(command_suffix, **kwargs)[source]

The ButtonControl class adds a PyDMEnumButton to the widget for controls.

Parameters:

command_suffix (str) – The suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the command button channel address.

create_channels()[source]

Method invoked when the channels associated with the widget must be created. This method also sets the channel address for the control button.

destroy_channels()[source]

Method invoked when the channels associated with the widget must be destroyed. This method also clears the channel address for the control button.

Label Control

class pcdswidgets.vacuum.mixins.LabelControl(readback_suffix, readback_name, **kwargs)[source]

The LabelControl class adds a PyDMLabel to the widget for controls.

Parameters:
  • readback_suffix (str) – The suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the readback label channel address.

  • readback_name (str) – The name to be set to the PyDMLabel so one can refer to it by name with stylesheet

create_channels()[source]

Method invoked when the channels associated with the widget must be created. This method also sets the channel address for the control button.

destroy_channels()[source]

Method invoked when the channels associated with the widget must be destroyed. This method also clears the channel address for the control button.

Button & Label Control

class pcdswidgets.vacuum.mixins.ButtonLabelControl(command_suffix, readback_suffix, readback_name, **kwargs)[source]

The ButtonLabelControl class adds a PyDMEnumButton and a PyDMLabel to the widget for controls.

Parameters:
  • command_suffix (str) – The suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the command button channel address.

  • readback_suffix (str) – The suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the readback label channel address.

  • readback_name (str) – The name to be set to the PyDMLabel so one can refer to it by name with stylesheet

create_channels()[source]

Method invoked when the channels associated with the widget must be created. This method also sets the channel address for the control button.

destroy_channels()[source]

Method invoked when the channels associated with the widget must be destroyed. This method also clears the channel address for the control button.

Multiple Button Control

class pcdswidgets.vacuum.mixins.MultipleButtonControl(*, commands, **kwargs)[source]

The MultipleButtonControl class adds multiple PyDMPushButton instances to the widget for controls.

Parameters:

commands (list) –

List of dictionaries containing the specifications for the buttons. Required keys for now are:

  • suffix: str

    suffix to be used along with the channelPrefix from PCDSSymbolBase to compose the command button channel address

  • text: str

    the text to display at the button

  • value

    the value to be written when the button is pressed

clear_control_layout()[source]

Remove all inner widgets from the control layout

create_channels()[source]

Method invoked when the channels associated with the widget must be created. This method also sets the channel address for the control button.

destroy_channels()[source]

Method invoked when the channels associated with the widget must be destroyed. This method also clears the channel address for the control button.