2023-05-15 06:32:54 +02:00
|
|
|
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,
|
|
|
|
)
|
2023-05-09 07:32:49 +02:00
|
|
|
|
2023-05-15 06:32:54 +02:00
|
|
|
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)
|
|
|
|
)
|
2023-05-09 07:32:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
class Cell:
|
2023-05-15 06:32:54 +02:00
|
|
|
def __init__(
|
|
|
|
self, text: str = None, signature: int = base_signature, comment: str = None
|
|
|
|
):
|
2023-05-09 07:32:49 +02:00
|
|
|
self.text = text
|
2023-05-15 06:32:54 +02:00
|
|
|
self.signature = signature or base_signature
|
2023-05-09 07:32:49 +02:00
|
|
|
self.comment = comment
|
|
|
|
|
2023-05-15 06:32:54 +02:00
|
|
|
def format(self, FMT: FMT, value=None):
|
|
|
|
self.signature = FMT.composante.write(self.signature, value)
|
2023-05-09 07:32:49 +02:00
|
|
|
|
|
|
|
def make_cell(self, worksheet: ScoExcelSheet):
|
2023-05-15 06:32:54 +02:00
|
|
|
cell = worksheet.make_cell(self.text or "")
|
|
|
|
style: Sco_Style = FMT.ALL.get_style(self.signature)
|
|
|
|
style.apply(cell)
|
2023-05-09 07:32:49 +02:00
|
|
|
return cell
|