Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change TMS-mode switching to make it less prone to bugs #840

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions invesalius/control.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
16 changes: 9 additions & 7 deletions invesalius/gui/default_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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"]
Expand Down
5 changes: 5 additions & 0 deletions invesalius/navigation/tracker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
Loading