Docfile commited on
Commit
0f1ab6d
·
verified ·
1 Parent(s): a341c7a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -14
app.py CHANGED
@@ -176,6 +176,9 @@ class EvaluationGymnique:
176
  run.font.size = Pt(9)
177
 
178
  def creer_tableau_recapitulatif(self):
 
 
 
179
  note_table = self.document.add_table(rows=3, cols=13)
180
  note_table.style = 'Table Grid'
181
  note_table.alignment = WD_TABLE_ALIGNMENT.CENTER
@@ -256,13 +259,15 @@ class EvaluationGymnique:
256
  run.font.size = Pt(8)
257
 
258
  def ajouter_zone_note(self):
259
- # Ajout d'un paragraphe avec espace avant la zone de note
260
- self.document.add_paragraph().space_after = Pt(10)
261
 
 
262
  zone_note = self.document.add_table(rows=1, cols=2)
263
  zone_note.style = 'Table Grid'
264
- zone_note.alignment = WD_TABLE_ALIGNMENT.LEFT # Changé de RIGHT à LEFT pour déplacer vers la gauche
265
 
 
266
  cell_libelle = zone_note.cell(0, 0)
267
  cell_libelle.text = "Note finale"
268
  cell_libelle.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.RIGHT
@@ -271,28 +276,31 @@ class EvaluationGymnique:
271
  run.font.size = Pt(12)
272
  run.font.color.rgb = RGBColor(0, 32, 96)
273
 
 
274
  cell_saisie = zone_note.cell(0, 1)
275
- cell_saisie.width = Cm(1.5) # Largeur
276
- zone_note.rows[0].height = Cm(1.5) # Hauteur égale à la largeur pour forme carrée
 
 
 
277
  shading_elm = parse_xml(f'<w:shd {nsdecls("w")} w:fill="F2F2F2"/>')
278
  cell_saisie._tc.get_or_add_tcPr().append(shading_elm)
 
 
279
  cell_saisie.text = "/20"
280
  cell_saisie.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.CENTER
281
  run = cell_saisie.paragraphs[0].runs[0]
282
  run.bold = True
283
  run.font.size = Pt(12)
284
 
285
- # Ajout d'un espace après la zone de note
286
- self.document.add_paragraph().space_after = Pt(10)
287
 
288
  def ajouter_lignes_correcteurs(self):
289
- # Ajout d'un espace avant les lignes de correcteurs
290
- self.document.add_paragraph().space_after = Pt(10) # Ajoute un espace avant les correcteurs
291
-
292
  for role in ["Projet", "principal", "ROV"]:
293
  para = self.document.add_paragraph()
294
- para.space_before = Pt(2)
295
- para.space_after = Pt(10) # Augmenté de 2 à 10 pour créer plus d'espace entre les lignes
296
  run = para.add_run(f"Correcteur {role} : ")
297
  run.bold = True
298
  para.add_run(".................................................................")
@@ -324,13 +332,36 @@ class EvaluationGymnique:
324
  })
325
 
326
  def generer_document(self, nom_fichier="evaluation_gymnastique.docx"):
 
327
  self.ajouter_entete_colore()
 
 
328
  self.creer_tableau_elements()
 
 
329
  self.ajouter_note_jury()
330
- self.creer_tableau_recapitulatif()
331
- self.ajouter_zone_note() # Déplacé avant les lignes de correcteurs
 
 
 
332
  self.ajouter_lignes_correcteurs()
 
 
 
 
 
 
 
 
 
 
 
 
 
333
  self.ajouter_note_candidat_avec_cadre()
 
 
334
  self.document.save(nom_fichier)
335
  return nom_fichier
336
 
 
176
  run.font.size = Pt(9)
177
 
178
  def creer_tableau_recapitulatif(self):
179
+ # Ajouter un espace avant le tableau récapitulatif
180
+ self.document.add_paragraph().space_after = Pt(8)
181
+
182
  note_table = self.document.add_table(rows=3, cols=13)
183
  note_table.style = 'Table Grid'
184
  note_table.alignment = WD_TABLE_ALIGNMENT.CENTER
 
259
  run.font.size = Pt(8)
260
 
261
  def ajouter_zone_note(self):
262
+ # Créer un paragraphe pour l'espacement
263
+ self.document.add_paragraph().space_after = Pt(6)
264
 
265
+ # Créer le tableau pour la note finale
266
  zone_note = self.document.add_table(rows=1, cols=2)
267
  zone_note.style = 'Table Grid'
268
+ zone_note.alignment = WD_TABLE_ALIGNMENT.RIGHT
269
 
270
+ # Configurer la cellule du libellé
271
  cell_libelle = zone_note.cell(0, 0)
272
  cell_libelle.text = "Note finale"
273
  cell_libelle.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.RIGHT
 
276
  run.font.size = Pt(12)
277
  run.font.color.rgb = RGBColor(0, 32, 96)
278
 
279
+ # Configurer la cellule de saisie (format plus carré)
280
  cell_saisie = zone_note.cell(0, 1)
281
+ # Définir une largeur plus petite
282
+ cell_saisie.width = Cm(1)
283
+ zone_note.rows[0].height = Cm(1)
284
+
285
+ # Ajouter le fond gris
286
  shading_elm = parse_xml(f'<w:shd {nsdecls("w")} w:fill="F2F2F2"/>')
287
  cell_saisie._tc.get_or_add_tcPr().append(shading_elm)
288
+
289
+ # Ajouter le texte
290
  cell_saisie.text = "/20"
291
  cell_saisie.paragraphs[0].alignment = WD_ALIGN_PARAGRAPH.CENTER
292
  run = cell_saisie.paragraphs[0].runs[0]
293
  run.bold = True
294
  run.font.size = Pt(12)
295
 
296
+ # Ajouter un espacement après le tableau
297
+ self.document.add_paragraph()
298
 
299
  def ajouter_lignes_correcteurs(self):
 
 
 
300
  for role in ["Projet", "principal", "ROV"]:
301
  para = self.document.add_paragraph()
302
+ para.space_before = Pt(6) # Augmenter l'espace avant
303
+ para.space_after = Pt(6) # Augmenter l'espace après
304
  run = para.add_run(f"Correcteur {role} : ")
305
  run.bold = True
306
  para.add_run(".................................................................")
 
332
  })
333
 
334
  def generer_document(self, nom_fichier="evaluation_gymnastique.docx"):
335
+ # Génération de l'en-tête
336
  self.ajouter_entete_colore()
337
+
338
+ # Tableau des éléments techniques
339
  self.creer_tableau_elements()
340
+
341
+ # Note pour le jury
342
  self.ajouter_note_jury()
343
+
344
+ # Séparation avant les lignes de correcteurs
345
+ self.document.add_paragraph().space_after = Pt(6)
346
+
347
+ # Lignes des correcteurs
348
  self.ajouter_lignes_correcteurs()
349
+
350
+ # Séparation avant le tableau récapitulatif
351
+ para_espace = self.document.add_paragraph()
352
+ para_espace.space_before = Pt(10)
353
+ para_espace.space_after = Pt(10)
354
+
355
+ # Tableau récapitulatif
356
+ self.creer_tableau_recapitulatif()
357
+
358
+ # Zone de note finale
359
+ self.ajouter_zone_note()
360
+
361
+ # Note pour le candidat
362
  self.ajouter_note_candidat_avec_cadre()
363
+
364
+ # Sauvegarde du document
365
  self.document.save(nom_fichier)
366
  return nom_fichier
367