mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
GeoTIFF: Fix plot display where geotiff is deleted and fix update propagation.
This commit is contained in:
1 parent
d47dc0687e
commit
624ae826eb
2 files changed
+17
-5
No files matched your search
@@ -22,6 +22,8 @@ from PyQt5.QtWidgets import (
|
|||||||
QAction, QListView, QVBoxLayout,
|
QAction, QListView, QVBoxLayout,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
from Modules import Modules
|
||||||
|
|
||||||
from View.Tools.PamhyrWindow import PamhyrWindow
|
from View.Tools.PamhyrWindow import PamhyrWindow
|
||||||
|
|
||||||
from View.GeoTIFF.List import ListModel
|
from View.GeoTIFF.List import ListModel
|
||||||
@@ -80,10 +82,10 @@ class GeoTIFFListWindow(PamhyrWindow):
|
|||||||
def setup_graph(self):
|
def setup_graph(self):
|
||||||
self.canvas = MplCanvas(width=5, height=4, dpi=100)
|
self.canvas = MplCanvas(width=5, height=4, dpi=100)
|
||||||
self.canvas.setObjectName("canvas")
|
self.canvas.setObjectName("canvas")
|
||||||
self.plot_layout = self.find(QVBoxLayout, "verticalLayout")
|
self._plot_layout = self.find(QVBoxLayout, "verticalLayout")
|
||||||
self.plot_layout.addWidget(self.canvas)
|
self._plot_layout.addWidget(self.canvas)
|
||||||
|
|
||||||
self.plot = PlotXY(
|
self._plot = PlotXY(
|
||||||
canvas=self.canvas,
|
canvas=self.canvas,
|
||||||
data=self._study.river.enable_edges(),
|
data=self._study.river.enable_edges(),
|
||||||
geotiff=self._study.river.geotiff,
|
geotiff=self._study.river.geotiff,
|
||||||
@@ -92,7 +94,7 @@ class GeoTIFFListWindow(PamhyrWindow):
|
|||||||
parent=self
|
parent=self
|
||||||
)
|
)
|
||||||
|
|
||||||
self.plot.update()
|
self._plot.update()
|
||||||
|
|
||||||
def setup_connections(self):
|
def setup_connections(self):
|
||||||
if self._study.is_editable():
|
if self._study.is_editable():
|
||||||
@@ -101,8 +103,15 @@ class GeoTIFFListWindow(PamhyrWindow):
|
|||||||
|
|
||||||
self.find(QAction, "action_edit").triggered.connect(self.edit)
|
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):
|
def update(self):
|
||||||
self._list.update()
|
self._list.update()
|
||||||
|
self._plot.update()
|
||||||
|
|
||||||
def selected_rows(self):
|
def selected_rows(self):
|
||||||
lst = self.find(QListView, f"listView")
|
lst = self.find(QListView, f"listView")
|
||||||
|
|||||||
+4
-1
@@ -146,9 +146,12 @@ class PlotXY(PamhyrPlot):
|
|||||||
self._plot_img = {}
|
self._plot_img = {}
|
||||||
|
|
||||||
for geotiff in lst:
|
for geotiff in lst:
|
||||||
|
if geotiff.is_deleted():
|
||||||
|
continue
|
||||||
|
|
||||||
memfile = geotiff.memfile
|
memfile = geotiff.memfile
|
||||||
if memfile is None:
|
if memfile is None:
|
||||||
return
|
continue
|
||||||
|
|
||||||
with memfile.open() as gt:
|
with memfile.open() as gt:
|
||||||
img = gt.read()
|
img = gt.read()
|
||||||
|
|||||||
Reference in new issue
Block a user