From bfb7466961ff928209afe4641c56f002373d6c06 Mon Sep 17 00:00:00 2001 From: Victor Hugo Souza Date: Mon, 10 Jun 2019 21:49:15 +0300 Subject: [PATCH] Update GUI defaults in navigation and improved functionalities (#196) --- invesalius/constants.py | 1 + invesalius/data/viewer_volume.py | 62 +++++++++++++++++++++++++++++++++++++++++++++++--------------- invesalius/gui/default_viewers.py | 2 ++ invesalius/gui/dialogs.py | 86 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++----------------------- invesalius/gui/task_navigator.py | 28 ++++++++++++++++------------ 5 files changed, 129 insertions(+), 50 deletions(-) diff --git a/invesalius/constants.py b/invesalius/constants.py index 6a2be89..82497ee 100644 --- a/invesalius/constants.py +++ b/invesalius/constants.py @@ -62,6 +62,7 @@ TEXT_SIZE_SMALL = 11 TEXT_SIZE = 12 TEXT_SIZE_LARGE = 16 TEXT_SIZE_EXTRA_LARGE = 20 +TEXT_SIZE_DIST_NAV = 32 TEXT_COLOUR = (1,1,1) (X,Y) = (0.03, 0.97) diff --git a/invesalius/data/viewer_volume.py b/invesalius/data/viewer_volume.py index dd7310e..842ca80 100644 --- a/invesalius/data/viewer_volume.py +++ b/invesalius/data/viewer_volume.py @@ -165,6 +165,7 @@ class Viewer(wx.Panel): self.obj_state = None self.obj_actor_list = None self.arrow_actor_list = None + #self.pTarget = [0., 0., 0.] # self.obj_axes = None @@ -623,6 +624,7 @@ class Viewer(wx.Panel): self.distthreshold = dist_threshold def ActivateTargetMode(self, evt=None, target_mode=None): + vtk_colors = vtk.vtkNamedColors() self.target_mode = target_mode if self.target_coord and self.target_mode: self.CreateTargetAim() @@ -646,21 +648,33 @@ class Viewer(wx.Panel): mapper = vtk.vtkPolyDataMapper() mapper.SetInputData(normals.GetOutput()) mapper.ScalarVisibilityOff() - mapper.ImmediateModeRenderingOn() # improve performance + #mapper.ImmediateModeRenderingOn() # improve performance obj_roll = vtk.vtkActor() obj_roll.SetMapper(mapper) + obj_roll.GetProperty().SetColor(1, 1, 1) + # obj_roll.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite')) + # obj_roll.GetProperty().SetSpecular(30) + # obj_roll.GetProperty().SetSpecularPower(80) obj_roll.SetPosition(0, 25, -30) obj_roll.RotateX(-60) obj_roll.RotateZ(180) obj_yaw = vtk.vtkActor() obj_yaw.SetMapper(mapper) + obj_yaw.GetProperty().SetColor(1, 1, 1) + # obj_yaw.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite')) + # obj_yaw.GetProperty().SetSpecular(30) + # obj_yaw.GetProperty().SetSpecularPower(80) obj_yaw.SetPosition(0, -115, 5) obj_yaw.RotateZ(180) obj_pitch = vtk.vtkActor() obj_pitch.SetMapper(mapper) + obj_pitch.GetProperty().SetColor(1, 1, 1) + # obj_pitch.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite')) + # obj_pitch.GetProperty().SetSpecular(30) + # obj_pitch.GetProperty().SetSpecularPower(80) obj_pitch.SetPosition(5, -265, 5) obj_pitch.RotateY(90) obj_pitch.RotateZ(180) @@ -717,6 +731,9 @@ class Viewer(wx.Panel): self.DisableCoilTracker() def OnUpdateObjectTargetGuide(self, m_img, coord): + + vtk_colors = vtk.vtkNamedColors() + if self.target_coord and self.target_mode: target_dist = distance.euclidean(coord[0:3], @@ -734,10 +751,10 @@ class Viewer(wx.Panel): if target_dist <= self.distthreshold: thrdist = True - self.aim_actor.GetProperty().SetColor(0, 1, 0) + self.aim_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green')) else: thrdist = False - self.aim_actor.GetProperty().SetColor(1, 1, 1) + self.aim_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Yellow')) coordx = self.target_coord[3] - coord[3] if coordx > const.ARROW_UPPER_LIMIT: @@ -765,9 +782,11 @@ class Viewer(wx.Panel): if self.anglethreshold * const.ARROW_SCALE > coordx > -self.anglethreshold * const.ARROW_SCALE: thrcoordx = True + # self.obj_actor_list[0].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green')) self.obj_actor_list[0].GetProperty().SetColor(0, 1, 0) else: thrcoordx = False + # self.obj_actor_list[0].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite')) self.obj_actor_list[0].GetProperty().SetColor(1, 1, 1) offset = 5 @@ -784,9 +803,11 @@ class Viewer(wx.Panel): if self.anglethreshold * const.ARROW_SCALE > coordz > -self.anglethreshold * const.ARROW_SCALE: thrcoordz = True + # self.obj_actor_list[1].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green')) self.obj_actor_list[1].GetProperty().SetColor(0, 1, 0) else: thrcoordz = False + # self.obj_actor_list[1].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite')) self.obj_actor_list[1].GetProperty().SetColor(1, 1, 1) offset = -35 @@ -803,9 +824,11 @@ class Viewer(wx.Panel): if self.anglethreshold * const.ARROW_SCALE > coordy > -self.anglethreshold * const.ARROW_SCALE: thrcoordy = True + #self.obj_actor_list[2].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green')) self.obj_actor_list[2].GetProperty().SetColor(0, 1, 0) else: thrcoordy = False + #self.obj_actor_list[2].GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('GhostWhite')) self.obj_actor_list[2].GetProperty().SetColor(1, 1, 1) offset = 38 @@ -823,9 +846,9 @@ class Viewer(wx.Panel): arrow_pitch_y2.GetProperty().SetColor(1, 0, 0) if thrdist and thrcoordx and thrcoordy and thrcoordz: - self.dummy_coil_actor.GetProperty().SetColor(0, 1, 0) + self.dummy_coil_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Green')) else: - self.dummy_coil_actor.GetProperty().SetColor(1, 1, 1) + self.dummy_coil_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('DarkOrange')) self.arrow_actor_list = arrow_roll_x1, arrow_roll_x2, arrow_yaw_z1, arrow_yaw_z2, \ arrow_pitch_y1, arrow_pitch_y2 @@ -833,7 +856,6 @@ class Viewer(wx.Panel): for ind in self.arrow_actor_list: self.ren2.AddActor(ind) - self.Refresh() def OnUpdateTargetCoordinates(self, coord): @@ -853,6 +875,8 @@ class Viewer(wx.Panel): self.RemoveTargetAim() self.aim_actor = None + vtk_colors = vtk.vtkNamedColors() + a, b, g = np.radians(self.target_coord[3:]) r_ref = tr.euler_matrix(a, b, g, 'sxyz') t_ref = tr.translation_matrix(self.target_coord[:3]) @@ -885,8 +909,10 @@ class Viewer(wx.Panel): aim_actor = vtk.vtkActor() aim_actor.SetMapper(mapper) - aim_actor.GetProperty().SetColor(1, 1, 1) - aim_actor.GetProperty().SetOpacity(0.6) + aim_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('Yellow')) + aim_actor.GetProperty().SetSpecular(.2) + aim_actor.GetProperty().SetSpecularPower(100) + aim_actor.GetProperty().SetOpacity(1.) self.aim_actor = aim_actor self.ren.AddActor(aim_actor) @@ -909,11 +935,14 @@ class Viewer(wx.Panel): obj_mapper = vtk.vtkPolyDataMapper() obj_mapper.SetInputData(normals.GetOutput()) obj_mapper.ScalarVisibilityOff() - obj_mapper.ImmediateModeRenderingOn() # improve performance + #obj_mapper.ImmediateModeRenderingOn() # improve performance self.dummy_coil_actor = vtk.vtkActor() self.dummy_coil_actor.SetMapper(obj_mapper) - self.dummy_coil_actor.GetProperty().SetOpacity(0.15) + self.dummy_coil_actor.GetProperty().SetDiffuseColor(vtk_colors.GetColor3d('DarkOrange')) + self.dummy_coil_actor.GetProperty().SetSpecular(0.5) + self.dummy_coil_actor.GetProperty().SetSpecularPower(10) + self.dummy_coil_actor.GetProperty().SetOpacity(.3) self.dummy_coil_actor.SetVisibility(1) self.dummy_coil_actor.SetUserMatrix(m_img_vtk) @@ -928,9 +957,9 @@ class Viewer(wx.Panel): def CreateTextDistance(self): tdist = vtku.Text() - tdist.SetSize(const.TEXT_SIZE_LARGE) + tdist.SetSize(const.TEXT_SIZE_DIST_NAV) tdist.SetPosition((const.X, 1.03-const.Y)) - tdist.ShadowOff() + #tdist.ShadowOff() tdist.BoldOn() self.ren.AddActor(tdist.actor) @@ -1162,7 +1191,7 @@ class Viewer(wx.Panel): """ Coil for navigation rendered in volume viewer. """ - + vtk_colors = vtk.vtkNamedColors() obj_polydata = self.CreateObjectPolyData(obj_name) transform = vtk.vtkTransform() @@ -1182,11 +1211,14 @@ class Viewer(wx.Panel): obj_mapper = vtk.vtkPolyDataMapper() obj_mapper.SetInputData(normals.GetOutput()) obj_mapper.ScalarVisibilityOff() - obj_mapper.ImmediateModeRenderingOn() # improve performance + #obj_mapper.ImmediateModeRenderingOn() # improve performance self.obj_actor = vtk.vtkActor() self.obj_actor.SetMapper(obj_mapper) - self.obj_actor.GetProperty().SetOpacity(0.9) + self.obj_actor.GetProperty().SetAmbientColor(vtk_colors.GetColor3d('GhostWhite')) + self.obj_actor.GetProperty().SetSpecular(30) + self.obj_actor.GetProperty().SetSpecularPower(80) + self.obj_actor.GetProperty().SetOpacity(.4) self.obj_actor.SetVisibility(0) self.ren.AddActor(self.obj_actor) diff --git a/invesalius/gui/default_viewers.py b/invesalius/gui/default_viewers.py index f10e3de..2c076fc 100644 --- a/invesalius/gui/default_viewers.py +++ b/invesalius/gui/default_viewers.py @@ -488,9 +488,11 @@ class VolumeToolPanel(wx.Panel): if not self.button_target.IsPressed() and evt is not False: self.button_target._pressed = True Publisher.sendMessage('Target navigation mode', target_mode=self.button_target._pressed) + Publisher.sendMessage('Change camera checkbox', status=self.button_target._pressed) elif self.button_target.IsPressed() or evt is False: self.button_target._pressed = False Publisher.sendMessage('Target navigation mode', target_mode=self.button_target._pressed) + Publisher.sendMessage('Change camera checkbox', status=self.button_target._pressed) def OnSavePreset(self, evt): d = wx.TextEntryDialog(self, _("Preset name")) diff --git a/invesalius/gui/dialogs.py b/invesalius/gui/dialogs.py index 8b8b892..3d5ea40 100644 --- a/invesalius/gui/dialogs.py +++ b/invesalius/gui/dialogs.py @@ -3326,7 +3326,7 @@ class ObjectCalibrationDialog(wx.Dialog): self.tracker_id = nav_prop[0] self.trk_init = nav_prop[1] - self.obj_ref_id = 0 + self.obj_ref_id = 2 self.obj_name = None self.obj_fiducials = np.full([5, 3], np.nan) @@ -3354,7 +3354,7 @@ class ObjectCalibrationDialog(wx.Dialog): tooltip = wx.ToolTip(_(u"Choose the object reference mode")) choice_ref = wx.ComboBox(self, -1, "", size=wx.Size(90, 23), choices=const.REF_MODE, style=wx.CB_DROPDOWN | wx.CB_READONLY) - choice_ref.SetSelection(self.obj_ref_id) + choice_ref.SetSelection(1) choice_ref.SetToolTip(tooltip) choice_ref.Bind(wx.EVT_COMBOBOX, self.OnChoiceRefMode) choice_ref.Enable(0) @@ -3368,7 +3368,10 @@ class ObjectCalibrationDialog(wx.Dialog): choice_sensor.SetSelection(0) choice_sensor.SetToolTip(tooltip) choice_sensor.Bind(wx.EVT_COMBOBOX, self.OnChoiceFTSensor) - choice_sensor.Show(False) + if self.tracker_id == const.FASTRAK or self.tracker_id == const.DEBUGTRACK: + choice_sensor.Show(True) + else: + choice_sensor.Show(False) self.choice_sensor = choice_sensor # Buttons to finish or cancel object registration @@ -3487,7 +3490,7 @@ class ObjectCalibrationDialog(wx.Dialog): mapper = vtk.vtkPolyDataMapper() mapper.SetInputData(normals.GetOutput()) mapper.ScalarVisibilityOff() - mapper.ImmediateModeRenderingOn() + #mapper.ImmediateModeRenderingOn() obj_actor = vtk.vtkActor() obj_actor.SetMapper(mapper) @@ -3563,16 +3566,19 @@ class ObjectCalibrationDialog(wx.Dialog): if evt.GetSelection(): self.obj_ref_id = 2 if self.tracker_id == const.FASTRAK or self.tracker_id == const.DEBUGTRACK: - self.choice_sensor.Show(True) - self.Layout() + self.choice_sensor.Show(self.obj_ref_id) else: self.obj_ref_id = 0 + self.choice_sensor.Show(self.obj_ref_id) for m in range(0, 5): self.obj_fiducials[m, :] = np.full([1, 3], np.nan) self.obj_orients[m, :] = np.full([1, 3], np.nan) for n in range(0, 3): self.txt_coord[m][n].SetLabel('-') + # Used to update choice sensor controls + self.Layout() + def OnChoiceFTSensor(self, evt): if evt.GetSelection(): self.obj_ref_id = 3 @@ -3786,20 +3792,33 @@ class GoToDialogScannerCoord(wx.Dialog): wx.Dialog.Close(self) self.Destroy() + class SetNDIconfigs(wx.Dialog): def __init__(self, title=_("Setting NDI polaris configs:")): - wx.Dialog.__init__(self, wx.GetApp().GetTopWindow(), -1, title, style=wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP) + wx.Dialog.__init__(self, wx.GetApp().GetTopWindow(), -1, title, size=wx.Size(1000, 200), + style=wx.DEFAULT_DIALOG_STYLE|wx.FRAME_FLOAT_ON_PARENT|wx.STAY_ON_TOP|wx.RESIZE_BORDER) self._init_gui() def serial_ports(self): - """ Lists serial port names + """ Lists serial port names and pre-select the description containing NDI """ import serial.tools.list_ports + + ports = serial.tools.list_ports.comports() if sys.platform.startswith('win'): - ports = ([comport.device for comport in serial.tools.list_ports.comports()]) + port_list = [] + count = 0 + for port, desc, hwid in sorted(ports): + port_list.append(port) + if 'NDI' in desc: + port_selec = port, count + count += 1 else: raise EnvironmentError('Unsupported platform') - return ports + + #print("Here is the chosen port: {} with id {}".format(port_selec[0], port_selec[1])) + + return port_list, port_selec def _init_gui(self): self.com_ports = wx.ComboBox(self, -1, style=wx.CB_DROPDOWN|wx.CB_READONLY) @@ -3807,30 +3826,42 @@ class SetNDIconfigs(wx.Dialog): row_com.Add(wx.StaticText(self, wx.ID_ANY, "Select the COM port"), 0, wx.TOP|wx.RIGHT,5) row_com.Add(self.com_ports, 0, wx.EXPAND) - ports = self.serial_ports() - self.com_ports.Append(ports) + port_list, port_selec = self.serial_ports() - self.dir_probe = wx.FilePickerCtrl(self, path=inv_paths.NDI_MAR_DIR_REF, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL, + self.com_ports.Append(port_list) + self.com_ports.SetSelection(port_selec[1]) + + session = ses.Session() + last_ndi_probe_marker = session.get('paths', 'last_ndi_probe_marker', '') + last_ndi_ref_marker = session.get('paths', 'last_ndi_ref_marker', '') + last_ndi_obj_marker = session.get('paths', 'last_ndi_obj_marker', '') + + if not last_ndi_probe_marker: + last_ndi_probe_marker = inv_paths.NDI_MAR_DIR_PROBE + if not last_ndi_ref_marker: + last_ndi_ref_marker = inv_paths.NDI_MAR_DIR_REF + if not last_ndi_obj_marker: + last_ndi_obj_marker = inv_paths.NDI_MAR_DIR_OBJ + + self.dir_probe = wx.FilePickerCtrl(self, path=last_ndi_probe_marker, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL, wildcard="Rom files (*.rom)|*.rom", message="Select probe's rom file") row_probe = wx.BoxSizer(wx.VERTICAL) row_probe.Add(wx.StaticText(self, wx.ID_ANY, "Set probe's rom file"), 0, wx.TOP|wx.RIGHT, 5) row_probe.Add(self.dir_probe, 0, wx.EXPAND|wx.ALIGN_CENTER) - self.dir_ref = wx.FilePickerCtrl(self, path=inv_paths.NDI_MAR_DIR_REF, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL, - wildcard="Rom files (*.rom)|*.rom", message="Select reference's rom file") + self.dir_ref = wx.FilePickerCtrl(self, path=last_ndi_ref_marker, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL, + wildcard="Rom files (*.rom)|*.rom", message="Select reference's rom file") row_ref = wx.BoxSizer(wx.VERTICAL) row_ref.Add(wx.StaticText(self, wx.ID_ANY, "Set reference's rom file"), 0, wx.TOP | wx.RIGHT, 5) row_ref.Add(self.dir_ref, 0, wx.EXPAND|wx.ALIGN_CENTER) - self.dir_obj = wx.FilePickerCtrl(self, path=inv_paths.NDI_MAR_DIR_OBJ, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL, - wildcard="Rom files (*.rom)|*.rom", message="Select object's rom file") + self.dir_obj = wx.FilePickerCtrl(self, path=last_ndi_obj_marker, style=wx.FLP_USE_TEXTCTRL|wx.FLP_SMALL, + wildcard="Rom files (*.rom)|*.rom", message="Select object's rom file") #self.dir_probe.Bind(wx.EVT_FILEPICKER_CHANGED, self.Selected) row_obj = wx.BoxSizer(wx.VERTICAL) row_obj.Add(wx.StaticText(self, wx.ID_ANY, "Set object's rom file"), 0, wx.TOP|wx.RIGHT, 5) row_obj.Add(self.dir_obj, 0, wx.EXPAND|wx.ALIGN_CENTER) - # self.goto_orientation.SetSelection(cb_init) - btn_ok = wx.Button(self, wx.ID_OK) btn_ok.SetHelpText("") btn_ok.SetDefault() @@ -3863,10 +3894,19 @@ class SetNDIconfigs(wx.Dialog): self.CenterOnParent() def GetValue(self): - return self.com_ports.GetString(self.com_ports.GetSelection()).encode(const.FS_ENCODE), \ - self.dir_probe.GetPath().encode(const.FS_ENCODE),\ - self.dir_ref.GetPath().encode(const.FS_ENCODE), \ - self.dir_obj.GetPath().encode(const.FS_ENCODE) + fn_probe = self.dir_probe.GetPath().encode(const.FS_ENCODE) + fn_ref = self.dir_ref.GetPath().encode(const.FS_ENCODE) + fn_obj = self.dir_obj.GetPath().encode(const.FS_ENCODE) + + if fn_probe and fn_ref and fn_obj: + session = ses.Session() + session['paths']['last_ndi_probe_marker'] = self.dir_probe.GetPath() + session['paths']['last_ndi_ref_marker'] = self.dir_ref.GetPath() + session['paths']['last_ndi_obj_marker'] = self.dir_obj.GetPath() + session.WriteSessionFile() + + return self.com_ports.GetString(self.com_ports.GetSelection()).encode(const.FS_ENCODE), fn_probe, fn_ref, fn_obj + class SetCOMport(wx.Dialog): def __init__(self, title=_("Select COM port")): diff --git a/invesalius/gui/task_navigator.py b/invesalius/gui/task_navigator.py index c72aa7d..0a0d3c1 100644 --- a/invesalius/gui/task_navigator.py +++ b/invesalius/gui/task_navigator.py @@ -229,18 +229,16 @@ class InnerFoldPanel(wx.Panel): def __bind_events(self): Publisher.subscribe(self.OnCheckStatus, 'Navigation status') Publisher.subscribe(self.OnShowObject, 'Update track object state') - Publisher.subscribe(self.OnVolumeCamera, 'Target navigation mode') + Publisher.subscribe(self.OnVolumeCamera, 'Change camera checkbox') Publisher.subscribe(self.OnShowDbs, "Active dbs folder") Publisher.subscribe(self.OnHideDbs, "Deactive dbs folder") def OnShowDbs(self): self.dbs_item.Show() - def OnHideDbs(self): self.dbs_item.Hide() - def OnCheckStatus(self, status): if status: self.checktrigger.Enable(False) @@ -257,6 +255,7 @@ class InnerFoldPanel(wx.Panel): if not evt: if flag: self.checkobj.Enable(True) + self.checkobj.SetValue(True) self.track_obj = True Publisher.sendMessage('Status target button', status=True) else: @@ -267,12 +266,12 @@ class InnerFoldPanel(wx.Panel): Publisher.sendMessage('Update show object state', state=self.checkobj.GetValue()) - def OnVolumeCamera(self, evt=None, target_mode=None): + def OnVolumeCamera(self, evt=None, status=None): if not evt: - if target_mode is True: - self.checkcamera.SetValue(0) + self.checkcamera.SetValue(status) Publisher.sendMessage('Update volume camera state', camera_state=self.checkcamera.GetValue()) + class NeuronavigationPanel(wx.Panel): def __init__(self, parent): wx.Panel.__init__(self, parent) @@ -890,6 +889,10 @@ class ObjectRegistrationPanel(wx.Panel): data=(self.obj_fiducials, self.obj_orients, self.obj_ref_mode, self.obj_name)) Publisher.sendMessage('Update status text in GUI', label=_("Ready")) + # Enable automatically Track object, Show coil and disable Vol. Camera + self.checktrack.SetValue(True) + Publisher.sendMessage('Update track object state', flag=True, obj_name=self.obj_name) + Publisher.sendMessage('Change camera checkbox', status=False) except wx._core.PyAssertionError: # TODO FIX: win64 pass @@ -916,6 +919,9 @@ class ObjectRegistrationPanel(wx.Panel): Publisher.sendMessage('Update object registration', data=(self.obj_fiducials, self.obj_orients, self.obj_ref_mode, self.obj_name)) Publisher.sendMessage('Update status text in GUI', label=_("Ready")) + self.checktrack.SetValue(True) + Publisher.sendMessage('Update track object state', flag=True, obj_name=self.obj_name) + Publisher.sendMessage('Change camera checkbox', status=False) wx.MessageBox(_("Object file successfully loaded"), _("Load")) def ShowSaveObjectDialog(self, evt): @@ -963,8 +969,8 @@ class MarkersPanel(wx.Panel): self.tgt_flag = self.tgt_index = None self.nav_status = False - self.marker_colour = (0.0, 0.0, 1.) - self.marker_size = 4 + self.marker_colour = (1.0, 1.0, 0.) + self.marker_size = 3 # Change marker size spin_size = wx.SpinCtrl(self, -1, "", size=wx.Size(40, 23)) @@ -1058,9 +1064,7 @@ class MarkersPanel(wx.Panel): self.nav_status = True def OnMouseRightDown(self, evt): - self.OnListEditMarkerId(self.nav_status) - - def OnListEditMarkerId(self, status): + # TODO: Enable the "Set as target" only when target is created with registered object menu_id = wx.Menu() edit_id = menu_id.Append(0, _('Edit ID')) menu_id.Bind(wx.EVT_MENU, self.OnMenuEditMarkerId, edit_id) @@ -1070,7 +1074,7 @@ class MarkersPanel(wx.Panel): target_menu = menu_id.Append(1, _('Set as target')) menu_id.Bind(wx.EVT_MENU, self.OnMenuSetTarget, target_menu) - target_menu.Enable(status) + target_menu.Enable(True) self.PopupMenu(menu_id) menu_id.Destroy() -- libgit2 0.21.2