From a425c9a6ac8089ae264e891854af1e38a27c6ba4 Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Thu, 28 May 2026 15:01:36 +0200 Subject: [PATCH 1/9] BoundaryConditions: delete setter/getter duplicated for d50 and sigma --- .../BoundaryCondition/BoundaryCondition.py | 36 ------------------- 1 file changed, 36 deletions(-) diff --git a/src/Model/BoundaryCondition/BoundaryCondition.py b/src/Model/BoundaryCondition/BoundaryCondition.py index 433da557..fdc9c0a5 100644 --- a/src/Model/BoundaryCondition/BoundaryCondition.py +++ b/src/Model/BoundaryCondition/BoundaryCondition.py @@ -514,42 +514,6 @@ class BoundaryCondition(SQLSubModel): self._sigma = float(value) self.modified() - @property - def d50(self): - return self._d50 - - @d50.setter - def d50(self, value): - self._d50 = float(value) - self.modified() - - @property - def sigma(self): - return self._sigma - - @sigma.setter - def sigma(self, value): - self._sigma = float(value) - self.modified() - - @property - def d50(self): - return self._d50 - - @d50.setter - def d50(self, value): - self._d50 = float(value) - self.modified() - - @property - def sigma(self): - return self._sigma - - @sigma.setter - def sigma(self, value): - self._sigma = float(value) - self.modified() - @property def header(self): return self._header.copy() From c51c06e6ec5a64d2dac5f8e60f30d0761845b80b Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Thu, 28 May 2026 15:02:40 +0200 Subject: [PATCH 2/9] DB version: Upgrade to add enabled in pollutants db --- src/Model/Pollutants/Pollutants.py | 17 +++++++++++++++-- src/Model/Study.py | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/Model/Pollutants/Pollutants.py b/src/Model/Pollutants/Pollutants.py index 03136e74..89aac30d 100644 --- a/src/Model/Pollutants/Pollutants.py +++ b/src/Model/Pollutants/Pollutants.py @@ -354,6 +354,7 @@ class Pollutants(SQLSubModel): CREATE TABLE pollutants{ext}( {cls.create_db_add_pamhyr_id()}, deleted BOOLEAN NOT NULL DEFAULT FALSE, + enabled BOOLEAN NOT NULL DEFAULT TRUE, name TEXT NOT NULL, {Scenario.create_db_add_scenario()}, {Scenario.create_db_add_scenario_fk()} @@ -378,6 +379,14 @@ class Pollutants(SQLSubModel): if major == "0" and int(minor) < 2: if not created: cls._db_update_to_0_2_0(execute, data) + + if major == "0" and minor == "2": + if int(release) < 5: + execute(f"ALTER TABLE pollutants " + + f"ADD COLUMN enabled BOOLEAN NOT NULL DEFAULT TRUE") + + # cls._db_update_to_0_2_5(execute, data) + # # created = True if not created: return cls._update_submodel(execute, version, data) @@ -416,7 +425,7 @@ class Pollutants(SQLSubModel): return new table = execute( - "SELECT pamhyr_id, deleted, name, scenario FROM pollutants " + + "SELECT pamhyr_id, deleted, enabled, name, scenario FROM pollutants " + f"WHERE scenario = {scenario.id} " + f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))})" ) @@ -427,6 +436,7 @@ class Pollutants(SQLSubModel): pid = next(it) deleted = (next(it) == 1) + enabled = (next(it) == 1) name = next(it) owner_scenario = next(it) @@ -437,6 +447,8 @@ class Pollutants(SQLSubModel): ) if deleted: new_pollutant.set_as_deleted() + if not enabled: + new_pollutant.enabled = False data["pollutant"] = new_pollutant new_pollutant._data = PollutantCharacteristics._db_load( @@ -478,9 +490,10 @@ class Pollutants(SQLSubModel): execute( "INSERT INTO " + - "pollutants(pamhyr_id, deleted, name, scenario) " + + "pollutants(pamhyr_id, deleted, enabled, name, scenario) " + "VALUES (" + f"{self.id}, {self._db_format(self.is_deleted())}, " + + f"{self._db_format(self._enabled)}, " + f"'{self._db_format(self._name)}', " + f"{self._status.scenario_id}" + ")" diff --git a/src/Model/Study.py b/src/Model/Study.py index 9816dcd4..92028c67 100644 --- a/src/Model/Study.py +++ b/src/Model/Study.py @@ -46,7 +46,7 @@ logger = logging.getLogger() class Study(SQLModel): - _version = "0.2.4" + _version = "0.2.5" _sub_classes = [ Scenario, From 48d6728e1e1512b2910775dd618df22c87e74fa7 Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Thu, 28 May 2026 15:11:06 +0200 Subject: [PATCH 3/9] Enable pollutant: fix the list to browse to enable a pol --- src/View/Pollutants/Table.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/View/Pollutants/Table.py b/src/View/Pollutants/Table.py index 994f2089..f1de40dd 100644 --- a/src/View/Pollutants/Table.py +++ b/src/View/Pollutants/Table.py @@ -128,7 +128,7 @@ class TableModel(PamhyrTableModel): def enabled(self, row, enabled, parent=QModelIndex()): self._undo.push( SetEnabledCommand( - self._data._Pollutants, row, enabled + self._lst, row, enabled ) ) self.layoutChanged.emit() From 1d1a00a0ff6fbf41dee6737a64d1a10e6f7f88cf Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 22 Jun 2026 10:42:29 +0200 Subject: [PATCH 4/9] Pollutants: merge conflicts --- src/Model/Pollutants/Pollutants.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/Model/Pollutants/Pollutants.py b/src/Model/Pollutants/Pollutants.py index 5169dab9..50b498db 100644 --- a/src/Model/Pollutants/Pollutants.py +++ b/src/Model/Pollutants/Pollutants.py @@ -374,7 +374,6 @@ class Pollutants(SQLSubModel): cls._db_create(execute) created = True -<<<<<<< HEAD if major == "0" and int(minor) < 2: if not created: cls._db_update_to_0_2_0(execute, data) @@ -387,8 +386,6 @@ class Pollutants(SQLSubModel): # cls._db_update_to_0_2_5(execute, data) # # created = True -======= ->>>>>>> origin/scenarios if not created: return cls._update_submodel(execute, version, data) From 83680bbe5789dfbc38eb7c55147aedafe0af1bfc Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 22 Jun 2026 12:12:02 +0200 Subject: [PATCH 5/9] Pollutant: quickfix, back to previous version --- src/Model/Pollutants/Pollutants.py | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Model/Pollutants/Pollutants.py b/src/Model/Pollutants/Pollutants.py index 50b498db..79f2eb8b 100644 --- a/src/Model/Pollutants/Pollutants.py +++ b/src/Model/Pollutants/Pollutants.py @@ -374,10 +374,6 @@ class Pollutants(SQLSubModel): cls._db_create(execute) created = True - if major == "0" and int(minor) < 2: - if not created: - cls._db_update_to_0_2_0(execute, data) - if major == "0" and minor == "2": if int(release) < 5: execute(f"ALTER TABLE pollutants " + From 2d5455c09d745018addc98fd7d7d5faf67ed2be0 Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 22 Jun 2026 14:16:33 +0200 Subject: [PATCH 6/9] Meshing: Debug crashing case when divide by 0 --- src/Meshing/Internal.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Meshing/Internal.py b/src/Meshing/Internal.py index eacd04b4..c5999fb1 100644 --- a/src/Meshing/Internal.py +++ b/src/Meshing/Internal.py @@ -166,7 +166,6 @@ class InternalMeshing(AMeshingTool): for i in range(len1): ltot1 += sect1.point(start1+i).dist(sect1.point(start1+i+1)) alpha.append(ltot1) - alpha = list(map(lambda x: x/ltot1, alpha)) # target ratios for i in range(len2): ltot2 += sect2.point(start2+i).dist(sect2.point(start2+i+1)) beta.append(ltot2) @@ -181,6 +180,7 @@ class InternalMeshing(AMeshingTool): sect2.add_npoints(len1-len2) len2 = len1 else: # regular case + alpha = list(map(lambda x: x/ltot1, alpha)) # target ratios beta = list(map(lambda x: x/ltot2, beta)) # current ratios for i in range(len1 - len2): beta.append(1.0) From fa8948c1b6e9cfffa8eb53fe3b8cbb57533c963c Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 22 Jun 2026 15:18:08 +0200 Subject: [PATCH 7/9] Meshing: Debug error caused by index out of range when adding an empty transect on a reach --- src/View/Geometry/PlotAC.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/View/Geometry/PlotAC.py b/src/View/Geometry/PlotAC.py index 1b846c5b..9e7127d4 100644 --- a/src/View/Geometry/PlotAC.py +++ b/src/View/Geometry/PlotAC.py @@ -143,7 +143,7 @@ class PlotAC(PamhyrPlot): ] else: color = self.color_incomplete_gl[ - lincomplete.index(txt) + lincomplete.index(txt) % len(self.color_incomplete_gl) ] annotation = self.canvas.axes.annotate( From 32535af3e6bb51664eca900655f109f4d0115a8b Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 22 Jun 2026 17:04:39 +0200 Subject: [PATCH 8/9] 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 From f9a88a211c8fea43d6a9220f009cf2cc1688d954 Mon Sep 17 00:00:00 2001 From: Dylan Jeannin Date: Mon, 22 Jun 2026 17:10:57 +0200 Subject: [PATCH 9/9] Fix pep8 --- src/Model/Pollutants/Pollutants.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Model/Pollutants/Pollutants.py b/src/Model/Pollutants/Pollutants.py index 79f2eb8b..8603b313 100644 --- a/src/Model/Pollutants/Pollutants.py +++ b/src/Model/Pollutants/Pollutants.py @@ -419,7 +419,8 @@ class Pollutants(SQLSubModel): return new table = execute( - "SELECT pamhyr_id, deleted, enabled, name, scenario FROM pollutants " + + "SELECT pamhyr_id, deleted, enabled, name, scenario " + + "FROM pollutants " + f"WHERE scenario = {scenario.id} " + f"AND pamhyr_id NOT IN ({', '.join(map(str, loaded))})" )