Commit 5dc2aeadcdf3b4f18bced3f05a1b17221ff53c1c

Authored by Renan
Committed by Thiago Franco de Moraes
1 parent 82be8627
Exists in master

Fixed pubsub for neuronavigation (#144)

* Fix pubsub for navigation

* Fix pubsub for navigation PATRIOT trigger

* Fix pubsub for navigation delete marker
invesalius/data/trigger.py
@@ -52,7 +52,7 @@ class Trigger(threading.Thread): @@ -52,7 +52,7 @@ class Trigger(threading.Thread):
52 def __bind_events(self): 52 def __bind_events(self):
53 Publisher.subscribe(self.OnStylusPLH, 'PLH Stylus Button On') 53 Publisher.subscribe(self.OnStylusPLH, 'PLH Stylus Button On')
54 54
55 - def OnStylusPLH(self, pubsuv_evt): 55 + def OnStylusPLH(self):
56 self.stylusplh = True 56 self.stylusplh = True
57 57
58 def stop(self): 58 def stop(self):
invesalius/gui/task_navigator.py
@@ -239,21 +239,23 @@ class InnerFoldPanel(wx.Panel): @@ -239,21 +239,23 @@ class InnerFoldPanel(wx.Panel):
239 Publisher.sendMessage('Update trigger state', trigger_state=ctrl.GetValue()) 239 Publisher.sendMessage('Update trigger state', trigger_state=ctrl.GetValue())
240 240
241 def OnShowObject(self, evt=None, flag=None, obj_name=None): 241 def OnShowObject(self, evt=None, flag=None, obj_name=None):
242 - if flag:  
243 - self.checkobj.Enable(True)  
244 - self.track_obj = True  
245 - Publisher.sendMessage('Status target button', status=True)  
246 - else:  
247 - self.checkobj.Enable(False)  
248 - self.checkobj.SetValue(False)  
249 - self.track_obj = False  
250 - Publisher.sendMessage('Status target button', status=False) 242 + if not evt:
  243 + if flag:
  244 + self.checkobj.Enable(True)
  245 + self.track_obj = True
  246 + Publisher.sendMessage('Status target button', status=True)
  247 + else:
  248 + self.checkobj.Enable(False)
  249 + self.checkobj.SetValue(False)
  250 + self.track_obj = False
  251 + Publisher.sendMessage('Status target button', status=False)
251 252
252 Publisher.sendMessage('Update show object state', state=self.checkobj.GetValue()) 253 Publisher.sendMessage('Update show object state', state=self.checkobj.GetValue())
253 254
254 def OnVolumeCamera(self, evt=None, target_mode=None): 255 def OnVolumeCamera(self, evt=None, target_mode=None):
255 - if target_mode is True:  
256 - self.checkcamera.SetValue(0) 256 + if not evt:
  257 + if target_mode is True:
  258 + self.checkcamera.SetValue(0)
257 Publisher.sendMessage('Update volume camera state', camera_state=self.checkcamera.GetValue()) 259 Publisher.sendMessage('Update volume camera state', camera_state=self.checkcamera.GetValue())
258 260
259 261
@@ -860,7 +862,7 @@ class ObjectRegistrationPanel(wx.Panel): @@ -860,7 +862,7 @@ class ObjectRegistrationPanel(wx.Panel):
860 self.btn_load.Enable(1) 862 self.btn_load.Enable(1)
861 if self.obj_fiducials is not None: 863 if self.obj_fiducials is not None:
862 self.checktrack.Enable(1) 864 self.checktrack.Enable(1)
863 - Publisher.sendMessage('Enable target button', True) 865 + #Publisher.sendMessage('Enable target button', True)
864 866
865 def OnSelectAngleThreshold(self, evt, ctrl): 867 def OnSelectAngleThreshold(self, evt, ctrl):
866 Publisher.sendMessage('Update angle threshold', angle=ctrl.GetValue()) 868 Publisher.sendMessage('Update angle threshold', angle=ctrl.GetValue())
@@ -1121,7 +1123,7 @@ class MarkersPanel(wx.Panel): @@ -1121,7 +1123,7 @@ class MarkersPanel(wx.Panel):
1121 self.tgt_index = self.lc.GetFocusedItem() 1123 self.tgt_index = self.lc.GetFocusedItem()
1122 self.lc.SetItemBackgroundColour(self.tgt_index, 'RED') 1124 self.lc.SetItemBackgroundColour(self.tgt_index, 'RED')
1123 1125
1124 - Publisher.sendMessage('Update target', coord=self.list_coord[self.tgt_index]) 1126 + Publisher.sendMessage('Update target', coord=self.list_coord[self.tgt_index][:6])
1125 Publisher.sendMessage('Set target transparency', status=True, index=self.tgt_index) 1127 Publisher.sendMessage('Set target transparency', status=True, index=self.tgt_index)
1126 Publisher.sendMessage('Disable or enable coil tracker', status=True) 1128 Publisher.sendMessage('Disable or enable coil tracker', status=True)
1127 self.OnMenuEditMarkerId('TARGET') 1129 self.OnMenuEditMarkerId('TARGET')
@@ -1152,7 +1154,7 @@ class MarkersPanel(wx.Panel): @@ -1152,7 +1154,7 @@ class MarkersPanel(wx.Panel):
1152 # OnDeleteSingleMarker is used for both pubsub and button click events 1154 # OnDeleteSingleMarker is used for both pubsub and button click events
1153 # Pubsub is used for fiducial handle and button click for all others 1155 # Pubsub is used for fiducial handle and button click for all others
1154 1156
1155 - if marker_id is not None: 1157 + if not evt:
1156 if self.lc.GetItemCount(): 1158 if self.lc.GetItemCount():
1157 for id_n in range(self.lc.GetItemCount()): 1159 for id_n in range(self.lc.GetItemCount()):
1158 item = self.lc.GetItem(id_n, 4) 1160 item = self.lc.GetItem(id_n, 4)