Commit 87b12fec5e2c9d84558e637a81569c936b0689ed
Committed by
Thiago Franco de Moraes
1 parent
1005a965
Exists in
master
and in
10 other branches
Navigation update (#73)
* Navigation update -Markers file extension update and transifex conflicts solved -Disable mask when navigation starts -Enable cross when navigation starts if cross is disabled -Shows msg in statusbar when a tracker is connecting * Code cleaning * Minor code optimization * Added wildcard to loadMarkersDialog
Showing
4 changed files
with
30 additions
and
16 deletions
Show diff stats
invesalius/constants.py
| ... | ... | @@ -672,6 +672,10 @@ BTNS_IMG = {IR1: {0: _('LEI')}, |
| 672 | 672 | IR2: {1: _('REI')}, |
| 673 | 673 | IR3: {2: _('NAI')}} |
| 674 | 674 | |
| 675 | +BTNS_IMG_MKS = {IR1: {0: 'LEI'}, | |
| 676 | + IR2: {1: 'REI'}, | |
| 677 | + IR3: {2: 'NAI'}} | |
| 678 | + | |
| 675 | 679 | TIPS_IMG = [wx.ToolTip(_("Select left ear in image")), |
| 676 | 680 | wx.ToolTip(_("Select right ear in image")), |
| 677 | 681 | wx.ToolTip(_("Select nasion in image"))] | ... | ... |
invesalius/gui/dialogs.py
| ... | ... | @@ -453,7 +453,7 @@ def ShowSaveMarkersDialog(default_filename=None): |
| 453 | 453 | _("Save markers as..."), # title |
| 454 | 454 | "", # last used directory |
| 455 | 455 | default_filename, |
| 456 | - _("Markers (*.txt)|*.txt"), | |
| 456 | + _("Markers files (*.mks)|*.mks"), | |
| 457 | 457 | wx.SAVE | wx.OVERWRITE_PROMPT) |
| 458 | 458 | # dlg.SetFilterIndex(0) # default is VTI |
| 459 | 459 | |
| ... | ... | @@ -469,7 +469,7 @@ def ShowSaveMarkersDialog(default_filename=None): |
| 469 | 469 | ok = 1 |
| 470 | 470 | |
| 471 | 471 | if (ok): |
| 472 | - extension = "txt" | |
| 472 | + extension = "mks" | |
| 473 | 473 | if sys.platform != 'win32': |
| 474 | 474 | if filename.split(".")[-1] != extension: |
| 475 | 475 | filename = filename + "." + extension |
| ... | ... | @@ -484,6 +484,7 @@ def ShowLoadMarkersDialog(): |
| 484 | 484 | dlg = wx.FileDialog(None, message=_("Load markers"), |
| 485 | 485 | defaultDir="", |
| 486 | 486 | defaultFile="", |
| 487 | + wildcard=_("Markers files (*.mks)|*.mks"), | |
| 487 | 488 | style=wx.OPEN|wx.CHANGE_DIR) |
| 488 | 489 | |
| 489 | 490 | # inv3 filter is default | ... | ... |
invesalius/gui/frame.py
| ... | ... | @@ -1539,6 +1539,7 @@ class SliceToolBar(AuiToolBar): |
| 1539 | 1539 | sub = Publisher.subscribe |
| 1540 | 1540 | sub(self._EnableState, "Enable state project") |
| 1541 | 1541 | sub(self._UntoggleAllItems, 'Untoggle slice toolbar items') |
| 1542 | + sub(self.OnToggle, 'Toggle Cross') | |
| 1542 | 1543 | |
| 1543 | 1544 | def __bind_events_wx(self): |
| 1544 | 1545 | """ |
| ... | ... | @@ -1577,8 +1578,14 @@ class SliceToolBar(AuiToolBar): |
| 1577 | 1578 | Update status of other items on toolbar (only one item |
| 1578 | 1579 | should be toggle each time). |
| 1579 | 1580 | """ |
| 1580 | - id = evt.GetId() | |
| 1581 | - evt.Skip() | |
| 1581 | + if hasattr(evt, 'data'): | |
| 1582 | + id = evt.data | |
| 1583 | + if not self.GetToolToggled(id): | |
| 1584 | + self.ToggleTool(id, True) | |
| 1585 | + self.Refresh() | |
| 1586 | + else: | |
| 1587 | + id = evt.GetId() | |
| 1588 | + evt.Skip() | |
| 1582 | 1589 | |
| 1583 | 1590 | state = self.GetToolToggled(id) |
| 1584 | 1591 | ... | ... |
invesalius/gui/task_navigator.py
| ... | ... | @@ -36,7 +36,6 @@ import invesalius.gui.dialogs as dlg |
| 36 | 36 | import invesalius.gui.widgets.foldpanelbar as fpb |
| 37 | 37 | import invesalius.gui.widgets.colourselect as csel |
| 38 | 38 | |
| 39 | - | |
| 40 | 39 | class TaskPanel(wx.Panel): |
| 41 | 40 | def __init__(self, parent): |
| 42 | 41 | wx.Panel.__init__(self, parent) |
| ... | ... | @@ -317,9 +316,9 @@ class NeuronavigationPanel(wx.Panel): |
| 317 | 316 | def LoadImageFiducials(self, pubsub_evt): |
| 318 | 317 | marker_id = pubsub_evt.data[0] |
| 319 | 318 | coord = pubsub_evt.data[1] |
| 320 | - for n in const.BTNS_IMG: | |
| 321 | - btn_id = const.BTNS_IMG[n].keys()[0] | |
| 322 | - fid_id = const.BTNS_IMG[n].values()[0] | |
| 319 | + for n in const.BTNS_IMG_MKS: | |
| 320 | + btn_id = const.BTNS_IMG_MKS[n].keys()[0] | |
| 321 | + fid_id = const.BTNS_IMG_MKS[n].values()[0] | |
| 323 | 322 | if marker_id == fid_id and not self.btns_coord[btn_id].GetValue(): |
| 324 | 323 | self.btns_coord[btn_id].SetValue(True) |
| 325 | 324 | self.fiducials[btn_id, :] = coord[0:3] |
| ... | ... | @@ -343,6 +342,7 @@ class NeuronavigationPanel(wx.Panel): |
| 343 | 342 | self.trigger_state = pubsub_evt.data |
| 344 | 343 | |
| 345 | 344 | def OnChoiceTracker(self, evt, ctrl): |
| 345 | + Publisher.sendMessage('Update status text in GUI', _("Configuring tracker ...")) | |
| 346 | 346 | if evt: |
| 347 | 347 | choice = evt.GetSelection() |
| 348 | 348 | else: |
| ... | ... | @@ -390,6 +390,7 @@ class NeuronavigationPanel(wx.Panel): |
| 390 | 390 | dlg.NavigationTrackerWarning(self.tracker_id, self.trk_init[1]) |
| 391 | 391 | self.tracker_id = 0 |
| 392 | 392 | ctrl.SetSelection(self.tracker_id) |
| 393 | + Publisher.sendMessage('Update status text in GUI', _("Ready")) | |
| 393 | 394 | |
| 394 | 395 | def OnChoiceRefMode(self, evt, ctrl): |
| 395 | 396 | # When ref mode is changed the tracker coords are set to zero |
| ... | ... | @@ -414,8 +415,8 @@ class NeuronavigationPanel(wx.Panel): |
| 414 | 415 | Publisher.sendMessage('Update cross position', (wx, wy, wz)) |
| 415 | 416 | |
| 416 | 417 | def OnImageFiducials(self, evt): |
| 417 | - btn_id = const.BTNS_IMG[evt.GetId()].keys()[0] | |
| 418 | - marker_id = const.BTNS_IMG[evt.GetId()].values()[0] | |
| 418 | + btn_id = const.BTNS_IMG_MKS[evt.GetId()].keys()[0] | |
| 419 | + marker_id = const.BTNS_IMG_MKS[evt.GetId()].values()[0] | |
| 419 | 420 | |
| 420 | 421 | if self.btns_coord[btn_id].GetValue(): |
| 421 | 422 | coord = self.numctrls_coord[btn_id][0].GetValue(),\ |
| ... | ... | @@ -486,6 +487,8 @@ class NeuronavigationPanel(wx.Panel): |
| 486 | 487 | self.trigger = trig.Trigger(nav_id) |
| 487 | 488 | |
| 488 | 489 | Publisher.sendMessage("Navigation Status", True) |
| 490 | + Publisher.sendMessage("Toggle Cross", const.SLICE_STATE_CROSS) | |
| 491 | + Publisher.sendMessage("Hide current mask") | |
| 489 | 492 | |
| 490 | 493 | self.correg = dcr.Coregistration((minv, n, q1, q2), nav_id, tracker_mode) |
| 491 | 494 | |
| ... | ... | @@ -637,10 +640,9 @@ class MarkersPanel(wx.Panel): |
| 637 | 640 | for id_n in range(self.lc.GetItemCount()): |
| 638 | 641 | item = self.lc.GetItem(id_n, 4) |
| 639 | 642 | if item.GetText() == marker_id: |
| 640 | - for i in const.BTNS_IMG: | |
| 641 | - if marker_id in const.BTNS_IMG[i].values()[0]: | |
| 643 | + for i in const.BTNS_IMG_MKS: | |
| 644 | + if marker_id in const.BTNS_IMG_MKS[i].values()[0]: | |
| 642 | 645 | self.lc.Focus(item.GetId()) |
| 643 | - break | |
| 644 | 646 | self.DeleteMarker() |
| 645 | 647 | else: |
| 646 | 648 | if self.lc.GetFocusedItem() is not -1: |
| ... | ... | @@ -683,8 +685,8 @@ class MarkersPanel(wx.Panel): |
| 683 | 685 | size = float(line[6]) |
| 684 | 686 | |
| 685 | 687 | if len(line) == 8: |
| 686 | - for i in const.BTNS_IMG: | |
| 687 | - if line[7] in const.BTNS_IMG[i].values()[0]: | |
| 688 | + for i in const.BTNS_IMG_MKS: | |
| 689 | + if line[7] in const.BTNS_IMG_MKS[i].values()[0]: | |
| 688 | 690 | Publisher.sendMessage('Load image fiducials', (line[7], coord)) |
| 689 | 691 | else: |
| 690 | 692 | line.append("") |
| ... | ... | @@ -702,7 +704,7 @@ class MarkersPanel(wx.Panel): |
| 702 | 704 | ctrl.SetLabel('Hide') |
| 703 | 705 | |
| 704 | 706 | def OnSaveMarkers(self, evt): |
| 705 | - filename = dlg.ShowSaveMarkersDialog("markers.txt") | |
| 707 | + filename = dlg.ShowSaveMarkersDialog("markers.mks") | |
| 706 | 708 | if filename: |
| 707 | 709 | if self.list_coord: |
| 708 | 710 | text_file = open(filename, "w") | ... | ... |