Hi:
When you perform actions within a CSS BOY script, that script executes within the GUI thread. This means the GUI is blocked while your script is running, and cannot update, reflect changes to widgets that you perform within the script, until you exit the script.
You can look at the BOY example for starting background threads from within a script, and those background threads could then update the GUI periodically: BOY Examples/5_6_UseThreadInScript.opi
Before you dig into that, I wonder if you are better off to reconsider the overall approach because you seem to mix the user interface with your application logic. Your user interface (CSS BOY) should just be the "view". If you close it, your process should still continue. If you open multiple copies of CSS, as long as they are just a "view", that's no problem, but if you add application logic to the user interface, then which copy should be "in control"? If pushing a button in BOY starts a certain process like send data to some stream device, the same should be possible via another user interface, including a simple "caput NameOfThatPV 1" from a terminal.
If things need to happen in a certain order, with specific timing, you could put that into a sequence on an IOC.
With a PV to start the process, and second PV to indicate that the process is ongoing.
In the BOY display, one button would write to that 'start' PV, and maybe a label displays "process is running" based on the second PV.
You could also add a rule to disable the button based on the second PV.
Still, the timing and handling of the process is on the IOC. The BOY opi should just be the view, the display.
Thanks,
Kay
On Apr 15, 2013, at 10:29 , Márcio Paduan Donadio wrote:
Hello all.
I have an OPI that sends some data to Stream Device records that are connected to an equipment using serial RS232. This operation is started with a button press. I don't want this button to be pressed again while the data is being transfered to my equipment. So, I tried to disable the button in the beginnig of the script, and reenable it at the end. But what I see is an enabled button until the end of the data transfer. Only at the end of the script I can see a quick transition of the button to disabled state and again to enabled.
Between each data I need to transfer, I use time.sleep, because my equipment need some time to process the data before receiveing the next one.
My python script is the following:
(...)
button = widgetController.getWidgetModel()
button.setPropertyValue("enabled", False)
button.setPropertyValue("text", "Programming\nPlease, Wait")
(data transfer code, with some time.sleep functions...)
button.setPropertyValue("text", "Program Furnace")
button.setPropertyValue("enabled", True)
Is there a way to force the OPI refresh, as the disabled status of the button is shown?
Thanks,
Márcio Paduan Donadio
Engenheiro de Computação - Software de Operação das Linhas de Luz
Laboratório Nacional de Luz Síncrotron – (LNLS)
Centro Nacional de Pesquisa em Energia e Materiais (CNPEM)
+ 55 (19) 3512-3520 - [email protected]<mailto:[email protected]>
www.lnls.cnpem.br<http://www.lnls.cnpem.br>
- References:
- CSS opi refresh Márcio Paduan Donadio
- Navigate by Date:
- Prev:
CSS opi refresh Márcio Paduan Donadio
- Next:
sscan/ saveData problem with RW permission, and not an NFS issue Vesna Samardzic-Boban
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
CSS opi refresh Márcio Paduan Donadio
- Next:
sscan/ saveData problem with RW permission, and not an NFS issue Vesna Samardzic-Boban
- Index:
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
<2013>
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
|