mirror of https://gitlab.com/pamhyr/pamhyr2
MainWindow: Add BC short cut for sediment.
parent
a4c5d34720
commit
8466531916
|
|
@ -18,7 +18,7 @@
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
|
|
||||||
from tools import trace, timer
|
from tools import trace, timer, logger_exception
|
||||||
|
|
||||||
from View.Tools.PamhyrWindow import PamhyrWindow
|
from View.Tools.PamhyrWindow import PamhyrWindow
|
||||||
|
|
||||||
|
|
@ -37,6 +37,7 @@ from PyQt5.QtWidgets import (
|
||||||
QFileDialog, QTableView, QAbstractItemView,
|
QFileDialog, QTableView, QAbstractItemView,
|
||||||
QUndoStack, QShortcut, QAction, QItemDelegate,
|
QUndoStack, QShortcut, QAction, QItemDelegate,
|
||||||
QComboBox, QVBoxLayout, QHeaderView, QTabWidget,
|
QComboBox, QVBoxLayout, QHeaderView, QTabWidget,
|
||||||
|
QWidget,
|
||||||
)
|
)
|
||||||
|
|
||||||
from Model.BoundaryCondition.BoundaryConditionTypes import (
|
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):
|
def add(self):
|
||||||
tab = self.current_tab()
|
tab = self.current_tab()
|
||||||
rows = self.index_selected_rows()
|
rows = self.index_selected_rows()
|
||||||
|
|
|
||||||
|
|
@ -109,6 +109,7 @@ define_model_action = [
|
||||||
"action_menu_edit_reach_sediment_layers", "action_menu_edit_reservoirs",
|
"action_menu_edit_reach_sediment_layers", "action_menu_edit_reservoirs",
|
||||||
"action_menu_edit_hydraulic_structures",
|
"action_menu_edit_hydraulic_structures",
|
||||||
"action_menu_results_last", "action_open_results_from_file",
|
"action_menu_results_last", "action_open_results_from_file",
|
||||||
|
"action_menu_boundary_conditions_sediment",
|
||||||
]
|
]
|
||||||
|
|
||||||
action = (
|
action = (
|
||||||
|
|
@ -200,6 +201,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
"action_menu_edit_network": self.open_network,
|
"action_menu_edit_network": self.open_network,
|
||||||
"action_menu_edit_geometry": self.open_geometry,
|
"action_menu_edit_geometry": self.open_geometry,
|
||||||
"action_menu_boundary_conditions": self.open_boundary_cond,
|
"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_reservoirs": self.open_reservoir,
|
||||||
"action_menu_edit_hydraulic_structures":
|
"action_menu_edit_hydraulic_structures":
|
||||||
self.open_hydraulic_structures,
|
self.open_hydraulic_structures,
|
||||||
|
|
@ -764,15 +766,24 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
else:
|
else:
|
||||||
self.msg_select_reach()
|
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(
|
if self.sub_window_exists(
|
||||||
BoundaryConditionWindow,
|
BoundaryConditionWindow,
|
||||||
data=[self._study, None]
|
data=[self._study, None]
|
||||||
):
|
):
|
||||||
|
bound = self.get_sub_window(
|
||||||
|
BoundaryConditionWindow,
|
||||||
|
data=[self._study, None]
|
||||||
|
)
|
||||||
|
bound.set_active_tab(tab)
|
||||||
return
|
return
|
||||||
|
|
||||||
bound = BoundaryConditionWindow(study=self._study, parent=self)
|
bound = BoundaryConditionWindow(study=self._study, parent=self)
|
||||||
bound.show()
|
bound.show()
|
||||||
|
bound.set_active_tab(tab)
|
||||||
|
|
||||||
def open_reservoir(self):
|
def open_reservoir(self):
|
||||||
if self.sub_window_exists(
|
if self.sub_window_exists(
|
||||||
|
|
|
||||||
|
|
@ -83,6 +83,10 @@ class ListedSubWindow(object):
|
||||||
except Exception:
|
except Exception:
|
||||||
return None
|
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):
|
def sub_window_exists(self, cls, data=None):
|
||||||
"""Check if window already exists
|
"""Check if window already exists
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -176,6 +176,7 @@
|
||||||
<property name="title">
|
<property name="title">
|
||||||
<string>&Sediment</string>
|
<string>&Sediment</string>
|
||||||
</property>
|
</property>
|
||||||
|
<addaction name="action_menu_boundary_conditions_sediment"/>
|
||||||
<addaction name="action_menu_sediment_layers"/>
|
<addaction name="action_menu_sediment_layers"/>
|
||||||
<addaction name="action_menu_edit_reach_sediment_layers"/>
|
<addaction name="action_menu_edit_reach_sediment_layers"/>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
@ -957,6 +958,11 @@
|
||||||
<string>Open results from file</string>
|
<string>Open results from file</string>
|
||||||
</property>
|
</property>
|
||||||
</action>
|
</action>
|
||||||
|
<action name="action_menu_boundary_conditions_sediment">
|
||||||
|
<property name="text">
|
||||||
|
<string>Boundary conditions and punctual contributions</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<connections>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue