From 624ae826ebcd34401673a2287943512bfddb669a Mon Sep 17 00:00:00 2001 From: Pierre-Antoine Rouby Date: Mon, 17 Nov 2025 10:08:06 +0100 Subject: [PATCH] GeoTIFF: Fix plot display where geotiff is deleted and fix update propagation. --- src/View/GeoTIFF/Window.py | 17 +++++++++++++---- src/View/PlotXY.py | 5 ++++- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/View/GeoTIFF/Window.py b/src/View/GeoTIFF/Window.py index 1a924ecf..630b3981 100644 --- a/src/View/GeoTIFF/Window.py +++ b/src/View/GeoTIFF/Window.py @@ -22,6 +22,8 @@ from PyQt5.QtWidgets import ( QAction, QListView, QVBoxLayout, ) +from Modules import Modules + from View.Tools.PamhyrWindow import PamhyrWindow from View.GeoTIFF.List import ListModel @@ -80,10 +82,10 @@ class GeoTIFFListWindow(PamhyrWindow): def setup_graph(self): self.canvas = MplCanvas(width=5, height=4, dpi=100) self.canvas.setObjectName("canvas") - self.plot_layout = self.find(QVBoxLayout, "verticalLayout") - self.plot_layout.addWidget(self.canvas) + self._plot_layout = self.find(QVBoxLayout, "verticalLayout") + self._plot_layout.addWidget(self.canvas) - self.plot = PlotXY( + self._plot = PlotXY( canvas=self.canvas, data=self._study.river.enable_edges(), geotiff=self._study.river.geotiff, @@ -92,7 +94,7 @@ class GeoTIFFListWindow(PamhyrWindow): parent=self ) - self.plot.update() + self._plot.update() def setup_connections(self): if self._study.is_editable(): @@ -101,8 +103,15 @@ class GeoTIFFListWindow(PamhyrWindow): self.find(QAction, "action_edit").triggered.connect(self.edit) + def _propagated_update(self, key=Modules(0)): + if Modules.GEOMETRY not in key and Modules.GEOTIFF not in key: + return + + self.update() + def update(self): self._list.update() + self._plot.update() def selected_rows(self): lst = self.find(QListView, f"listView") diff --git a/src/View/PlotXY.py b/src/View/PlotXY.py index 32f9d523..a62ecb4d 100644 --- a/src/View/PlotXY.py +++ b/src/View/PlotXY.py @@ -146,9 +146,12 @@ class PlotXY(PamhyrPlot): self._plot_img = {} for geotiff in lst: + if geotiff.is_deleted(): + continue + memfile = geotiff.memfile if memfile is None: - return + continue with memfile.open() as gt: img = gt.read()