Commit 72952604017e3a284b45bd71877f896a8deb72d2

Authored by Victor Hugo Souza
Committed by GitHub
2 parents d450b91b 4b0bf479
Exists in master

Merge pull request #398 from rmatsuda/minor_coordinates_and_markers_fix

FIX: minor coordinates and markers bugs
invesalius/data/coordinates.py
@@ -19,7 +19,6 @@ @@ -19,7 +19,6 @@
19 19
20 from math import sin, cos 20 from math import sin, cos
21 import numpy as np 21 import numpy as np
22 -import queue  
23 import threading 22 import threading
24 import wx 23 import wx
25 24
@@ -35,11 +34,14 @@ class TrackerCoordinates(): @@ -35,11 +34,14 @@ class TrackerCoordinates():
35 def __init__(self): 34 def __init__(self):
36 self.coord = None 35 self.coord = None
37 self.markers_flag = [False, False, False] 36 self.markers_flag = [False, False, False]
  37 + self.previous_markers_flag = self.markers_flag
38 38
39 def SetCoordinates(self, coord, markers_flag): 39 def SetCoordinates(self, coord, markers_flag):
40 self.coord = coord 40 self.coord = coord
41 self.markers_flag = markers_flag 41 self.markers_flag = markers_flag
42 - wx.CallAfter(Publisher.sendMessage, 'Sensors ID', markers_flag=self.markers_flag) 42 + if self.previous_markers_flag != self.markers_flag:
  43 + wx.CallAfter(Publisher.sendMessage, 'Sensors ID', markers_flag=self.markers_flag)
  44 + self.previous_markers_flag = self.markers_flag
43 45
44 def GetCoordinates(self): 46 def GetCoordinates(self):
45 return self.coord, self.markers_flag 47 return self.coord, self.markers_flag
@@ -232,7 +234,7 @@ def PolhemusCoord(trck, trck_id, ref_mode): @@ -232,7 +234,7 @@ def PolhemusCoord(trck, trck_id, ref_mode):
232 elif trck[1] == 'wrapper': 234 elif trck[1] == 'wrapper':
233 coord = PolhemusWrapperCoord(trck[0], trck_id, ref_mode) 235 coord = PolhemusWrapperCoord(trck[0], trck_id, ref_mode)
234 236
235 - return coord, None 237 + return coord, [False, False, False]
236 238
237 239
238 def PolhemusWrapperCoord(trck, trck_id, ref_mode): 240 def PolhemusWrapperCoord(trck, trck_id, ref_mode):
invesalius/gui/dialogs.py
@@ -4691,7 +4691,8 @@ class SetNDIconfigs(wx.Dialog): @@ -4691,7 +4691,8 @@ class SetNDIconfigs(wx.Dialog):
4691 btn_ok = wx.Button(self, wx.ID_OK) 4691 btn_ok = wx.Button(self, wx.ID_OK)
4692 btn_ok.SetHelpText("") 4692 btn_ok.SetHelpText("")
4693 btn_ok.SetDefault() 4693 btn_ok.SetDefault()
4694 - btn_ok.Enable(False) 4694 + if not port_selec:
  4695 + btn_ok.Enable(False)
4695 self.btn_ok = btn_ok 4696 self.btn_ok = btn_ok
4696 4697
4697 btn_cancel = wx.Button(self, wx.ID_CANCEL) 4698 btn_cancel = wx.Button(self, wx.ID_CANCEL)
invesalius/gui/task_navigator.py
@@ -1379,7 +1379,7 @@ class MarkersPanel(wx.Panel): @@ -1379,7 +1379,7 @@ class MarkersPanel(wx.Panel):
1379 1379
1380 next = self.lc.GetFirstSelected() 1380 next = self.lc.GetFirstSelected()
1381 1381
1382 - while next is not None: 1382 + while next != -1:
1383 selection.append(next) 1383 selection.append(next)
1384 next = self.lc.GetNextSelected(next) 1384 next = self.lc.GetNextSelected(next)
1385 1385
@@ -1566,8 +1566,9 @@ class MarkersPanel(wx.Panel): @@ -1566,8 +1566,9 @@ class MarkersPanel(wx.Panel):
1566 if index: 1566 if index:
1567 if self.__find_target_marker() in index: 1567 if self.__find_target_marker() in index:
1568 Publisher.sendMessage('Disable or enable coil tracker', status=False) 1568 Publisher.sendMessage('Disable or enable coil tracker', status=False)
1569 - Publisher.sendMessage('Robot target matrix', robot_tracker_flag=False,  
1570 - m_change_robot_to_head=None) 1569 + if self.tracker.tracker_id == const.ROBOT:
  1570 + Publisher.sendMessage('Robot target matrix', robot_tracker_flag=False,
  1571 + m_change_robot_to_head=[])
1571 wx.MessageBox(_("Target deleted."), _("InVesalius 3")) 1572 wx.MessageBox(_("Target deleted."), _("InVesalius 3"))
1572 1573
1573 self.__delete_multiple_markers(index) 1574 self.__delete_multiple_markers(index)