Commit 0ff58d762b1f69f800e980df565b190a5a808884
1 parent
16728827
Exists in
master
ENH: Send target to robot just available when tracker is ROBOT
Showing
1 changed file
with
13 additions
and
8 deletions
Show diff stats
invesalius/gui/task_navigator.py
@@ -195,7 +195,7 @@ class InnerFoldPanel(wx.Panel): | @@ -195,7 +195,7 @@ class InnerFoldPanel(wx.Panel): | ||
195 | 195 | ||
196 | # Fold 3 - Markers panel | 196 | # Fold 3 - Markers panel |
197 | item = fold_panel.AddFoldPanel(_("Markers"), collapsed=True) | 197 | item = fold_panel.AddFoldPanel(_("Markers"), collapsed=True) |
198 | - mtw = MarkersPanel(item) | 198 | + mtw = MarkersPanel(item, tracker) |
199 | 199 | ||
200 | fold_panel.ApplyCaptionStyle(item, style) | 200 | fold_panel.ApplyCaptionStyle(item, style) |
201 | fold_panel.AddFoldPanelWindow(item, mtw, spacing= 0, | 201 | fold_panel.AddFoldPanelWindow(item, mtw, spacing= 0, |
@@ -1206,7 +1206,7 @@ class MarkersPanel(wx.Panel): | @@ -1206,7 +1206,7 @@ class MarkersPanel(wx.Panel): | ||
1206 | 1206 | ||
1207 | return res | 1207 | return res |
1208 | 1208 | ||
1209 | - def __init__(self, parent): | 1209 | + def __init__(self, parent, tracker): |
1210 | wx.Panel.__init__(self, parent) | 1210 | wx.Panel.__init__(self, parent) |
1211 | try: | 1211 | try: |
1212 | default_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENUBAR) | 1212 | default_colour = wx.SystemSettings.GetColour(wx.SYS_COLOUR_MENUBAR) |
@@ -1216,13 +1216,15 @@ class MarkersPanel(wx.Panel): | @@ -1216,13 +1216,15 @@ class MarkersPanel(wx.Panel): | ||
1216 | 1216 | ||
1217 | self.SetAutoLayout(1) | 1217 | self.SetAutoLayout(1) |
1218 | 1218 | ||
1219 | + self.tracker = tracker | ||
1220 | + | ||
1219 | self.__bind_events() | 1221 | self.__bind_events() |
1220 | 1222 | ||
1221 | self.current_coord = 0, 0, 0, 0, 0, 0 | 1223 | self.current_coord = 0, 0, 0, 0, 0, 0 |
1222 | self.current_angle = 0, 0, 0 | 1224 | self.current_angle = 0, 0, 0 |
1223 | self.current_seed = 0, 0, 0 | 1225 | self.current_seed = 0, 0, 0 |
1224 | self.markers = [] | 1226 | self.markers = [] |
1225 | - self.current_ref = 0, 0, 0, 0, 0, 0 | 1227 | + self.current_head = 0, 0, 0, 0, 0, 0 |
1226 | self.current_robot = 0, 0, 0, 0, 0, 0 | 1228 | self.current_robot = 0, 0, 0, 0, 0, 0 |
1227 | self.list_coord = [] | 1229 | self.list_coord = [] |
1228 | self.marker_ind = 0 | 1230 | self.marker_ind = 0 |
@@ -1434,9 +1436,12 @@ class MarkersPanel(wx.Panel): | @@ -1434,9 +1436,12 @@ class MarkersPanel(wx.Panel): | ||
1434 | target_menu = menu_id.Append(1, _('Set as target')) | 1436 | target_menu = menu_id.Append(1, _('Set as target')) |
1435 | menu_id.Bind(wx.EVT_MENU, self.OnMenuSetTarget, target_menu) | 1437 | menu_id.Bind(wx.EVT_MENU, self.OnMenuSetTarget, target_menu) |
1436 | menu_id.AppendSeparator() | 1438 | menu_id.AppendSeparator() |
1437 | - send_coord_robot = menu_id.Append(3, _('Send coord to robot')) | ||
1438 | - #menu_id.Bind(wx.EVT_MENU, self.OnContinuousSendCoord, send_coord_robot) | ||
1439 | - menu_id.Bind(wx.EVT_MENU, self.OnMenuSendCoord, send_coord_robot) | 1439 | + send_target_2_robot = menu_id.Append(3, _('Send target to robot')) |
1440 | + menu_id.Bind(wx.EVT_MENU, self.OnMenuSendTarget2Robot, send_target_2_robot) | ||
1441 | + if self.tracker.tracker_id == const.ROBOT: | ||
1442 | + send_target_2_robot.Enable(True) | ||
1443 | + else: | ||
1444 | + send_target_2_robot.Enable(False) | ||
1440 | # TODO: Create the remove target option so the user can disable the target without removing the marker | 1445 | # TODO: Create the remove target option so the user can disable the target without removing the marker |
1441 | # target_menu_rem = menu_id.Append(3, _('Remove target')) | 1446 | # target_menu_rem = menu_id.Append(3, _('Remove target')) |
1442 | # menu_id.Bind(wx.EVT_MENU, self.OnMenuRemoveTarget, target_menu_rem) | 1447 | # menu_id.Bind(wx.EVT_MENU, self.OnMenuRemoveTarget, target_menu_rem) |
@@ -1487,13 +1492,13 @@ class MarkersPanel(wx.Panel): | @@ -1487,13 +1492,13 @@ class MarkersPanel(wx.Panel): | ||
1487 | 1492 | ||
1488 | Publisher.sendMessage('Set new color', index=index, color=color_new) | 1493 | Publisher.sendMessage('Set new color', index=index, color=color_new) |
1489 | 1494 | ||
1490 | - def OnMenuSendCoord(self, evt): | 1495 | + def OnMenuSendTarget2Robot(self, evt): |
1491 | if isinstance(evt, int): | 1496 | if isinstance(evt, int): |
1492 | self.lc.Focus(evt) | 1497 | self.lc.Focus(evt) |
1493 | 1498 | ||
1494 | robot = self.markers[self.lc.GetFocusedItem()].robot | 1499 | robot = self.markers[self.lc.GetFocusedItem()].robot |
1495 | head = self.markers[self.lc.GetFocusedItem()].head | 1500 | head = self.markers[self.lc.GetFocusedItem()].head |
1496 | - print(robot) | 1501 | + |
1497 | # coord_target = self.list_coord[3] | 1502 | # coord_target = self.list_coord[3] |
1498 | # coord_home = self.list_coord[4] | 1503 | # coord_home = self.list_coord[4] |
1499 | # if self.flag_target: | 1504 | # if self.flag_target: |