Hi All,
I was wondering if there is a way to make a specific Power Table’s cell blink from let’s say… yellow to red with a blink time of 1 second.
Thanks in advance.
Cheers,
Hi All,
I was wondering if there is a way to make a specific Power Table’s cell blink from let’s say… yellow to red with a blink time of 1 second.
Thanks in advance.
Cheers,
This was written by @JGJohnson in another post. This should be placed in the configureCell function of the power table. This should help point you in the right direction on what you need to do.
attributes = {"background": "#FFFFFF", "foreground": "#000000"}
if rowIndex % 2 == 0:
attributes["background"] = "#EEECE8"
if colName == "val":
if self.data.getValueAt(rowIndex, "writeable") == True:
attributes["background"] = "#FFFF47"
if colName == "alarm" and value is not None:
attributes["text"] = None
elif colName == "unit" and value is None:
attributes["text"] = None
if self.data.getValueAt(rowIndex, "alarm") is not None:
attributes["iconPath"] = "CustomIcons/Indicator_Red.png"
if value < 1:
attributes["iconPath"] = "CustomIcons/Indicator_Green.png"
return attributes
Has anyone tried something similar ? Can't understand the condition if value < 1:
trying to achieve a blinking cell where the dataset it coming from sql and only one cell value is live from OPC.
@JGJohnson , can help ?
It got messed up when dkhayes copied it. The line is actually
if value < 1:
As for blinking a cell, my first thought would be to add a couple of extra hidden columns to the dataset, so the data might look something like this:
MyCol, MyColBlinks, MyColBlinkState
value, True, 0
Then use a timer with a 1 second interval to update the dataset and toggle the blink state for any rows where MyColBlinks is set to True.
Then it's a simple matter of coloring the cell in the configureCell extension function according to whether or not the cell should blink and what it's blink state is.
if colName == "MyCol":
if self.data.getValueAt(rowIndex, "MuColBlinks":
if self.data.getValueAt(rowIndex, "MuColBlinkState":
attributes["background"] = "#FF0000":
else:
attributes["background"] = "#FFFFFF"
Yes, great to know that I am on the correct path. Doing something similar.
Finally I found a really easy way to make a row blink:
You got your row blinking with a interval of 1 second