From 8bd92fd7134e810bd34c593a0a7814e451b96d4d Mon Sep 17 00:00:00 2001
From: Emmanuel Viennet <emmanuel.viennet@gmail.com>
Date: Thu, 20 Feb 2025 16:15:31 +0100
Subject: [PATCH] Code cleaning

---
 app/scodoc/sco_excel.py | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/app/scodoc/sco_excel.py b/app/scodoc/sco_excel.py
index 0b049752..a9a696d5 100644
--- a/app/scodoc/sco_excel.py
+++ b/app/scodoc/sco_excel.py
@@ -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 [
-- 
GitLab