Repository: 12rambau/sepal_ui

Issue:
avoid to force developer to set total each time
I should be able to init the progress of an Alert first and then simply update the progress. 

as in:

```python 
from sepal_ui import sepalwidgets as sw 

alert = sw.Alert()

# init 
alert.update_progress(0, "toto", total=10)

# loop
for i in range(10):
    alert.update_progress(i)
```

in the current implemetnation, total need to be set in every calls

Discussion:

Patch:
diff --git a/sepal_ui/sepalwidgets/alert.py b/sepal_ui/sepalwidgets/alert.py
index 19718f51..8dafab92 100644
--- a/sepal_ui/sepalwidgets/alert.py
+++ b/sepal_ui/sepalwidgets/alert.py
@@ -108,14 +108,17 @@ class Alert(v.Alert, SepalWidget):
         Args:
             progress: the progress status in float
             msg: The message to use before the progress bar
-            tqdm_args (optional): any arguments supported by a tqdm progress bar
+            tqdm_args (optional): any arguments supported by a tqdm progress bar, they will only be taken into account after a call to ``self.reset()``.
         """
         # show the alert
         self.show()
 
-        # cast the progress to float
-        total = tqdm_args.get("total", 1)
+        # cast the progress to float and perform sanity checks
         progress = float(progress)
+        if self.progress_output not in self.children:
+            total = tqdm_args.get("total", 1)
+        else:
+            total = self.progress_bar.total
         if not (0 <= progress <= total):
             raise ValueError(f"progress should be in [0, {total}], {progress} given")
 


Test patch:
diff --git a/tests/test_sepalwidgets/test_Alert.py b/tests/test_sepalwidgets/test_Alert.py
index 3f8de9a4..cac14ebb 100644
--- a/tests/test_sepalwidgets/test_Alert.py
+++ b/tests/test_sepalwidgets/test_Alert.py
@@ -175,7 +175,8 @@ def test_update_progress() -> None:
 
     # check that if total is set value can be more than 1
     alert.reset()
-    alert.update_progress(50, total=100)
+    alert.update_progress(0, total=100)
+    alert.update_progress(50)
     assert alert.progress_bar.n == 50
     assert alert.viz is True