Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add graphics widget macros #58

Merged
merged 3 commits into from
Jun 14, 2024
Merged

Conversation

abigailalexander
Copy link
Collaborator

Phoebus now longer has a pv_name field on Graphics widgets Arc, Ellipse, Image, Label, Polyline, Polygon and Rectangle. This has been replaced by a macros field, which can be used to specify pv_name or other fields (if needed for rules such as changing background colour). I've added the macros field into these widgets, and also ensured these macros get parsed with the others.

I tested this with some widgets that looked like this:

<widget type="rectangle" version="2.0.0">
    <name>EDM Rectangle</name>
    <macros>
      <pv_name>PV NAME HERE</pv_name>
    </macros>
    <width>50</width>
    <height>50</height>
    <line_width>0</line_width>
    <line_color>
      <color name="Black" red="0" green="0" blue="0">
      </color>
    </line_color>
    <background_color>
      <color red="0" green="224" blue="0">
      </color>
    </background_color>
    <rules>
      <rule name="background_color_machineStatusRule" prop_id="background_color" out_exp="false">
        <exp bool_exp="pv0== 1">
          <value>
            <color red="0" green="224" blue="0">
            </color>
          </value>
        </exp>
        <exp bool_exp="true">
          <value>
            <color red="255" green="0" blue="0">
            </color>
          </value>
        </exp>
        <pv_name>$(pv_name)</pv_name>
      </rule>
    </rules>
  </widget>

To ensure the macro was passed to the rules

Copy link
Collaborator

@rjwills28 rjwills28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tested this with a screen created with Phoebus containing some of the example widgets listed and all looks good 👍 . Verified the reported issue and associated fix.

@abigailalexander abigailalexander merged commit a7ea7ef into master Jun 14, 2024
2 checks passed
@abigailalexander abigailalexander deleted the add-graphics-widget-macros branch September 25, 2024 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants