mirror of https://gitlab.com/pamhyr/pamhyr2
Ensembles: Open Ensemble windows from scenarios.
parent
3b83377f3c
commit
876780a349
|
|
@ -62,8 +62,8 @@ class EnsemblesWindow(PamhyrWindow):
|
|||
self._ensembles = ensembles
|
||||
|
||||
name = (
|
||||
trad[self._pamhyr_name] + " - "
|
||||
+ study.name
|
||||
trad[self._pamhyr_name] + " - " +
|
||||
study.name
|
||||
)
|
||||
|
||||
super(EnsemblesWindow, self).__init__(
|
||||
|
|
|
|||
|
|
@ -66,6 +66,7 @@ from View.Configure.Window import ConfigureWindow
|
|||
from View.Study.Window import NewStudyWindow
|
||||
from View.About.Window import AboutWindow
|
||||
from View.Scenarios.Window import ScenariosWindow
|
||||
from View.Ensembles.Window import EnsemblesWindow
|
||||
from View.Network.Window import NetworkWindow
|
||||
from View.Geometry.Window import GeometryWindow
|
||||
from View.BoundaryCondition.Window import BoundaryConditionWindow
|
||||
|
|
@ -1222,6 +1223,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
"""
|
||||
if self._study is None:
|
||||
return
|
||||
|
||||
if self._study.filename is None or self._study.filename == "":
|
||||
self.message_box(
|
||||
window_title=self._trad["Warning"],
|
||||
|
|
@ -1255,6 +1257,29 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
|||
self.scenarios = ScenariosWindow(study=self._study, parent=self)
|
||||
self.scenarios.show()
|
||||
|
||||
def open_ensemble_scenario(self):
|
||||
"""Open ensemble scenario window
|
||||
|
||||
Returns:
|
||||
Nothing
|
||||
"""
|
||||
if self._study is None:
|
||||
return
|
||||
|
||||
if self.sub_window_exists(
|
||||
EnsemblesWindow,
|
||||
data=[self._study, self.conf]
|
||||
):
|
||||
return
|
||||
|
||||
ensemble = EnsemblesWindow(
|
||||
ensembles=self._study.river._ensembles,
|
||||
study=self._study,
|
||||
config=self.conf,
|
||||
parent=self
|
||||
)
|
||||
ensemble.show()
|
||||
|
||||
def open_geometry(self):
|
||||
"""Open geometry window
|
||||
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ class ScenarioMenu(AbstractMenu):
|
|||
duplicate = None
|
||||
delete = None
|
||||
ensemble = None
|
||||
edit_ens = None
|
||||
|
||||
if item.scenario.id != 0:
|
||||
if scenarios.is_leaf(item.scenario):
|
||||
|
|
@ -84,6 +85,11 @@ class ScenarioMenu(AbstractMenu):
|
|||
self._trad["menu_ens_scenario"]
|
||||
)
|
||||
|
||||
if item.scenario.is_ensemble():
|
||||
edit_ens = self._menu.addAction(
|
||||
self._trad["menu_edit_ens_scenario"]
|
||||
)
|
||||
|
||||
action = self._exec()
|
||||
if action is None:
|
||||
return
|
||||
|
|
@ -95,3 +101,5 @@ class ScenarioMenu(AbstractMenu):
|
|||
self._parent.duplicate_scenario(item)
|
||||
elif action == ensemble:
|
||||
self._parent.create_ensemble_scenario(item)
|
||||
elif action == edit_ens:
|
||||
self._parent.edit_ensemble_scenario(item)
|
||||
|
|
|
|||
|
|
@ -550,6 +550,11 @@ class GraphWidget(QGraphicsView):
|
|||
self.exec_with_waiting_window(fn, "create_ensemble_scenario")
|
||||
self.changeScenario.emit(self.sender())
|
||||
|
||||
def edit_ensemble_scenario(self, item):
|
||||
self.parent\
|
||||
.parent\
|
||||
.open_ensemble_scenario()
|
||||
|
||||
def _close_other_window(self):
|
||||
self.parent\
|
||||
.parent\
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@ class ScenariosTranslate(MainTranslate):
|
|||
self._dict["menu_ens_scenario"] = _translate(
|
||||
"Scenarios", "Create ensemble scenario from this scenario"
|
||||
)
|
||||
self._dict["menu_edit_ens_scenario"] = _translate(
|
||||
"Scenarios", "Edit this ensemble scenario"
|
||||
)
|
||||
|
||||
self._sub_dict["table_headers_scenarios"] = {
|
||||
# "id": self._dict['id'],
|
||||
|
|
|
|||
Loading…
Reference in New Issue