from app.but.prepajury_xl import ( ScoExcelSheet, ) from app.but.prepajury_xl_format import ( SCO_HALIGN, SCO_VALIGN, SCO_FONTNAME, SCO_FONTSIZE, FMT, Sco_Style, ) base_signature = ( FMT.FONT_NAME.write(SCO_FONTNAME.FONTNAME_CALIBRI) + FMT.FONT_SIZE.write(SCO_FONTSIZE.FONTSIZE_10) + FMT.ALIGNMENT_HALIGN.write(SCO_HALIGN.HALIGN_CENTER) + FMT.ALIGNEMENT_VALIGN.write(SCO_VALIGN.VALIGN_CENTER) ) class Cell: def __init__( self, text: str = None, signature: int = base_signature, comment: str = None ): self.text = text self.signature = signature or base_signature self.comment = comment def format(self, FMT: FMT, value=None): self.signature = FMT.composante.write(self.signature, value) def make_cell(self, worksheet: ScoExcelSheet): cell = worksheet.make_cell(self.text or "") style: Sco_Style = FMT.ALL.get_style(self.signature) style.apply(cell) return cell