Skip to main content

Screen generator for CS-Studio Phoebus displays

Project description

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

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)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

phoebusgen-3.3.0.tar.gz (142.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

phoebusgen-3.3.0-py3-none-any.whl (88.3 kB view details)

Uploaded Python 3

File details

Details for the file phoebusgen-3.3.0.tar.gz.

File metadata

  • Download URL: phoebusgen-3.3.0.tar.gz
  • Upload date:
  • Size: 142.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for phoebusgen-3.3.0.tar.gz
Algorithm Hash digest
SHA256 8563668f75dd73b180a9653167b198e28e826884a2dc95525a607bba7889257b
MD5 f010f156fb18ccc41903f81b1b15d466
BLAKE2b-256 f3dfc97c9a18b4c2917f6907e8e39e6fd7d279076fccb8f2361d2c06895d5ad4

See more details on using hashes here.

File details

Details for the file phoebusgen-3.3.0-py3-none-any.whl.

File metadata

  • Download URL: phoebusgen-3.3.0-py3-none-any.whl
  • Upload date:
  • Size: 88.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.25

File hashes

Hashes for phoebusgen-3.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 60aae3899a47a5e6b7d65743a8852fc2d5f7828e95988c29b348b2fa1a20a4da
MD5 303f11cf7085f0224a85863cc78e88b6
BLAKE2b-256 64201adc29876ef61059e0fbccbd7432da2e5a7c7e7be0643603cad52a6a1930

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page