mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
BC, LC: Fix sub window open.
This commit is contained in:
1 parent
f074e1fdf2
commit
e395f9f575
7 files changed
+73
-93
No files matched your search
+16
-40
@@ -480,30 +480,6 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
# SUBWINDOW #
|
||||
#############
|
||||
|
||||
def _sub_window_exists(self, cls,
|
||||
data=None):
|
||||
"""Check if window already exists
|
||||
|
||||
Check if window already exists, used to deni window open
|
||||
duplication
|
||||
|
||||
Args:
|
||||
cls: Window class, must inerit to PamhyrWindow or
|
||||
PamhyrDialog
|
||||
data: Data used for hash computation of cls
|
||||
|
||||
Returns:
|
||||
The window if hash already exists on sub window dictionary,
|
||||
otherelse None
|
||||
"""
|
||||
hash = cls._hash(data)
|
||||
if self.sub_win_exists(hash):
|
||||
win = self.get_sub_win(hash)
|
||||
win.activateWindow()
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
|
||||
def open_configure(self):
|
||||
"""Open configure window
|
||||
|
||||
@@ -512,7 +488,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
Returns:
|
||||
Nothing
|
||||
"""
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
ConfigureWindow,
|
||||
data=[None, self.conf]
|
||||
):
|
||||
@@ -529,7 +505,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
Returns:
|
||||
Nothing
|
||||
"""
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
AboutWindow,
|
||||
data=[None, None]
|
||||
):
|
||||
@@ -563,7 +539,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
Nothing
|
||||
"""
|
||||
if self._study is None:
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
NewStudyWindow,
|
||||
data=[None, None]
|
||||
):
|
||||
@@ -579,7 +555,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
Nothing
|
||||
"""
|
||||
if self._study is not None:
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
NewStudyWindow,
|
||||
data=[self._study, None]
|
||||
):
|
||||
@@ -595,7 +571,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
Nothing
|
||||
"""
|
||||
if self._study is not None:
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
NetworkWindow,
|
||||
data=[self._study, None]
|
||||
):
|
||||
@@ -613,7 +589,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
if (self._study is not None and self._study.river.has_current_reach()):
|
||||
reach = self._study.river.current_reach().reach
|
||||
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
GeometryWindow,
|
||||
data=[self._study, self.conf, reach]
|
||||
):
|
||||
@@ -630,7 +606,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
self.msg_select_reach()
|
||||
|
||||
def open_boundary_cond(self):
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
BoundaryConditionWindow,
|
||||
data=[self._study, None]
|
||||
):
|
||||
@@ -640,7 +616,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
bound.show()
|
||||
|
||||
def open_lateral_contrib(self):
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
LateralContributionWindow,
|
||||
data=[self._study, None]
|
||||
):
|
||||
@@ -650,7 +626,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
lateral.show()
|
||||
|
||||
def open_stricklers(self):
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
StricklersWindow,
|
||||
data=[self._study, self.conf]
|
||||
):
|
||||
@@ -668,7 +644,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
if self._study.river.has_current_reach():
|
||||
reach = self._study.river.current_reach()
|
||||
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
FrictionsWindow,
|
||||
data=[self._study, None, reach]
|
||||
):
|
||||
@@ -686,7 +662,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
if self._study.river.has_current_reach():
|
||||
reach = self._study.river.current_reach()
|
||||
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
InitialConditionsWindow,
|
||||
data=[self._study, self.conf, reach]
|
||||
):
|
||||
@@ -703,7 +679,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
self.msg_select_reach()
|
||||
|
||||
def open_solver_parameters(self):
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
SolverParametersWindow,
|
||||
data=[self._study, None]
|
||||
):
|
||||
@@ -716,7 +692,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
params.show()
|
||||
|
||||
def open_sediment_layers(self):
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
SedimentLayersWindow,
|
||||
data=[self._study, None]
|
||||
):
|
||||
@@ -731,7 +707,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
def open_reach_sediment_layers(self):
|
||||
reach = self._study.river.current_reach().reach
|
||||
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
ReachSedimentLayersWindow,
|
||||
data=[self._study, None, reach]
|
||||
):
|
||||
@@ -756,7 +732,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
if run.exec():
|
||||
solver = run.solver
|
||||
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
CheckListWindow,
|
||||
data=[
|
||||
self._study,
|
||||
@@ -793,7 +769,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit):
|
||||
return
|
||||
|
||||
# Windows already opened
|
||||
if self._sub_window_exists(
|
||||
if self.sub_window_exists(
|
||||
ResultsWindow,
|
||||
data=[
|
||||
self._study,
|
||||
|
||||
Reference in new issue
Block a user