Widgets

Typhon uses a few custom widgets to create a clean and concise user interface. While most users should not be interacting with these directly, there may be a need if a user opts to create their display by hand instead of automatically generating one. If you would just like a widget for an ophyd.Signal, there is a function available:

typhon.signal.signal_widget(signal, read_only=False, tooltip=None)[source]

Factory for creating a PyDMWidget from a signal

Parameters
  • signal (ophyd.Signal) – Signal object to create widget

  • read_only (bool, optional) – Whether this widget should be able to write back to the signal you provided

  • tooltip (str, optional) – Tooltip to use for the widget

Returns

widget – PyDMLabel, PyDMLineEdit, or PyDMEnumComboBox based on whether we should be able to write back to the widget and if the signal has enum_strs

Return type

PyDMWidget

Panels

One of the major design principles of Typhon is that users should be able to see what they need and hide one they don’t. Thefore, many of the widget implementations are placed in “Panels” these consist of QPushButton header that hides and shows the contents. Each variation in Typhon is documented below.

typhon.signal.SignalPanel([signals])

Base panel display for EPICS signals

typhon.func.FunctionPanel([methods, parent])

Function Panel

TyphonPositionerWidget

class typhon.TyphonPositionerWidget(parent=None)[source]

Widget to interact with an ophyd.Positioner

Standard positioner motion requires a large amount of context for operators. For most motors, it may not be enough to simply have a text field where setpoints can be punched in. Instead, information like soft limits and hardware limit switches are crucial for a full understanding of the position and behavior of a motor. The widget will work with any object that implements set, however to get other relevant information, we also duck-type to see if we can find other useful signals. Below is a table of attributes that the widget looks for to inform screen design:

Widget

Attribute Selection

User Readback

The widget first searches for a Signal called user_readback. If this is not found the first hint is used.

Limit Switches

Attributes low_limit_switch and high_limit_switch are queried. If these are not found the widgets are hidden.

Soft Limits

The widget first looks for low_limit and high_limit signals. If these do not exist, we look for limits and sets the text to match the returned tuple from this method.

Set and Tweak

Both of these methods simply use Device.set which is expected to take a float and return a status object that indicates the motion completeness. Must be implemented.

Stop

Device.stop()

add_device(device)[source]

Add a device to the widget

done_moving(success)[source]

Called when a move is complete

failed_move

The last requested move failed

move_changed()[source]

Called when a move is begun

moving

Current state of widget

This will lag behind the actual state of the positioner in order to prevent unnecessary rapid movements

negative_tweak()[source]

Tweak negative by the amount listed in ui.tweak_value

positive_tweak()[source]

Tweak positive by the amount listed in ui.tweak_value

set()[source]

Set the device to the value configured by ui.set_value

stop()[source]

Stop device

successful_move

The last requested move was successful

TyphonMethodButton

class typhon.TyphonMethodButton(parent=None)[source]

QPushButton to access a method of a Device

The function provided by the loaded device and the method_name will be run when the button is clicked. If use_status is set to True, the button will be disabled while the Status object is active.

add_device(device)[source]

Add a new device to the widget

Parameters

device (ophyd.Device) –

execute()[source]

Execute the method given by method_name

classmethod from_device(device, parent=None)[source]

Create a TyphonMethodButton from a device

method_name

Name of method on provided Device to execute

use_status

Use the status to enable and disable the button