From 32535af3e6bb51664eca900655f109f4d0115a8b Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 22 Jun 2026 17:04:39 +0200 Subject: [PATCH] UpdateRK: avoid crash when updating RK with missing points on a section, warning message instead --- src/View/Geometry/Translate.py | 12 ++++ src/View/Geometry/Window.py | 23 +++++++ src/lang/fr.ts | 109 ++++++++++++++++++++++++--------- 3 files changed, 115 insertions(+), 29 deletions(-) diff --git a/src/View/Geometry/Translate.py b/src/View/Geometry/Translate.py index 3a2528af..879022eb 100644 --- a/src/View/Geometry/Translate.py +++ b/src/View/Geometry/Translate.py @@ -97,3 +97,15 @@ class GeometryTranslate(MainTranslate): self._dict["format_not_exportable"] = _translate( "Geometry", "The format of the file is not exportable." ) + self._dict["update_rk_error"] = _translate( + "Geometry", + "RK update can't be executed." + ) + self._dict["update_rk_empty_profiles"] = _translate( + "Geometry", + "Some profiles don't contain any point." + ) + self._dict["update_rk_empty_profiles_info"] = _translate( + "Geometry", + "Profiles concerned:" + ) diff --git a/src/View/Geometry/Window.py b/src/View/Geometry/Window.py index 2744c190..6eadc4d3 100644 --- a/src/View/Geometry/Window.py +++ b/src/View/Geometry/Window.py @@ -371,6 +371,29 @@ class GeometryWindow(PamhyrWindow): parent=self ) if dlg.exec(): + empty_profiles = [ + profile for profile in self._reach.profiles + if profile.number_points == 0 + ] + if empty_profiles: + profile_names = ", ".join( + profile.name or str(profile.num) + for profile in empty_profiles + ) + self.message_box( + ( + self._trad["update_rk_error"] + + "\n" + + self._trad["update_rk_empty_profiles"] + ), + ( + self._trad["update_rk_empty_profiles_info"] + + f" {profile_names}" + ), + window_title=self._trad["warning"] + ) + return + data = { "origin": dlg.origin, "directrices": [dlg.begin_dir, dlg.end_dir], diff --git a/src/lang/fr.ts b/src/lang/fr.ts index bce458b1..bd8a71bd 100644 --- a/src/lang/fr.ts +++ b/src/lang/fr.ts @@ -771,12 +771,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Dernière modification : - + X axis: Axe X : - + Y axis: Axe Y : @@ -943,12 +943,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Upstream height (m) - Cote à l'amont (m) + Cote à l'amont (m) Downstream height (m) - Cote à l'aval (m) + Cote à l'aval (m) @@ -991,7 +991,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Débit (m³/s) - + Pollutant: Polluant: @@ -1040,6 +1040,21 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Image coordinates Coordonnées de l'image + + + TextLabel + + + + + Upstream elevation (m) + + + + + Downstream elevation (m) + + Documentation @@ -1557,12 +1572,33 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Warning - Avertissement + Avertissement The format of the file is not exportable. - + Le format de fichier n'est pas exportable. + + + + RK update can't be executed +Some profiles don't contain any point. + La mise à jour du PK ne peut pas être exécutée\nDes profils ne contiennent aucun points. + + + + Profiles concerned: + Profils concernés: + + + + RK update can't be executed. + La mise à jour du PK ne peut pas être exécutée. + + + + Some profiles don't contain any point. + Des profils ne contiennent aucun points. @@ -1647,12 +1683,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Évaporation - + Start (m) PK de départ (m) - + End (m) PK de fin (m) @@ -1674,13 +1710,18 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Shapefile (*.LAT *.lat) - Shapefile (*.LAT *.lat) + Shapefile (*.LAT *.lat) - + All files (*) Tous les fichiers (*) + + + Mage lateral contributions file (*.LAT *.lat) + + LateralContributionAdisTS @@ -2858,32 +2899,32 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. AdisTS - + Output RK Pk de sortie - + Run AdisTS Lancer AdisTS - + Pollutants Polluants - + D90 D90 - + DIF DIF - + Open results AdisTS Ouvrir des résultats AdisTS @@ -3008,7 +3049,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Non - + Compare results Comparaison de résultats @@ -3168,7 +3209,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Editer l'arbre des scénarios - + GeoTIFF GeoTIFF @@ -3432,22 +3473,22 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Results - + days jours - + day jour - + X (m) X (m) - + Y (m) Y (m) @@ -3477,7 +3518,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Lecture des résultats - + Water elevation Cote de l'eau @@ -3487,12 +3528,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Cote maximum de l'eau - + Reach name Nom du bief - + Profile Profil @@ -3547,12 +3588,12 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. Masse min - + Variables names Noms des variables - + Pollutant name Nom des polluants @@ -3562,7 +3603,7 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. enveloppe - + Profile name Nom du profil @@ -3591,6 +3632,16 @@ Cette fonctionnalité nécessite un bief muni d'une géométrie. All files (*) Tous les fichiers (*) + + + An error occured when writing to file + + + + + If the file is in use, close it and try again + + Scenarios