mirror of
https://gitlab.com/pamhyr/pamhyr2.git
synced 2026-10-30 03:20:41 +01:00
pamhyr: Disable posibility to open multiple network window.
This commit is contained in:
1 parent
daa7ca867c
commit
631f06e7d6
2 files changed
+16
-1
No files matched your search
@@ -1,5 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from functools import reduce
|
||||||
|
|
||||||
class ListedSubWindow(object):
|
class ListedSubWindow(object):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super(ListedSubWindow, self).__init__()
|
super(ListedSubWindow, self).__init__()
|
||||||
@@ -26,3 +28,10 @@ class ListedSubWindow(object):
|
|||||||
)
|
)
|
||||||
self.sub_win_cnt = len(self.sub_win_list)
|
self.sub_win_cnt = len(self.sub_win_list)
|
||||||
print(f"- {name} ({self.sub_win_cnt})")
|
print(f"- {name} ({self.sub_win_cnt})")
|
||||||
|
|
||||||
|
def sub_win_exists(self, name):
|
||||||
|
return reduce(
|
||||||
|
lambda acc, n: (acc or (n[0] == name)),
|
||||||
|
self.sub_win_list,
|
||||||
|
False
|
||||||
|
)
|
||||||
@@ -289,11 +289,17 @@ class ApplicationWindow(QMainWindow, ListedSubWindow):
|
|||||||
Returns:
|
Returns:
|
||||||
Nothing
|
Nothing
|
||||||
"""
|
"""
|
||||||
if not self.model is None:
|
if (self.model is not None and
|
||||||
|
not self.sub_win_exists("River network")):
|
||||||
self.network = NetworkWindow(model=self.model, parent=self)
|
self.network = NetworkWindow(model=self.model, parent=self)
|
||||||
self.network.show()
|
self.network.show()
|
||||||
|
|
||||||
def open_geometry(self):
|
def open_geometry(self):
|
||||||
|
"""Open geometry window
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
Nothing
|
||||||
|
"""
|
||||||
if not self.model is None:
|
if not self.model is None:
|
||||||
geometry = GeometryWindow(parent=self)
|
geometry = GeometryWindow(parent=self)
|
||||||
geometry.show()
|
geometry.show()
|
||||||
|
|||||||
Reference in new issue
Block a user