mirror of https://gitlab.com/pamhyr/pamhyr2
BC, LC: Forbidden duplicate window.
parent
289c8ed129
commit
94a0a96659
|
|
@ -71,7 +71,7 @@ class EditBoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self._title = (
|
self._title = (
|
||||||
_translate("Edit boundary condition", self._title) +
|
_translate("Edit boundary condition", self._title) +
|
||||||
f" - {self._study.name} " +
|
f" - {self._study.name} " +
|
||||||
f" - {self._data.name} " +
|
f" - {self._data.name} ({self._data.id}) " +
|
||||||
f"({long_types[self._data.bctype]} - {node_name})"
|
f"({long_types[self._data.bctype]} - {node_name})"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ logger = logging.getLogger()
|
||||||
|
|
||||||
class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
def __init__(self, title="Boundary conditions", study=None, parent=None):
|
def __init__(self, title="Boundary conditions", study=None, parent=None):
|
||||||
title = title + " - " + study.name
|
self._title = title + " - " + study.name
|
||||||
|
|
||||||
super(BoundaryConditionWindow, self).__init__(
|
super(BoundaryConditionWindow, self).__init__(
|
||||||
name=title, ui="BoundaryConditions", parent=parent
|
name=title, ui="BoundaryConditions", parent=parent
|
||||||
|
|
@ -79,7 +79,7 @@ class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self.setup_graph()
|
self.setup_graph()
|
||||||
self.setup_connections()
|
self.setup_connections()
|
||||||
|
|
||||||
self.ui.setWindowTitle(title)
|
self.ui.setWindowTitle(self._title)
|
||||||
|
|
||||||
def setup_sc(self):
|
def setup_sc(self):
|
||||||
self._undo_stack = QUndoStack()
|
self._undo_stack = QUndoStack()
|
||||||
|
|
@ -220,9 +220,17 @@ class BoundaryConditionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
tab = self.current_tab()
|
tab = self.current_tab()
|
||||||
rows = self.index_selected_rows()
|
rows = self.index_selected_rows()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
win = EditBoundaryConditionWindow(
|
win = self.sub_win_filter_first(
|
||||||
data=self._bcs.get(tab, row),
|
"Edit boundary condition",
|
||||||
study=self._study,
|
contain = [f"({self._bcs.get(tab, row).id})"]
|
||||||
parent=self
|
|
||||||
)
|
)
|
||||||
win.show()
|
|
||||||
|
if win is None:
|
||||||
|
win = EditBoundaryConditionWindow(
|
||||||
|
data=self._bcs.get(tab, row),
|
||||||
|
study=self._study,
|
||||||
|
parent=self
|
||||||
|
)
|
||||||
|
win.show()
|
||||||
|
else:
|
||||||
|
win.activateWindow()
|
||||||
|
|
|
||||||
|
|
@ -45,7 +45,7 @@ from View.LateralContribution.Edit.Plot import Plot
|
||||||
_translate = QCoreApplication.translate
|
_translate = QCoreApplication.translate
|
||||||
|
|
||||||
class EditLateralContributionWindow(ASubMainWindow, ListedSubWindow):
|
class EditLateralContributionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
def __init__(self, title="Edit lateral conditribution",
|
def __init__(self, title="Edit lateral contribution",
|
||||||
data=None, study=None, parent=None):
|
data=None, study=None, parent=None):
|
||||||
self._data = data
|
self._data = data
|
||||||
self._study = study
|
self._study = study
|
||||||
|
|
@ -54,7 +54,7 @@ class EditLateralContributionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self.compute_title()
|
self.compute_title()
|
||||||
|
|
||||||
super(EditLateralContributionWindow, self).__init__(
|
super(EditLateralContributionWindow, self).__init__(
|
||||||
name=self._title, ui="EditLateralContribution", parent=parent
|
name=title, ui="EditLateralContribution", parent=parent
|
||||||
)
|
)
|
||||||
|
|
||||||
self.ui.setWindowTitle(self._title)
|
self.ui.setWindowTitle(self._title)
|
||||||
|
|
@ -69,9 +69,9 @@ class EditLateralContributionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
edge_name = (self._data.edge.name if self._data.edge is not None
|
edge_name = (self._data.edge.name if self._data.edge is not None
|
||||||
else _translate("LateralContribution", "Not associate"))
|
else _translate("LateralContribution", "Not associate"))
|
||||||
self._title = (
|
self._title = (
|
||||||
_translate("Edit Lateral contribution", self._title) +
|
_translate("Edit lateral contribution", self._title) +
|
||||||
f" - {self._study.name} " +
|
f" - {self._study.name} " +
|
||||||
f" - {self._data.name} " +
|
f" - {self._data.name} ({self._data.id}) " +
|
||||||
f"({long_types[self._data.lctype]} - {edge_name})"
|
f"({long_types[self._data.lctype]} - {edge_name})"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ logger = logging.getLogger()
|
||||||
|
|
||||||
class LateralContributionWindow(ASubMainWindow, ListedSubWindow):
|
class LateralContributionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
def __init__(self, title="Lateral contribution", study=None, parent=None):
|
def __init__(self, title="Lateral contribution", study=None, parent=None):
|
||||||
title = title + " - " + study.name
|
self._title = title + " - " + study.name
|
||||||
|
|
||||||
super(LateralContributionWindow, self).__init__(
|
super(LateralContributionWindow, self).__init__(
|
||||||
name=title, ui="LateralContributions", parent=parent
|
name=title, ui="LateralContributions", parent=parent
|
||||||
|
|
@ -79,7 +79,7 @@ class LateralContributionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
self.setup_graph()
|
self.setup_graph()
|
||||||
self.setup_connections()
|
self.setup_connections()
|
||||||
|
|
||||||
self.ui.setWindowTitle(title)
|
self.ui.setWindowTitle(self._title)
|
||||||
|
|
||||||
def setup_sc(self):
|
def setup_sc(self):
|
||||||
self._undo_stack = QUndoStack()
|
self._undo_stack = QUndoStack()
|
||||||
|
|
@ -266,9 +266,17 @@ class LateralContributionWindow(ASubMainWindow, ListedSubWindow):
|
||||||
tab = self.current_tab()
|
tab = self.current_tab()
|
||||||
rows = self.index_selected_rows()
|
rows = self.index_selected_rows()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
win = EditLateralContributionWindow(
|
win = self.sub_win_filter_first(
|
||||||
data=self._lcs.get(tab, row),
|
"Edit lateral contribution",
|
||||||
study=self._study,
|
contain = [f"({self._lcs.get(tab, row).id})"]
|
||||||
parent=self
|
|
||||||
)
|
)
|
||||||
win.show()
|
|
||||||
|
if win is None:
|
||||||
|
win = EditLateralContributionWindow(
|
||||||
|
data=self._lcs.get(tab, row),
|
||||||
|
study=self._study,
|
||||||
|
parent=self
|
||||||
|
)
|
||||||
|
win.show()
|
||||||
|
else:
|
||||||
|
win.activateWindow()
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@ class ListedSubWindow(object):
|
||||||
return next(
|
return next(
|
||||||
filter(
|
filter(
|
||||||
lambda n: (
|
lambda n: (
|
||||||
(n[0] == name) and
|
(name in n[0]) and
|
||||||
reduce(
|
reduce(
|
||||||
lambda acc, c: acc and (c in n[1]._title),
|
lambda acc, c: acc and (c in n[1]._title),
|
||||||
contain,
|
contain,
|
||||||
|
|
|
||||||
|
|
@ -461,7 +461,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
contain = [self.model.river.current_reach().name]
|
contain = [self.model.river.current_reach().name]
|
||||||
)
|
)
|
||||||
|
|
||||||
if geometry == None:
|
if geometry is None:
|
||||||
geometry = GeometryWindow(model=self.model, parent=self)
|
geometry = GeometryWindow(model=self.model, parent=self)
|
||||||
geometry.show()
|
geometry.show()
|
||||||
else:
|
else:
|
||||||
|
|
@ -470,12 +470,28 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||||
self.msg_select_reach()
|
self.msg_select_reach()
|
||||||
|
|
||||||
def open_boundary_cond(self):
|
def open_boundary_cond(self):
|
||||||
bound = BoundaryConditionWindow(study = self.model, parent = self)
|
bound = self.sub_win_filter_first(
|
||||||
bound.show()
|
"Boundary conditions",
|
||||||
|
contain = []
|
||||||
|
)
|
||||||
|
|
||||||
|
if bound is None:
|
||||||
|
bound = BoundaryConditionWindow(study = self.model, parent = self)
|
||||||
|
bound.show()
|
||||||
|
else:
|
||||||
|
bound.activateWindow()
|
||||||
|
|
||||||
def open_lateral_contrib(self):
|
def open_lateral_contrib(self):
|
||||||
lateral = LateralContributionWindow(study = self.model, parent = self)
|
lateral = self.sub_win_filter_first(
|
||||||
lateral.show()
|
"Lateral contribution",
|
||||||
|
contain = []
|
||||||
|
)
|
||||||
|
|
||||||
|
if lateral is None:
|
||||||
|
lateral = LateralContributionWindow(study = self.model, parent = self)
|
||||||
|
lateral.show()
|
||||||
|
else:
|
||||||
|
lateral.activateWindow()
|
||||||
|
|
||||||
def open_stricklers(self):
|
def open_stricklers(self):
|
||||||
strick = StricklersWindow(
|
strick = StricklersWindow(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue