BCDA-APS / adl2pydm

Convert MEDM's .adl files to PyDM's .ui format
Other
0 stars 4 forks source link

Motor `Moving` indicator is not changing and the `All Stop` button is not responding. On the plus side, the pop-up menu works. #61

Closed prjemian closed 3 years ago

prjemian commented 3 years ago

On the xxx.adl screen, the Moving indicator is not changing and the All Stop button is not responding. On the plus side, the pop-up menu works.

Originally posted by @prjemian in https://github.com/BCDA-APS/adl2pydm/issues/60#issuecomment-949885704

Is this problem due to adl2pydm or PyDM itself? Suspect the former, relating to string handling in python 3.

(edited) Actually related to #55.

prjemian commented 3 years ago

Still a problem with files pre-converted adl2pydm. Probably something that can be changed here to resolve.

prjemian commented 3 years ago

On the pre-converted screen, the "All Stop" button works correctly (it stops the motors when pressed).

xxx main screen in PyDM

prjemian commented 3 years ago

Each of the three Moving widgets are QLabel rather than PyDMLabel and this is why they don't change color when the motor is moving and why they don't disappear when the motor is not moving. Also, don't forget the ca:// protocol prefix when using a PV in a display rule.

```xml 1 1 80 25 Moving 10 10 0 184 [{"name": "visibility", "property": "Visible", "channels": [{"channel": "gp:alldone.VAL", "trigger": true}], "expression": "ch[0]==0"}] text Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter QLabel#text { color: rgb(10, 0, 184); } 2 2 80 25 Moving 10 10 0 184 [{"name": "visibility", "property": "Visible", "channels": [{"channel": "gp:alldoneBlink.VAL", "trigger": true}], "expression": "ch[0]!=0"}] text_1 Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter QLabel#text_1 { color: rgb(10, 0, 184); } 0 0 80 25 Moving 10 153 255 255 [{"name": "visibility", "property": "Visible", "channels": [{"channel": "gp:alldone.VAL", "trigger": true}], "expression": "ch[0]==0"}] text_2 Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter QLabel#text_2 { color: rgb(153, 255, 255); } ```
prjemian commented 3 years ago

In the .adl file those widgets all show a "dynamic attribute" part with varying chan= and vis=

            "dynamic attribute" {
                vis="if zero"
                chan="gp:alldone.VAL"
            }
``` text { object { x=351 y=79 width=80 height=25 } "basic attribute" { clr=54 } "dynamic attribute" { vis="if zero" chan="gp:alldone.VAL" } textix="Moving" } text { object { x=352 y=80 width=80 height=25 } "basic attribute" { clr=54 } "dynamic attribute" { vis="if not zero" chan="gp:alldoneBlink.VAL" } textix="Moving" } text { object { x=350 y=78 width=80 height=25 } "basic attribute" { clr=50 } "dynamic attribute" { vis="if zero" chan="gp:alldone.VAL" } textix="Moving" } ```

Summary table:

geometry clr (color code) vis= chan= textix=
(351, 79, 80x25) 54 if zero gp:alldone.VAL Moving
(352, 80, 80x25) 54 if not zero gp:alldoneBlink.VAL Moving
(350, 78, 80x25) 50 if zero gp:alldone.VAL Moving
prjemian commented 3 years ago

Edited the xxx.ui file (with Qt's designer), promote the three QLabel widgets to PyDMLabel and edit the rules property to prepend ca://, such as:

[{"name": "visibility", "property": "Visible", "channels": [{"channel": "ca://gp:alldone.VAL", "trigger": true}], "expression": "ch[0]==0"}]

and this produced the proper display blinking when a motor is moving and no text when all motors are not moving.

Note gp: is the specific IOC prefix, not the xxx: in the source file.

prjemian commented 3 years ago

Note the PV is present in the original converted .ui file but the <widget class="QLabel" name="text"> should be a PyDMLabel and the ca:// protocol prefix is missing from the PV.

prjemian commented 3 years ago

This same configuration is seen in the adl2pydm/tests/medm/xxx-R6-0.adl file in the repo.