Skip to content

Commit

Permalink
used mainwindow instead of parent
Browse files Browse the repository at this point in the history
  • Loading branch information
ReimarBauer committed Oct 5, 2024
1 parent 9082188 commit c77a75a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
7 changes: 4 additions & 3 deletions mslib/msui/linearview.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class MSUILinearViewWindow(MSUIMplViewWindow, ui.Ui_LinearWindow):
vtime_vals = QtCore.pyqtSignal([list])
itemSecs_selected = QtCore.pyqtSignal(str)

def __init__(self, parent=None, model=None, _id=None, config_settings=None, tutorial_mode=False):
def __init__(self, parent=None, mainwindow=None, model=None, _id=None, config_settings=None, tutorial_mode=False):
"""
Set up user interface, connect signal/slots.
"""
Expand Down Expand Up @@ -115,8 +115,9 @@ def __init__(self, parent=None, model=None, _id=None, config_settings=None, tuto

# Connect slots and signals.
# ==========================

parent.refresh_signal_connect.connect(self.refresh_signal_send.emit)
# ToDo review 2026 after EOL of Win 10 if we can use parent again
if mainwindow is not None:
mainwindow.refresh_signal_connect.connect(self.refresh_signal_send.emit)

# Tool opener.
self.cbTools.currentIndexChanged.connect(lambda ind: self.openTool(
Expand Down
8 changes: 4 additions & 4 deletions mslib/msui/msui_mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,7 @@ def create_view(self, _type, model):
view_window = None
if _type == "topview":
# Top view.
view_window = topview.MSUITopViewWindow(parent=self, mainwindow=self, model=model,
view_window = topview.MSUITopViewWindow(mainwindow=self, model=model,
active_flighttrack=self.active_flight_track,
mscolab_server_url=self.mscolab.mscolab_server_url,
token=self.mscolab.token, tutorial_mode=self.tutorial_mode,
Expand All @@ -945,7 +945,7 @@ def create_view(self, _type, model):
view_window.mpl.setFixedSize(layout['topview'][0], layout['topview'][1])
elif _type == "sideview":
# Side view.
view_window = sideview.MSUISideViewWindow(model=model, tutorial_mode=self.tutorial_mode, parent=self,
view_window = sideview.MSUISideViewWindow(mainwindow=self, model=model, tutorial_mode=self.tutorial_mode,
config_settings=self.config_for_gui)
view_window.refresh_signal_emit.connect(self.refresh_signal_connect.emit)
view_window.mpl.resize(layout['sideview'][0], layout['sideview'][1])
Expand All @@ -957,8 +957,8 @@ def create_view(self, _type, model):
view_window.centralwidget.resize(layout['tableview'][0], layout['tableview'][1])
elif _type == "linearview":
# Linear view.
view_window = linearview.MSUILinearViewWindow(model=model, tutorial_mode=self.tutorial_mode,
parent=self, config_settings=self.config_for_gui)
view_window = linearview.MSUILinearViewWindow(mainwindow=self, model=model, tutorial_mode=self.tutorial_mode,
config_settings=self.config_for_gui)
view_window.refresh_signal_emit.connect(self.refresh_signal_connect.emit)
view_window.mpl.resize(layout['linearview'][0], layout['linearview'][1])
if layout["immutable"]:
Expand Down
7 changes: 4 additions & 3 deletions mslib/msui/sideview.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ class MSUISideViewWindow(MSUIMplViewWindow, ui.Ui_SideViewWindow):
vtime_vals = QtCore.pyqtSignal([list])
itemSecs_selected = QtCore.pyqtSignal(str)

def __init__(self, parent=None, model=None, _id=None, config_settings=None, tutorial_mode=False):
def __init__(self, parent=None, mainwindow=None, model=None, _id=None, config_settings=None, tutorial_mode=False):
"""
Set up user interface, connect signal/slots.
"""
Expand Down Expand Up @@ -288,8 +288,9 @@ def __init__(self, parent=None, model=None, _id=None, config_settings=None, tuto

# Connect slots and signals.
# ==========================

parent.refresh_signal_connect.connect(self.refresh_signal_send.emit)
# ToDo review 2026 after EOL of Win 10 if we can use parent again
if mainwindow is not None:
mainwindow.refresh_signal_connect.connect(self.refresh_signal_send.emit)

# Buttons to set sideview options.
self.btOptions.clicked.connect(self.open_settings_dialog)
Expand Down
8 changes: 5 additions & 3 deletions mslib/msui/topview.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ def __init__(self, parent=None, mainwindow=None, model=None, _id=None,
logging.debug(_id)
self.settings_tag = "topview"
self.tutorial_mode = tutorial_mode
# ToDo review 2026 after EOL of Win 10 if we can use parent again
self.mainwindow_signal_login_mscolab = mainwindow.signal_login_mscolab
self.mainwindow_signal_logout_mscolab = mainwindow.signal_logout_mscolab
self.mainwindow_signal_listFlighttrack_doubleClicked = mainwindow.signal_listFlighttrack_doubleClicked
Expand Down Expand Up @@ -249,8 +250,9 @@ def __init__(self, parent=None, mainwindow=None, model=None, _id=None,

# Connect slots and signals.
# ==========================

parent.refresh_signal_connect.connect(self.refresh_signal_send.emit)
# ToDo review 2026 after EOL of Win 10 if we can use parent again
if mainwindow is not None:
mainwindow.refresh_signal_connect.connect(self.refresh_signal_send.emit)

# Map controls.
self.btMapRedraw.clicked.connect(self.mpl.canvas.redraw_map)
Expand All @@ -264,7 +266,7 @@ def __init__(self, parent=None, mainwindow=None, model=None, _id=None,

# Tool opener.
self.cbTools.currentIndexChanged.connect(lambda ind: self.openTool(
index=ind, parent=parent, config_settings=config_settings))
index=ind, parent=mainwindow, config_settings=config_settings))

if mainwindow is not None:
# Update flighttrack
Expand Down

0 comments on commit c77a75a

Please sign in to comment.