diff --git a/src/View/BoundaryCondition/Window.py b/src/View/BoundaryCondition/Window.py
index 6377a739..f9ba4c13 100644
--- a/src/View/BoundaryCondition/Window.py
+++ b/src/View/BoundaryCondition/Window.py
@@ -18,7 +18,7 @@
import logging
-from tools import trace, timer
+from tools import trace, timer, logger_exception
from View.Tools.PamhyrWindow import PamhyrWindow
@@ -37,6 +37,7 @@ from PyQt5.QtWidgets import (
QFileDialog, QTableView, QAbstractItemView,
QUndoStack, QShortcut, QAction, QItemDelegate,
QComboBox, QVBoxLayout, QHeaderView, QTabWidget,
+ QWidget,
)
from Model.BoundaryCondition.BoundaryConditionTypes import (
@@ -170,6 +171,13 @@ class BoundaryConditionWindow(PamhyrWindow):
)
)
+ def set_active_tab(self, tab_id=0):
+ try:
+ tab_widget = self.find(QTabWidget, "tabWidget")
+ tab_widget.setCurrentIndex(tab_id)
+ except Exception as e:
+ logger_exception(e)
+
def add(self):
tab = self.current_tab()
rows = self.index_selected_rows()
diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py
index 45dfca3c..ff57e77a 100644
--- a/src/View/MainWindow.py
+++ b/src/View/MainWindow.py
@@ -109,6 +109,7 @@ define_model_action = [
"action_menu_edit_reach_sediment_layers", "action_menu_edit_reservoirs",
"action_menu_edit_hydraulic_structures",
"action_menu_results_last", "action_open_results_from_file",
+ "action_menu_boundary_conditions_sediment",
]
action = (
@@ -200,6 +201,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
"action_menu_edit_network": self.open_network,
"action_menu_edit_geometry": self.open_geometry,
"action_menu_boundary_conditions": self.open_boundary_cond,
+ "action_menu_boundary_conditions_sediment": self.open_boundary_cond_sed,
"action_menu_edit_reservoirs": self.open_reservoir,
"action_menu_edit_hydraulic_structures":
self.open_hydraulic_structures,
@@ -764,15 +766,24 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
else:
self.msg_select_reach()
- def open_boundary_cond(self):
+ def open_boundary_cond_sed(self):
+ self.open_boundary_cond(tab=1)
+
+ def open_boundary_cond(self, tab=0):
if self.sub_window_exists(
BoundaryConditionWindow,
data=[self._study, None]
):
+ bound = self.get_sub_window(
+ BoundaryConditionWindow,
+ data=[self._study, None]
+ )
+ bound.set_active_tab(tab)
return
bound = BoundaryConditionWindow(study=self._study, parent=self)
bound.show()
+ bound.set_active_tab(tab)
def open_reservoir(self):
if self.sub_window_exists(
diff --git a/src/View/Tools/ListedSubWindow.py b/src/View/Tools/ListedSubWindow.py
index d40e58dd..d369c782 100644
--- a/src/View/Tools/ListedSubWindow.py
+++ b/src/View/Tools/ListedSubWindow.py
@@ -83,6 +83,10 @@ class ListedSubWindow(object):
except Exception:
return None
+ def get_sub_window(self, cls, data=None):
+ hash = cls._hash(data)
+ return self.get_sub_win(hash)
+
def sub_window_exists(self, cls, data=None):
"""Check if window already exists
diff --git a/src/View/ui/MainWindow.ui b/src/View/ui/MainWindow.ui
index 0e47519f..2458faa2 100644
--- a/src/View/ui/MainWindow.ui
+++ b/src/View/ui/MainWindow.ui
@@ -176,6 +176,7 @@
&Sediment
+
@@ -957,6 +958,11 @@
Open results from file
+
+
+ Boundary conditions and punctual contributions
+
+