river, network: Minor fix and change.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-04-05 15:26:14 +02:00
1 parent 150388af12
commit b6dbedf7fa
4 files changed
+49 -13

No files matched your search

+15 -5
View File
@@ -13,6 +13,7 @@ from PyQt5.QtWidgets import (
)
from PyQt5.uic import loadUi
from View.ASubWindow import WindowToolKit
from View.ListedSubWindow import ListedSubWindow
from View.DummyWindow import DummyWindow
@@ -50,7 +51,7 @@ action = (
no_model_action + model_action + define_model_action
)
class ApplicationWindow(QMainWindow, ListedSubWindow):
class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
def __init__(self, conf=None):
super(ApplicationWindow, self).__init__()
@@ -193,7 +194,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow):
if self.model.filename == "":
file_name, _ = QFileDialog.getSaveFileName(
self, "Save File",
"", "Pamhyr(*.pkl)")
"", "Pamhyr(*.pkl)"
)
if file_name[-4:] == ".pkl":
self.model.filename = file_name
else:
@@ -212,7 +215,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow):
"""
file_name, _ = QFileDialog.getSaveFileName(
self, "Save File",
"", "Pamhyr(*.pkl)")
"", "Pamhyr(*.pkl)"
)
if file_name[-4:] == ".pkl":
self.model.filename = file_name
else:
@@ -301,9 +306,14 @@ class ApplicationWindow(QMainWindow, ListedSubWindow):
Returns:
Nothing
"""
if not self.model is None:
geometry = GeometryWindow(parent=self)
if (self.model is not None and
self.model.river.has_current_reach()):
geometry = GeometryWindow(model=self.model, parent=self)
geometry.show()
else:
self.message_box("Please select a reach",
"Geometry edition need a reach selected "
"into river network window to work on it")
# TODO: Delete me !
###############