Code cleaning

This commit is contained in:
Emmanuel Viennet 2025-02-20 16:15:31 +01:00
parent 8ddab219e1
commit 8bd92fd713

View File

@ -53,6 +53,7 @@ from app.scodoc import notesdb, sco_preferences
class COLORS(Enum):
"Couleurs de base pour les styles excel"
BLACK = "FF000000"
WHITE = "FFFFFFFF"
RED = "FFFF0000"
@ -382,24 +383,20 @@ class ScoExcelSheet:
# recopie des styles
if style is None:
style = self.default_style
if "font" in style:
cell.font = style["font"]
if "alignment" in style:
cell.alignment = style["alignment"]
if "border" in style:
cell.border = style["border"]
if "fill" in style:
cell.fill = style["fill"]
if "font" in style:
cell.font = style["font"]
if "number_format" in style:
cell.number_format = style["number_format"]
if "fill" in style:
cell.fill = style["fill"]
if "alignment" in style:
cell.alignment = style["alignment"]
if not comment is None:
if comment is not None:
cell.comment = Comment(comment, "scodoc")
lines = comment.splitlines()
cell.comment.width = 7 * max([len(line) for line in lines]) if lines else 7
cell.comment.width = 7 * max(len(line) for line in lines) if lines else 7
cell.comment.height = 20 * len(lines) if lines else 20
# test datatype to overwrite datetime format
@ -415,7 +412,7 @@ class ScoExcelSheet:
def make_row(self, values: list, style=None, comments=None) -> list:
"build a row"
# TODO make possible differents styles in a row
# TODO allow differents styles in a row
if comments is None:
comments = [None] * len(values)
return [