phoebusgen.screen package

Submodules

phoebusgen.screen.screen module

class phoebusgen.screen.screen.Screen(name, f_name=None)

Bases: object

Phoebus Screen object that holds widgets and can be written to .bob file

add_widget(elem)

Add widget or list of widgets to screen

Parameters:

elem (Union[list, object]) – <list/Phoebusgen.widget> List of Phoebusgen.widget’s or a single widget to add

Return type:

None

background_color(red, green, blue, alpha=255)

Add background color to screen RGB values

Parameters:
  • red (int) – 0-255

  • green (int) – 0-255

  • blue (int) – 0-255

  • alpha (int) – 0-255. Default is 255

Return type:

None

find_widget(widget_tag_name)

Find widget in the screen

Parameters:

widget_tag_name (str) – Tag name of widget to find

Return type:

Element

Returns:

None if not found or widget that was found

height(val)

Change height of screen

Parameters:

val (int) – Screen height

Return type:

None

macro(name, val)

Add macro to screen

Parameters:
  • name (str) – Macro name

  • val (Union[str, int, float]) – Macro value

Return type:

None

predefined_background_color(name)

Add named background color to screen

Parameters:

name (object) – <Phoebusgen.colors> Predefined color name

Return type:

None

width(val)

Change width of screen

Parameters:

val (int) – Screen width

Return type:

None

write_screen(file_name=None)

Writes screen XML to file. File name parameter is optional, if not given Screen bob_file member will be used

Parameters:

file_name (Optional[str]) – File name to write to

Return type:

bool

Returns:

True is successful write, False otherwise

phoebusgen.screen.screen.prettify(elem)

Return a pretty-printed XML string for the Element. From: https://pymotw.com/3/xml.etree.ElementTree/create.html

Module contents

phoebusgen.screen Module

This module contains a Python class representation of a Phoebus screen. A screen can be created via the Screen class and then widgets from Phoebusgen.widget can be added to the Python screen object. At the end, the screen object can write the XML to a .bob file which can be opened immeditaely into Phoebus

Example:
>>> import phoebusgen.screen
>>> import phoebusgen.widget
>>> my_screen = phoebusgen.screen.Screen("my screen")
>>> print(my_screen)
<?xml version="1.0" ?>
<display version="2.0.0">
  <name>my screen</name>
</display>
>>> my_widget = phoebusgen.widget.TextUpdate("test", "test:PV", 10, 10 ,10 ,10)
>>> my_screen.add_widget(my_widget)
>>> print(my_screen)
<?xml version="1.0" ?>
<display version="2.0.0">
  <name>my screen</name>
  <widget type="textupdate" version="2.0.0">
    <name>test</name>
    <x>10</x>
    <y>10</y>
    <width>10</width>
    <height>10</height>
    <pv_name>test:PV</pv_name>
  </widget>
</display>