From 8d8987ee15a27193387470842a84c3986f1b3009 Mon Sep 17 00:00:00 2001 From: "pierre.gauthier" Date: Thu, 20 Feb 2025 09:02:57 +0100 Subject: [PATCH] Feat : Visual improvement and some useless data suppression for error report --- dory_sort_out.py | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/dory_sort_out.py b/dory_sort_out.py index dc0ff14..571bd06 100644 --- a/dory_sort_out.py +++ b/dory_sort_out.py @@ -203,39 +203,35 @@ def error_report(file_data,folder_data): Crée le rapport d'utilisation du script """ #Couleur rouge - error_color =PatternFill(patternType='solid',fgColor='00FF0000') + error_color = PatternFill(patternType='solid',fgColor='00cb4335') + column_name_color = PatternFill(patternType='solid',fgColor='0085929e') + row_color = PatternFill(patternType='solid',fgColor='00ccd1d1') report = xls.Workbook() report_worsheet = report.active report_worsheet.title = "Compte rendu" - report_worsheet['A1'] = "Fichiers trouvés" - report_worsheet['B1'] = "Occurences" - report_worsheet['F1'] = "Dossiers" - report_worsheet['G1'] = "Fichiers contenus" + report_worsheet['B1'] = "Dossiers" + report_worsheet['C1'] = "NB Fichiers" + report_worsheet['D1'] = "Rapport d'erreur" - report_worsheet.column_dimensions['A'].width *= 3 report_worsheet.column_dimensions['B'].width *= 3 - report_worsheet.column_dimensions['F'].width *= 3 - report_worsheet.column_dimensions['G'].width *= 3 - report_worsheet.column_dimensions['H'].width *= 3 + report_worsheet.column_dimensions['C'].width *= 3 + report_worsheet.column_dimensions['D'].width *= 3 - currrent_cell = 2 - for key in file_data: - report_worsheet['A'+ str(currrent_cell)] = key - report_worsheet['B'+ str(currrent_cell)] = file_data.get(key) - currrent_cell+=1 + report_worsheet['B1'].fill = report_worsheet['C1'].fill = report_worsheet['D1'].fill = column_name_color currrent_cell = 2 for i, content in enumerate(folder_data): - report_worsheet['F'+ str(currrent_cell)] = FOLDERNAMES[i] - report_worsheet['G'+ str(currrent_cell)] = content + report_worsheet['B'+ str(currrent_cell)] = FOLDERNAMES[i] + report_worsheet['C'+ str(currrent_cell)] = content + if i % 2 == 0: + report_worsheet['B'+ str(currrent_cell)].fill = report_worsheet['C'+ str(currrent_cell)].fill = report_worsheet['D'+ str(currrent_cell)].fill = row_color + if content == 0: - report_worsheet['H'+ str(currrent_cell)] = "/!\\ aucun fichier dans le dossier /!\\" - report_worsheet['H'+ str(currrent_cell)].fill = error_color + report_worsheet['D'+ str(currrent_cell)] = "/!\\ aucun fichier dans le dossier /!\\" + report_worsheet['D'+ str(currrent_cell)].fill = error_color currrent_cell+=1 - report_worsheet['A'+str(3 + len(file_data.keys()))] = "Total fichiers" - report_worsheet['B'+str(3 + len(file_data.keys()))] = '=SUM(B2:B' + str(1 + len(file_data.keys())) + ')' report.save("Rapport.xlsx") def sortout(): @@ -255,7 +251,6 @@ def sortout(): is_plu = answer == 1 if confirm_choice("PLU" if answer == 1 else "PLUi"): break - # On demande le numero INSEE ou SIREN tant que l'input est invalide while True: