in wallboard-import.py [0:0]
def GetCells(RowConfig):
Cells = []
Columns = 0
Rows = 0
for Row in RowConfig:
if "Row" not in Row:
print("Missing row number")
sys.exit(1)
if "Cells" not in Row:
print("Missing cell definitions on row "+str(Row["Row"]))
sys.exit(1)
#
# We capture the maximum number of columns because it makes
# our lives easier to know this during the render function
#
if len(Row["Cells"]) > Columns: Columns = len(Row["Cells"])
for Cell in Row["Cells"]:
if "Cell" not in Cell:
print("Missing cell number on row "+str(Row["Row"]))
sys.exit(1)
if int(Row["Row"]) > Rows: Rows = int(Row["Row"])
Item = {}
Item["Address"] = {"S":"R"+str(Row["Row"])+"C"+str(Cell["Cell"])}
if "Text" in Cell: Item["Text"] = {"S":Cell["Text"]}
if "Reference" in Cell: Item["Reference"] = {"S":Cell["Reference"]}
if "TextColour" in Cell: Item["TextColour"] = {"S":Cell["TextColour"]}
if "TextColor" in Cell: Item["TextColour"] = {"S":Cell["TextColor"]}
if "BackgroundColour" in Cell: Item["BackgroundColour"] = {"S":Cell["BackgroundColour"]}
if "BackgroundColor" in Cell: Item["BackgroundColour"] = {"S":Cell["BackgroundColor"]}
if "TextSize" in Cell: Item["TextSize"] = {"S":str(Cell["TextSize"])}
if "ThresholdReference" in Cell: Item["ThresholdReference"] = {"S":Cell["ThresholdReference"]}
if "Rows" in Cell: Item["Rows"] = {"S":str(Cell["Rows"])}
if "Cells" in Cell: Item["Cells"] = {"S":str(Cell["Cells"])}
Cells.append(Item)
return(Cells,Rows,Columns)