mirror of https://gitlab.com/pamhyr/pamhyr2
GeoTIFF: Fix plot display where geotiff is deleted and fix update propagation.
parent
d47dc0687e
commit
624ae826eb
|
|
@ -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")
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Reference in New Issue