in render-wallboard.py [0:0]
def CheckThreshold(WallboardName, ThresholdReference):
global Settings,Data,Thresholds,Logger,Calculations
#
# For the given data reference, check for any threshold details and then
# return the right colour (which will be used for the cell background when
# displayed). We have warning thresholds (above and below) and error
# thresholds (above and below).
#
Colour = ""
if ThresholdReference not in Thresholds[WallboardName]:
Logger.warning("Threshold reference "+ThresholdReference+" does not exist for wallboard "+WallboardName)
return(Colour)
Threshold = Thresholds[WallboardName][ThresholdReference]
if "Reference" not in Threshold:
Logger.warning("No data reference present in threshold "+ThresholdReference+ "for wallboard "+WallboardName)
return(Colour)
if Threshold["Reference"] not in Data:
if Threshold["Reference"] in Calculations:
Data[Threshold["Reference"]] = DoCalculation(WallboardName, Threshold["Reference"])
else:
Logger.warning("Data reference "+Threshold["Reference"]+" in threshold "+ThresholdReference+" does not exist for wallboard "+WallboardName)
return(Colour)
if "WarnBelow" in Threshold:
if int(Data[Threshold["Reference"]]) < int(Threshold["WarnBelow"]): Colour = Settings[WallboardName]["WarningBackgroundColour"]
if "AlertBelow" in Threshold:
if int(Data[Threshold["Reference"]]) < int(Threshold["AlertBelow"]): Colour = Settings[WallboardName]["AlertBackgroundColour"]
if "WarnAbove" in Threshold:
if int(Data[Threshold["Reference"]]) > int(Threshold["WarnAbove"]): Colour = Settings[WallboardName]["WarningBackgroundColour"]
if "AlertAbove" in Threshold:
if int(Data[Threshold["Reference"]]) > int(Threshold["AlertAbove"]): Colour = Settings[WallboardName]["AlertBackgroundColour"]
return(Colour)