add todo comment for named ranges

This commit is contained in:
Daniel Roth 2026-06-10 13:32:11 +00:00
parent 131b0884c7
commit 8976f55636

View file

@ -16,20 +16,34 @@ _DOOR_AREA_CF_RANGE = f"{_DOOR_AREA_COL}{_DATA_START_ROW}:{_DOOR_AREA_COL}{_DATA
_Y_THRESHOLD = 7600
_DOOR_AREA_HEADER = CellRichText(
TextBlock(InlineFont(b=True, sz=11, rFont="Aptos Narrow"), "Area (mm2)\n"),
TextBlock(InlineFont(b=True, sz=11, color=Color(rgb="FF0000"), rFont="Aptos Narrow"), "<"),
TextBlock(
InlineFont(b=True, sz=11, color=Color(rgb="FF0000"), rFont="Aptos Narrow"), "<"
),
TextBlock(InlineFont(b=True, sz=11, rFont="Aptos Narrow"), " 7600 "),
TextBlock(InlineFont(b=True, sz=11, color=Color(rgb="196B24"), rFont="Aptos Narrow"), "<"),
TextBlock(
InlineFont(b=True, sz=11, color=Color(rgb="196B24"), rFont="Aptos Narrow"), "<"
),
)
# TODO: update the template and this module to use Named Ranges rather than relying on column IDs
def _apply_column_y_formatting(sheet: Any) -> None:
sheet.conditional_formatting.add(
_DOOR_AREA_CF_RANGE,
CellIsRule(operator="lessThan", formula=[str(_Y_THRESHOLD)], font=Font(color=Color(rgb="FF0000"))),
CellIsRule(
operator="lessThan",
formula=[str(_Y_THRESHOLD)],
font=Font(color=Color(rgb="FF0000")),
),
)
sheet.conditional_formatting.add(
_DOOR_AREA_CF_RANGE,
CellIsRule(operator="greaterThan", formula=[str(_Y_THRESHOLD)], font=Font(color=Color(rgb="196B24"))),
CellIsRule(
operator="greaterThan",
formula=[str(_Y_THRESHOLD)],
font=Font(color=Color(rgb="196B24")),
),
)
sheet[f"{_DOOR_AREA_COL}3"] = _DOOR_AREA_HEADER
@ -50,7 +64,9 @@ def populate_sheet(sheet: Any, plan: Plan) -> None:
if len(rooms) > _MAX_ROWS:
raise ValueError(f"Room series exceeds {_MAX_ROWS} rows ({len(rooms)} rooms)")
if len(windows) > _MAX_ROWS:
raise ValueError(f"Window series exceeds {_MAX_ROWS} rows ({len(windows)} windows)")
raise ValueError(
f"Window series exceeds {_MAX_ROWS} rows ({len(windows)} windows)"
)
if len(doors) > _MAX_ROWS:
raise ValueError(f"Door series exceeds {_MAX_ROWS} rows ({len(doors)} doors)")