diff --git a/invesalius/control.py b/invesalius/control.py index e81fe446a..98ee89366 100644 --- a/invesalius/control.py +++ b/invesalius/control.py @@ -122,8 +122,6 @@ def __bind_events(self) -> None: Publisher.subscribe(self.disable_mask_preview, "Disable mask 3D preview") Publisher.subscribe(self.update_mask_preview, "Update mask 3D preview") - Publisher.subscribe(self.LoadProject, "Load project data") - def SetBitmapSpacing(self, spacing: Tuple[float, float, float]) -> None: proj = prj.Project() proj.spacing = spacing diff --git a/invesalius/gui/default_tasks.py b/invesalius/gui/default_tasks.py index 1d28ee52f..7495de522 100644 --- a/invesalius/gui/default_tasks.py +++ b/invesalius/gui/default_tasks.py @@ -138,24 +138,27 @@ def __bind_events(self): Publisher.subscribe(self.SetNavigationMode, "Set navigation mode") def SetNavigationMode(self, status): - self.navigation_mode_status = status session = ses.Session() + Publisher.sendMessage("Close Project") + project_status = session.GetConfig("project_status") + if project_status != const.PROJECT_STATUS_CLOSED: + Publisher.sendMessage("Update Navigation Mode MenuBar") + return + if status: session.SetConfig("mode", const.MODE_NAVIGATOR) else: Publisher.sendMessage("Hide target button") session.SetConfig("mode", const.MODE_RP) + Publisher.sendMessage("Disconnect tracker") + self.gbs.Hide(self.uppertaskpanel) + wx.GetApp().ProcessPendingEvents() self.uppertaskpanel.Destroy() self.uppertaskpanel = UpperTaskPanel(self) self.gbs.Add(self.uppertaskpanel, (0, 0), flag=wx.EXPAND) self.Layout() self.Refresh() - project_status = session.GetConfig("project_status") - if project_status != const.PROJECT_STATUS_CLOSED: - Publisher.sendMessage("Load project data") - Publisher.sendMessage("Enable state project", state=True) - # Lower fold panel class LowerTaskPanel(wx.Panel): @@ -355,7 +358,6 @@ def __bind_events(self): Publisher.subscribe(self.OnFoldSurface, "Fold surface task") Publisher.subscribe(self.OnFoldExport, "Fold export task") Publisher.subscribe(self.OnEnableState, "Enable state project") - # Publisher.subscribe(self.SetNavigationMode, "Set navigation mode") def OnOverwrite(self, surface_parameters): self.overwrite = surface_parameters["options"]["overwrite"] diff --git a/invesalius/navigation/tracker.py b/invesalius/navigation/tracker.py index b5d290711..46facc1e0 100644 --- a/invesalius/navigation/tracker.py +++ b/invesalius/navigation/tracker.py @@ -51,8 +51,13 @@ def __init__(self): self.TrackerCoordinates = dco.TrackerCoordinates() + self.__bind_events() + self.LoadState() + def __bind_events(self): + Publisher.subscribe(self.DisconnectTracker, 'Disconnect tracker') + def SaveState(self): tracker_id = self.tracker_id tracker_fiducials = self.tracker_fiducials.tolist()