Skip to main content

Python Module to Generate Phoebus Control Screens

PyPI Python unittest Status codecov Build Docs Upload Python Package Codacy Badge

Phoebus is the next generation of Control System Studio, a graphical platform for EPICS control systems. https://github.com/ControlSystemStudio/phoebus

This module provides a way through Python to generate the Display Builder XML format used by Phoebus (and other tools like DBWR). See examples here.

API docs here: https://als-epics.github.io/phoebusgen

Suggestions, comments, and pull requests are welcome.

Requirements

  • Python >= 3.6 (3.6 requires the dataclasses pip package)

Install

Pip Package: phoebusgen

pip install phoebusgen

Intro

Phoebus widgets and a Phoebus screen are all Python objects. Widgets can be added to a screen or even to other widgets (for things like Group or Tab widgets).

>>> import phoebusgen
>>> text_update_widget = phoebusgen.widget.TextUpdate('test widget', 'TEST:PV', 10, 20, 20, 50)
>>> text_update_widget.predefined_foreground_color(phoebusgen.colors.OK)
>>> text_update_widget.font_style_bold()
>>> print(text_update_widget)
<?xml version="1.0" ?>
<widget type="textupdate" version="2.0.0">
  <name>test widget</name>
  <x>10</x>
  <y>20</y>
  <width>20</width>
  <height>50</height>
  <pv_name>TEST:PV</pv_name>
  <foreground_color>
    <color name="OK" red="0" green="255" blue="0" alpha="255"/>
  </foreground_color>
  <font>
    <font family="Liberation Sans" size="14" style="BOLD"/>
  </font>
</widget>

Modules

phoebusgen.widget

Python API to directly create Phoebus widgets. All standard Phoebus widgets and their specific properties are available as of version 3.0.0

Widgets Docs

Example

  • text_update_xml = phoebusgen.widget.TextUpdate(widget_name, pv_name, x, y, width, height)

phoebusgen.screen

Python object to represent a Phoebus screen. Widgets can be added to the screen object and the screen object can be written to a .bob file to be opened in Phoebus.

Screen Docs

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>

Phoebus Version Support

In some cases, the XML definitions for a widget can differ between CS Studio Phoebus versions. With phoebusgen 3.0.0 and above, versioning is supported via several methods.

phoebusgen will default to use the latest Phoebus released version. At this time for example:

>>> import phoebusgen
>>> phoebusgen.phoebus_version
'4.7.3'
>>> phoebusgen.widget_versions
{'arc': '2.0.0', 'ellipse': '2.0.0', 'label': '2.0.0', 'picture': '2.0.0', 'polygon': '2.0.0', 'polyline': '2.0.0',
 'rectangle': '2.0.0', 'byte_monitor': '2.0.0', 'led': '2.0.0', 'multi_state_led': '2.0.0', 'meter': '3.0.0',
 'progressbar': '2.0.0', 'symbol': '2.0.0', 'table': '2.0.0', 'tank': '2.0.0', 'text-symbol': '2.0.0',
 'textupdate': '2.0.0', 'thermometer': '2.0.0', 'action_button': '2.0.0', 'bool_button': '2.0.0', 'checkbox': '2.0.0',
 'choice': '2.0.0', 'combo': '2.0.0', 'fileselector': '2.0.0', 'radio': '2.0.0', 'scaledslider': '2.0.0',
 'scrollbar': '2.0.0', 'slide_button': '2.0.0', 'spinner': '2.0.0', 'textentry': '2.0.0', 'thumbwheel': '2.0.0',
 'databrowser': '2.0.0', 'image': '2.0.0', 'stripchart': '2.1.0', 'xyplot': '3.0.0', 'array': '2.0.0', 'tabs': '2.0.0',
 'embedded': '2.0.0', 'group': '3.0.0', 'navtabs': '2.0.0', 'template': '2.0.0', '3dviewer': '2.0.0',
 'webbrowser': '2.0.0'}

Here are several ways to change the widget versioning:

  • Call the change_phoebus_version method. Currently version 4.7, 4.7.1, 4.7.2, and 4.7.3 are supported. This will update all the widget version to what they were in that specific release of phoebus.
    • phoebusgen.change_phoebus_version("4.7.2")
  • Add your own version definition file (overrides any other def files in ~/.phoebusgen)
    • ~/.phoebusgen/widgets.def
  • Add your own version definition file that matches phoebusgen.phoebus_version
    • ~/.phoebusgen/4.7.2_widgets.def
  • Change the version on an individual widget object
    • my_group = phoebusgen.widget.Group("test", 2,2,2,2); my_group.version("2.0.0")

See the available versions supported in phoebusgen here: config directory

>>> import phoebusgen
>>> phoebusgen.phoebus_version
'4.7.3'
>>> phoebusgen.change_phoebus_version("4.7.2")
Phoebus version manually changed to 4.7.2.
>>> b = phoebusgen.widget.Group("test", 2,2,2,2)
>>> b
<?xml version="1.0" ?>
<widget type="group" version="2.0.0">
  <name>test</name>
  <x>2</x>
  <y>2</y>
  <width>2</width>
  <height>2</height>
</widget>
>>> b.predefined_line_color("OK")
Line color not compatible with group widget version less than 3.0.0.

Site specific color and font definitions

Place a custom color.def or font.def in ~/.phoebusgen/ to force phoebusgen.colors or phoebusgen.fonts to reflect your site's custom definitions.

my_widget.predefined_font(phoebusgen.fonts.Header1)
my_widget.predefined_color(phoebusgen.colors.OK)

Metadata

Release files for phoebusgen 3.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phoebusgen 3.4.0
File Size Uploaded Provenance Actions
phoebusgen-3.4.0.tar.gz 298.9 kB Without provenance Details for phoebusgen-3.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for phoebusgen 3.4.0
File Interpreter ABI Platform Actions
phoebusgen-3.4.0-py3-none-any.whl Python 3 none any Details for phoebusgen-3.4.0-py3-none-any.whl

Total release size: 393.0 kB

Release files / phoebusgen-3.4.0.tar.gz

Download URL phoebusgen-3.4.0.tar.gz
Size 298.9 kB
Tags Source
SHA-256 checksum
How to use checksums
d98c7363b939c18954b6cfd334e80bd1a62b356ae33ad32ec5dfd8706e077cf7
BLAKE2b-256 checksum
How to use checksums
7930d541427fd204b7fafbf89c48a0ed8e923bf703e10b42c92b9a25a975476e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Release files / phoebusgen-3.4.0-py3-none-any.whl

Download URL phoebusgen-3.4.0-py3-none-any.whl
Size 94.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3023988cd8da60f613c8cf58efa24cb3be1dc154355bb56982f06ee70a6d3dfe
BLAKE2b-256 checksum
How to use checksums
a4edbcdcdffddac0875eaa5ebcee5800f0a1f46f7d578c02ddc77c8ed5ffc678
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.25

Security for phoebusgen 3.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

3.4.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page