Display Types

Typhon has two major widgets that users are expected to interface with. The first is the TyphonDeviceDisplay, which shows device information, and TyphonSuite which contains multiple devices and tools. This is the barebones implementation. No signals, or widgets are automatically populated in the screen. In fact, by default most of the widgets will be hidden. You can then manually add signals to the panels and plots, the panels will only show themselves when you add PVs.

TyphonSuite

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

Complete Typhon Window

This contains all the neccesities to load tools and devices into a Typhon window.

Parameters

parent (QWidget, optional) –

add_device(device, children=True, category='Devices')[source]

Add a device to the TyphonSuite

Parameters
  • device (ophyd.Device) –

  • children (bool, optional) – Also add any subdevices of this device to the suite as well.

  • category (str, optional) – Category of device. By default, all devices will just be added to the “Devices” group

add_subdisplay(name, display, category)[source]

Add an arbitrary widget to the tree of available widgets and tools

Parameters
  • name (str) – Name to be displayed in the tree

  • display (QWidget) – QWidget to show in the dock when expanded.

  • category (str) – The top level group to place the controls under in the tree. If the category does not exist, a new one will be made

add_tool(name, tool)[source]

Add a widget to the toolbar

Shortcut for:

suite.add_subdisplay(name, tool, category='Tools')
Parameters
  • name (str) – Name of tool to be displayed in sidebar

  • tool (QWidget) – Widget to be added to .ui.subdisplay

embed_subdisplay(widget)[source]

Embed a display in the dock system

classmethod from_device(device, parent=None, tools={}, **kwargs)[source]

Create a new TyphonDeviceDisplay from an ophyd.Device

Parameters
  • device (ophyd.Device) –

  • children (bool, optional) – Choice to include child Device components

  • parent (QWidgets) –

  • tools (dict, optional) – Tools to load for the object. dict should be name, class pairs. By default these will be .default_tools, but None can be passed to avoid tool loading completely.

  • kwargs – Passed to TyphonSuite.add_device()

get_subdisplay(display)[source]

Get a subdisplay by name or contained device

Parameters

display (str or Device) – Name of screen or device

Returns

widget – Widget that is a member of the ui.subdisplay

Return type

QWidget

Example

suite.get_subdisplay(my_device.x)
suite.get_subdisplay('My Tool')
hide_subdisplay(widget)[source]

Hide a visible subdisplay

Parameters

widget (SidebarParameter or Subdisplay) – If you give a SidebarParameter, we will find the corresponding widget and hide it. If the widget provided to us is inside a DockWidget we will close that, otherwise the widget is just hidden.

hide_subdisplays()[source]

Hide all open displays

save()[source]

Save the TyphonSuite to a file using typhon.utils.save_suite()

A QFileDialog will be used to query the user for the desired location of the created Python file

The template will be of the form:

import sys
import typhon.cli

devices = {devices}

def create_suite(cfg=None):
    return typhon.cli.create_suite(devices, cfg=cfg)

if __name__ == '__main__':
    typhon.cli.typhon_cli(devices + sys.argv[1:])
show_subdisplay(widget)[source]

Open a display in the dock system

Parameters

widget (QWidget, SidebarParameter or str) – If given a SidebarParameter from the tree, the widget will be shown and the sidebar item update. Otherwise, the information is passed to get_subdisplay()

property tools

Tools loaded into the TyphonDeviceDisplay

property top_level_groups

All top-level groups as name, QGroupParameterItem pairs

TyphonDeviceDisplay

class typhon.TyphonDeviceDisplay(parent=None, **kwargs)[source]

Main Panel display for a signal Ophyd Device

This widget lays out all of the architecture for a single Ophyd display. The structure matches an ophyd Device, but for this specific instantation, one is not required to be given. There are four main panels available; read_panel, config_panel, method_panel. These each provide a quick way to organize signals and methods by their importance to an operator. Because each panel can be hidden interactively, the screen works as both an expert and novice entry point for users. By default, widgets are hidden until contents are added. For instance, if you do not add any methods to the main panel it will not be visible.

This contains the widgets for all of the root devices signals, any methods you would like to display, and an optional image. As with typhon convention, the base initialization sets up the widgets and the .from_device class method will automatically populate them.

Parameters
  • name (str, optional) – Name to displayed at the top of the panel

  • image (str, optional) – Path to image file to displayed at the header

  • parent (QWidget, optional) –

class TemplateEnum

An enumeration.

add_device(device, macros=None)[source]

Add a Device and signals to the TyphonDeviceDisplay

Parameters
  • device (ophyd.Device) –

  • macros (dict, optional) – Set of macros to reload the template with. There are two fallback options attempted if no information is passed in. First, if the device has an md attribute after being loaded from a happi database, that information will be passed in as macros. Finally, if no name field is passed in, we ensure the device.name and device.prefix are entered as well.

property current_template

Current template being rendered

device_class

Full class with module name of loaded device

device_name

Name of loaded device

force_template

Force a specific template

classmethod from_device(device, template=None, macros=None)[source]

Create a new TyphonDeviceDisplay from a Device

Loads the signals in to the appropriate positions and sets the title to a cleaned version of the device name

Parameters
  • device (ophyd.Device) –

  • template (str, optional) – Set the display_template

  • macros (dict, optional) – Macro substitutions to be placed in template

load_template(macros=None)[source]

Load a new template

Parameters
  • template (str) – Absolute path to template location

  • macros (dict, optional) – Macro substitutions to be made in the file