EPICS Home

Experimental Physics and Industrial Control System


 
1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: CSS-4.5 : Display-Builder : getting widget's PV value
From: "Kasemir, Kay" <[email protected]>
To: Amien Crombie <[email protected]>, EPICS Tech-Talk <[email protected]>
Date: Thu, 24 Aug 2017 17:18:46 +0000
> Kay, I got the print to work...
>looks like my script is not triggered at the time

> When I put a 'Action Button' on my display that calls the script, it
> works fine..at least with the 'print' I can see where I am now.

> Any idea how I can fire my script when the 'widget' becomes 'visible' ?
> (without my having to add an action-button)

Scripts can be attached to an action, or to the widget.

1) "Execute Scipt" Action is usually attached to Action Button.
User pushes button -> Action executes the script with the 'widget'.
You can actually attach actions to any widget, then it's invoked
via the context menu of the widget.

2) Script attached to widget
.. has PVs which are by default marked to 'trigger' the script
whenever they receive a new value.
In that case the script is invoked with 'widget' and 'pvs'.


If you want to trigger a script once when a file loads, attach some dummy local PV.
The $(DID) macro is useful for creating unique PV names, so trigger it for example on "loc://$(DID)init".

You can't directly trigger a script by property changes.
Well, you could trigger a script once via a "loc://$(DID)init" PV,
and in that script you then attach a property listener:

-------------------
from org.csstudio.display.builder.model import WidgetPropertyListener

class MyListener(WidgetPropertyListener):
    def propertyChanged(self, prop, old_value, new_value):
        print("Visibility changed...")

widget.getProperty("visible").addPropertyListener(MyListener())
-------------------

But if you had to ask how to do that, you shouldn't try this, because details could change.

The more straightforward way:
How do you change the visibility in the first place?
Some (local) PV -> rule -> changes visibility?
--> Use that same PV to trigger your script.

-Kay

References:
CSS-4.5 : Display-Builder : getting widget's PV value Amien Crombie
Re: CSS-4.5 : Display-Builder : getting widget's PV value Kasemir, Kay
Re: CSS-4.5 : Display-Builder : getting widget's PV value Amien Crombie
Re: CSS-4.5 : Display-Builder : getting widget's PV value Kasemir, Kay
Re: CSS-4.5 : Display-Builder : getting widget's PV value Amien Crombie

Navigate by Date:
Prev: Re: CSS-4.5 : Display-Builder : getting widget's PV value Amien Crombie
Next: Re: Problems building seq 2.2.4 on Linux Sue Witherspoon
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Re: CSS-4.5 : Display-Builder : getting widget's PV value Amien Crombie
Next: Running CSS-4.5 from Eclipse Neon Amien Crombie
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  <20172018  2019  2020  2021  2022  2023  2024