Lbasara commited on
Commit
e19c6e1
·
1 Parent(s): 7c640f7

Traduction FileDropper

Browse files
Files changed (2) hide show
  1. CHANGELOG.md +18 -0
  2. tableur.py +40 -14
CHANGELOG.md CHANGED
@@ -6,6 +6,24 @@ The format is based on [Keep a Changelog],
6
  and this project adheres to [Semantic Versioning].
7
 
8
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9
  ## [0.2.1] - 2025-10-10
10
 
11
  ### Added
 
6
  and this project adheres to [Semantic Versioning].
7
 
8
 
9
+ ## [0.2.2] - 2025-10-16
10
+
11
+ ### Added
12
+
13
+ ### Changed
14
+ * Refacto : tableur est dans un fichier externe
15
+ * FileDropper traduit en français
16
+
17
+ ### Deprecated
18
+
19
+ ### Removed
20
+
21
+ ### Fixed
22
+
23
+ ### Security
24
+
25
+
26
+
27
  ## [0.2.1] - 2025-10-10
28
 
29
  ### Added
tableur.py CHANGED
@@ -1,28 +1,48 @@
1
- import os
2
 
3
- import json
4
- import requests
5
- import folium
6
- import colorcet as cc
7
- import shapely
8
  import numpy as np
9
- import plotly.express as px
10
  import dateparser
11
  import panel as pn
12
  import pandas as pd
13
- import geopandas as gpd
14
- import openrouteservice as ors
15
 
16
- from time import sleep
17
- from dotenv import load_dotenv
18
  from bokeh.models.widgets.tables import DateFormatter
19
  from io import BytesIO, StringIO
20
- from vrp import calcul_routes
21
  from datetime import timedelta
22
 
23
 
24
 
25
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  class Tableur():
27
  def __init__(self, idx_offset=0, delivery_tab=None):
28
  self.delivery_tab=delivery_tab
@@ -39,7 +59,8 @@ class Tableur():
39
  widths={'arrivée_max': 160},
40
  page_size=50,
41
  )
42
- self.file_dropper = pn.widgets.FileDropper(accepted_filetypes=list(self.dmime.values()))
 
43
  self.bouton=pn.widgets.Button(name='Lancer calculs', button_type='primary', on_click=self.lancer_calculs)
44
 
45
  self.file_dropper.param.watch(self.update_dataframes, 'value')
@@ -99,6 +120,11 @@ class Tableur():
99
 
100
 
101
  def get_panel(self):
102
- return pn.Column(pn.Row(self.file_dropper, self.feuille, self.ecole_col, self.adr_col, self.bouton, height=100),
 
 
 
 
 
103
  self.tabd
104
  )
 
 
1
 
 
 
 
 
 
2
  import numpy as np
3
+
4
  import dateparser
5
  import panel as pn
6
  import pandas as pd
 
 
7
 
 
 
8
  from bokeh.models.widgets.tables import DateFormatter
9
  from io import BytesIO, StringIO
 
10
  from datetime import timedelta
11
 
12
 
13
 
14
 
15
+
16
+ def frenchdrop(dropper: pn.widgets.FileDropper):
17
+ """Example of a FileDropper with French labels via JS injection."""
18
+ js_locale = r"""
19
+ (function(){
20
+ function setFrenchLabels() {
21
+ if (window.FilePond) {
22
+ FilePond.setOptions({
23
+ labelIdle: 'Glissez-déposez un fichier ou <span class="filepond--label-action">Parcourez</span>',
24
+ labelFileProcessing: 'Téléversement en cours',
25
+ labelFileProcessingComplete: 'Téléversement terminé',
26
+ labelFileProcessingAborted: 'Téléversement annulé',
27
+ labelFileProcessingError: 'Erreur pendant le téléversement',
28
+ labelTapToCancel: 'Appuyez pour annuler',
29
+ labelTapToRetry: 'Appuyez pour réessayer',
30
+ labelTapToUndo: 'Appuyez pour annuler',
31
+ labelFileLoading: 'Chargement...',
32
+ labelFileLoadError: 'Erreur de chargement',
33
+ labelFileProcessingRevertError: 'Erreur d’annulation'
34
+ });
35
+ console.log("✅ FilePond traduit en français !");
36
+ } else {
37
+ setTimeout(setFrenchLabels, 200);
38
+ }
39
+ }
40
+ setFrenchLabels();
41
+ })();
42
+ """
43
+ return pn.Column(dropper, pn.pane.HTML(f"<script>{js_locale}</script>"))
44
+
45
+
46
  class Tableur():
47
  def __init__(self, idx_offset=0, delivery_tab=None):
48
  self.delivery_tab=delivery_tab
 
59
  widths={'arrivée_max': 160},
60
  page_size=50,
61
  )
62
+ self.file_dropper = pn.widgets.FileDropper(name="Importer un fichier",
63
+ accepted_filetypes=list(self.dmime.values()))
64
  self.bouton=pn.widgets.Button(name='Lancer calculs', button_type='primary', on_click=self.lancer_calculs)
65
 
66
  self.file_dropper.param.watch(self.update_dataframes, 'value')
 
120
 
121
 
122
  def get_panel(self):
123
+ return pn.Column(pn.Row(frenchdrop(self.file_dropper),
124
+ self.feuille,
125
+ self.ecole_col,
126
+ self.adr_col,
127
+ self.bouton,
128
+ height=100),
129
  self.tabd
130
  )