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