CreatePanel.pl - List Panel Generation

last update: by

Contents

USAGE :
History:
Overview
The substitution files
Debug Panels
Layout of the created display
Layout by line (Default)
Layout by lineRaw
Layout by collumn
Layout by table
Layout XY: Place each widget to a fixed position
Layout GRID: Place each widget to a table by grid parameters
Variables in edl templates
Special processing of the PV variable (.edl only)
Scaling the widgets
Create the title is option '-title' is set

Author: Kuner

USAGE :

  Usage: CreatePanel.pl [options] inFilename outFilename\n

   if inFilename  is '-', data is read from standard-in
   if outFilename is '-', data is written to standard-out

  Options:
    -title  TitleString | Title.type Title of the panel (string or file). Default=no title
    -baseW filename                  Base panel name for layout=xy
    -x pixel                         X-Position of the panel (default=100)
    -y pixel                         Y-Position of the panel (default=100)
    -w pixel                         Panel width (default=900)
    -I searchPath                    Search paht(s) for panel widgets
    -i                               Add ., .., $EPICS_DISPLAY_PATH','$EDMDATAFILES' 
                                     variable to search path(s) for panel widgets
    -M                               Create make dependencies. Call CreatePanel.pl ... -M <INFILE> <OUTFILE>.d
    -border                          extra space to the panel border left,right,bottom in pixel (layout grid only)
    -layout line|xy|grid|table|column|rawline placement of the widgets, (default = by line) 
    -type adl|edl                    Create edl or mfp file (default is edl)
    -sort NAME                       Sort a group of signals. NAME is the name of a 
                                     Name-Value pair in the substitution data.
                                     this is done only for the layouts: 'line', 'table'
    -subst 'NAME=\"VALUE\",...'      Panel substitutions from commandline
    -v                               verbose

History:

• 06/2009: New option -i to add $EPICS_DISPLAY_PATH to search path for widgets. -I paths are searced first

Overview

This script provides for a way to create more complex edm or dm2k-mfp displayes from adl/edl-template widgets and a definition file. The adl/edl-widgets are dm2k/edm displays that contain variables for PVs, strings or whatever. The variables are defined in .substitution files, same syntax as EPICS substitution files.

• There are generic adl/edl-templates for analog values, bits and strings.

• There is the feature of scaling each widget in horizontal direction.

• There are several panel layouts available: Table, Grid or Place to xy coordinates.

• For EPICS.db or EPICS.template files there is a debug panel created to show each field of all records.

The substitution files

The substitution files to create a panel have the same notation as EPICS database substitution files.

For each EPICS template file there has to exist an edl/adl-template display with the same name. Unknown files are skipped to give a chance to use just a subset of the substitution file for the panel.

The -I options define the search path for the widgets

So the EPICS database substitution file may be used for a prototype panel in EPICS database development or if there is a generic panel and a EPICS template for a device

Notation in .substitution file Panel Template
file EPICS_db.template { EPICS_db.edl
file panel.edl { panel.edl
file panel.adl { panel.adl

Debug Panels

For EPICS.db or EPICS.template files there is a debug panel created to show each field of all records in the same order as in theEPICS.db file.

Example: Create a panel for each record of the template and set the Devicname with -subst option

CreatePanel.pl -w 1030 -subst NAME="FOMZ1M:motor" -I . -I ~/ctl/apps/genericTemplate/head/dl motorRdb.template test.edl

Layout of the created display

The commandline option -layout determines which way the edl templates are placed in the Display

Layout by line (Default)

Widget1 Widget2 Widget3
Widget4 Widget5 Widget6
Widget7 Widget8 Widget9

• The Widgets are placed from the left to the right - as written in a line - as long as the display width is not exceeded. Then a new line begins.

• The total width of the panel is set by the argument -width, or set to 900 by default.

• A new line begins if there is a new edl-template type.

• The order of widgets may be set ba the option -sort NAME. NAME is any name of a variable in the .substitutions file

Layout by lineRaw

• The Widgets are placed from the left to the right - as written in a line - as long as the display width is not exceeded. Then a new line begins.

• The total width of the panel is set by the argument -width, or set to 900 by default.

• There order of widgets is as read from the substitution file, option -sort is ignored.

Layout by collumn

• The Widgets are placed in collumns. Each file.xx {} block in the substitutions file defines one collumn

• The total width of the panel is given by the sum all widgets in a row, option width is ignored

• There order of widgets in a collumn is as read from the substitution file or determined by -sort option one below the other.

Layout by table

Widget1 Widget4 Widget7
Widget2 Widget5 Widget8
Widget3 Widget6 Widget9

• The widgets are placed in columns top down and rows right to left.

• The total width of the panel is set by the argument -width, or set to 900 by default.

• A new table begins if there is a new edl-template type.

• The order of widgets may be set ba the option -sort NAME. NAME is any name of a variable in the .substitutions file

Layout XY: Place each widget to a fixed position

The option -layout xy will place each item of the .substitutions file to the position defined by the variable PANEL_POS="nX,nY". This variable defines the x/y position in pixel and has to be set for each edl-template instance.

As base widget to print the edl-templates in there has to exist a .edl file with the same name as the .substitutions file

Layout GRID: Place each widget to a table by grid parameters

Widget1.1 Widget1.2 Widget1.3
Widget2.1 Widget2.2 Widget2.3
Widget3.1 Widget3.2 Widget3.3

The edl templates are searched in the search paths as defined by the -I options

Variables in edl templates

Notation: $(VARIABLE)

Variables may occur in editable string fields of the edl-template, means in the edl in all places where they may be typed. If variables are written by an editor to places where edm expect a numeric value edl will fail to open the unsubstituted edl-template, but the variables will be substituted by its values as defined in the .substitution file and edl will run the substituted panel.

For the generic templates there is the convention to have this variable:

• $(PV) = proces variable name

Attention : variables for .adl files are given as macro substitutions to the widget instance in the .mfp file. So variables may only occur on places where dm2k allows it. EDM panels are a copy of the widgets, so variables may occur anywhere and are substituted in the output file.

Special processing of the PV variable (.edl only)

A PV substitution that contains a field is truncated to the PV name for PV definitions in the widget that contains also fields. What is this usefull for?

For bi/bo, MBBI/MBBO records it may be usefull to display the .DESC field and the status or the Value of the record. The widget may define just the PV for text message and also the status as text. So the user of this widget is free to define the variable PV to PVNAME or PVNAME.DESC and the status in the widget defined as "$(PV).STAT" will be substituted correct in both cases!

Definition in .substitution file Definition in .edl-template substitution result
PV="DEVICE" controlPv="$(PV)" controlPv="DEVICE"
PV="DEVICE" controlPv="$(PV).LLS" controlPv="DEVICE.LLS"
PV="DEVICE" controlPv="$(PV):sig" controlPv="DEVICE:sig"
PV="DEVICE.DESC" controlPv="$(PV)" controlPv="DEVICE.DESC"
PV="DEVICE.DESC" controlPv="$(PV).LLS" controlPv="DEVICE.LLS"
PV="DEVICE.DESC" controlPv="$(PV):sig" controlPv="DEVICE:sig"
PV="DEVICE:sig" controlPv="$(PV)" controlPv="DEVICE:sig"
PV="DEVICE:sig" controlPv="$(PV).LLS" controlPv="DEVICE:sig.LLS"
PV="DEVICE:sig" controlPv="$(PV):sig" controlPv="DEVICE:sig:sig"

Scaling the widgets

The variables SCALE="width" and WIDTH="width" may occur in the substitution file to control the width of a widget.

If the variable WIDTH is defined the whole widget width is set to WIDTH. All variables $(WIDTH) in the edl-template are substituted to a calculated width: w=WIDTH-x to take care of the x-position of the object.

For .mfp files WIDTH works the same way as SCALE

If the parameter SCALE is defined it means the whole edl-template is scaled from its original width to the size of the parameter SCALE. The x and w values of all points of each object are scaled.

IMPORTANT : the function removes the keys SCALE and WIDTH from the substitutions hash, because this parameters are of no further use in the widget, but would occur in the .mfp macro substitutions!

Create the title is option -title is set

The -title option may be a widget or a string, that is put to the generic text widget.