Skip to content

Macro Substitution Support

Compare
Choose a tag to compare
@mattgibbs mattgibbs released this 14 Mar 20:15
· 3013 commits to master since this release

This release has a few new features (macro substitutions, a widget for setting enum values, new slider, etc), and a ton of bug fixes. Special thanks to @gabrielfedel and @laispc for their work fixing bugs that cropped up in the last release.

New Features

Macro Substitution

PyDM now supports macro variables, similar to those in EDM or CSS. Anywhere in a .ui file, you can add a macro variable that looks like this: ${variable}. If you are using Qt Designer, you can only add macros in string properties. But, if you want, you can open up the .ui file in a text editor and add one directly.

When you launch a display from the command line, you can specify values for each macro variable using the '-m' command line option. Specify variables as a JSON object. For example:

python pydm.py -m '{"variable": "value"}' my_file.ui

The related display button and embedded display widgets both support passing macros to their files.

Enum Combo Box

A new widget, PyDMEnumComboBox has been added. This widget provides a drop-down selector to set values for an enum channel.

New Slider

The slider widget has been completely re-written from scratch. It is less buggy, has indicators for limits and the current value, and is alarm-sensitive.

New Embedded Display Widget

The embedded display widget has been completely re-written. It is now based on QWidget, not QStackedWidget. As mentioned above, it supports macros, and it has an option to automatically disconnect from PVs when the display is not visible, and reconnect when it becomes visible again. The new widget is easier to embed inside container widgets. If you want the old QStackedWidget behavior, for example, just embed PyDMEmbeddedDisplays inside a QStackedWidget.

Command line args for .py files

Any command line options you give PyDM will be passed into your Display subclasses. You can use this however you want in your Display. As an example, you could pass in a text file with a list of devices, then have your Display populate itself from this list. Arguments are also passed from the 'filename' fields in related display buttons and embedded displays.

Bug fixes

  • Fix many issues with handling signals with multiple types
  • Widgets not held within layouts no longer disappear
  • Write access and connection state supported in most widgets
  • Labels have faster alarm handling, better enum support
  • Fix some potential crashes in the image widget
  • Many more!