Commit 22b555c08bd2c8389deff0dd3ee81d365afff518

Authored by Thiago Franco de Moraes
1 parent 489a5ffe

Added a tool menu

Showing 1 changed file with 19 additions and 15 deletions   Show diff stats
invesalius/gui/frame.py
@@ -51,7 +51,7 @@ class MessageWatershed(wx.PopupWindow): @@ -51,7 +51,7 @@ class MessageWatershed(wx.PopupWindow):
51 def __init__(self, prnt, msg): 51 def __init__(self, prnt, msg):
52 wx.PopupWindow.__init__(self, prnt, -1) 52 wx.PopupWindow.__init__(self, prnt, -1)
53 self.txt = wx.StaticText(self, -1, msg) 53 self.txt = wx.StaticText(self, -1, msg)
54 - 54 +
55 self.sizer = wx.BoxSizer(wx.HORIZONTAL) 55 self.sizer = wx.BoxSizer(wx.HORIZONTAL)
56 self.sizer.Add(self.txt, 1, wx.EXPAND) 56 self.sizer.Add(self.txt, 1, wx.EXPAND)
57 self.SetSizer(self.sizer) 57 self.SetSizer(self.sizer)
@@ -81,10 +81,10 @@ class Frame(wx.Frame): @@ -81,10 +81,10 @@ class Frame(wx.Frame):
81 self.SetIcon(wx.Icon(icon_path, wx.BITMAP_TYPE_ICO)) 81 self.SetIcon(wx.Icon(icon_path, wx.BITMAP_TYPE_ICO))
82 82
83 self.mw = None 83 self.mw = None
84 - 84 +
85 if sys.platform != 'darwin': 85 if sys.platform != 'darwin':
86 self.Maximize() 86 self.Maximize()
87 - 87 +
88 self.sizeChanged = True 88 self.sizeChanged = True
89 #Necessary update AUI (statusBar in special) 89 #Necessary update AUI (statusBar in special)
90 #when maximized in the Win 7 and XP 90 #when maximized in the Win 7 and XP
@@ -381,12 +381,12 @@ class Frame(wx.Frame): @@ -381,12 +381,12 @@ class Frame(wx.Frame):
381 elif id == const.ID_START: 381 elif id == const.ID_START:
382 self.ShowGettingStarted() 382 self.ShowGettingStarted()
383 elif id == const.ID_PREFERENCES: 383 elif id == const.ID_PREFERENCES:
384 - self.ShowPreferences() 384 + self.ShowPreferences()
385 elif id == const.ID_DICOM_NETWORK: 385 elif id == const.ID_DICOM_NETWORK:
386 - self.ShowRetrieveDicomPanel() 386 + self.ShowRetrieveDicomPanel()
387 elif id in (const.ID_FLIP_X, const.ID_FLIP_Y, const.ID_FLIP_Z): 387 elif id in (const.ID_FLIP_X, const.ID_FLIP_Y, const.ID_FLIP_Z):
388 - axis = {const.ID_FLIP_X: 2,  
389 - const.ID_FLIP_Y: 1, 388 + axis = {const.ID_FLIP_X: 2,
  389 + const.ID_FLIP_Y: 1,
390 const.ID_FLIP_Z: 0}[id] 390 const.ID_FLIP_Z: 0}[id]
391 self.FlipVolume(axis) 391 self.FlipVolume(axis)
392 elif id in (const.ID_SWAP_XY, const.ID_SWAP_XZ, const.ID_SWAP_YZ): 392 elif id in (const.ID_SWAP_XY, const.ID_SWAP_XZ, const.ID_SWAP_YZ):
@@ -431,10 +431,10 @@ class Frame(wx.Frame): @@ -431,10 +431,10 @@ class Frame(wx.Frame):
431 if self.preferences.ShowModal() == wx.ID_OK: 431 if self.preferences.ShowModal() == wx.ID_OK:
432 values = self.preferences.GetPreferences() 432 values = self.preferences.GetPreferences()
433 self.preferences.Close() 433 self.preferences.Close()
434 - 434 +
435 ses.Session().rendering = values[const.RENDERING] 435 ses.Session().rendering = values[const.RENDERING]
436 ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION] 436 ses.Session().surface_interpolation = values[const.SURFACE_INTERPOLATION]
437 - ses.Session().language = values[const.LANGUAGE] 437 + ses.Session().language = values[const.LANGUAGE]
438 438
439 Publisher.sendMessage('Remove Volume') 439 Publisher.sendMessage('Remove Volume')
440 Publisher.sendMessage('Reset Reaycasting') 440 Publisher.sendMessage('Reset Reaycasting')
@@ -481,7 +481,7 @@ class Frame(wx.Frame): @@ -481,7 +481,7 @@ class Frame(wx.Frame):
481 Show save as dialog. 481 Show save as dialog.
482 """ 482 """
483 Publisher.sendMessage('Show save dialog', True) 483 Publisher.sendMessage('Show save dialog', True)
484 - 484 +
485 def ShowAnalyzeImporter(self): 485 def ShowAnalyzeImporter(self):
486 """ 486 """
487 Show save as dialog. 487 Show save as dialog.
@@ -490,12 +490,12 @@ class Frame(wx.Frame): @@ -490,12 +490,12 @@ class Frame(wx.Frame):
490 490
491 def FlipVolume(self, axis): 491 def FlipVolume(self, axis):
492 Publisher.sendMessage('Flip volume', axis) 492 Publisher.sendMessage('Flip volume', axis)
493 - Publisher.sendMessage('Reload actual slice') 493 + Publisher.sendMessage('Reload actual slice')
494 494
495 def SwapAxes(self, axes): 495 def SwapAxes(self, axes):
496 Publisher.sendMessage('Swap volume axes', axes) 496 Publisher.sendMessage('Swap volume axes', axes)
497 Publisher.sendMessage('Update scroll') 497 Publisher.sendMessage('Update scroll')
498 - Publisher.sendMessage('Reload actual slice') 498 + Publisher.sendMessage('Reload actual slice')
499 499
500 def OnUndo(self): 500 def OnUndo(self):
501 print "Undo" 501 print "Undo"
@@ -561,7 +561,7 @@ class MenuBar(wx.MenuBar): @@ -561,7 +561,7 @@ class MenuBar(wx.MenuBar):
561 Create all menu and submenus, and add them to self. 561 Create all menu and submenus, and add them to self.
562 """ 562 """
563 # TODO: This definetely needs improvements... ;) 563 # TODO: This definetely needs improvements... ;)
564 - 564 +
565 #Import Others Files 565 #Import Others Files
566 others_file_menu = wx.Menu() 566 others_file_menu = wx.Menu()
567 others_file_menu.Append(const.ID_ANALYZE_IMPORT, "Analyze") 567 others_file_menu.Append(const.ID_ANALYZE_IMPORT, "Analyze")
@@ -604,7 +604,7 @@ class MenuBar(wx.MenuBar): @@ -604,7 +604,7 @@ class MenuBar(wx.MenuBar):
604 file_edit = wx.Menu() 604 file_edit = wx.Menu()
605 #file_edit.AppendMenu(wx.NewId(), _('Flip'), flip_menu) 605 #file_edit.AppendMenu(wx.NewId(), _('Flip'), flip_menu)
606 #file_edit.AppendMenu(wx.NewId(), _('Swap axes'), swap_axes_menu) 606 #file_edit.AppendMenu(wx.NewId(), _('Swap axes'), swap_axes_menu)
607 - 607 +
608 608
609 d = const.ICON_DIR 609 d = const.ICON_DIR
610 if not(sys.platform == 'darwin'): 610 if not(sys.platform == 'darwin'):
@@ -630,6 +630,9 @@ class MenuBar(wx.MenuBar): @@ -630,6 +630,9 @@ class MenuBar(wx.MenuBar):
630 #app(const.ID_EDIT_LIST, "Show Undo List...") 630 #app(const.ID_EDIT_LIST, "Show Undo List...")
631 ################################################################# 631 #################################################################
632 632
  633 + # Tool menu
  634 + tools_menu = wx.Menu()
  635 +
633 # Mask Menu 636 # Mask Menu
634 mask_menu = wx.Menu() 637 mask_menu = wx.Menu()
635 self.bool_op_menu = mask_menu.Append(const.ID_BOOLEAN_MASK, _(u"Boolean operations")) 638 self.bool_op_menu = mask_menu.Append(const.ID_BOOLEAN_MASK, _(u"Boolean operations"))
@@ -638,7 +641,7 @@ class MenuBar(wx.MenuBar): @@ -638,7 +641,7 @@ class MenuBar(wx.MenuBar):
638 self.clean_mask_menu = mask_menu.Append(const.ID_CLEAN_MASK, _(u"Clean Mask\tCtrl+Shift+A")) 641 self.clean_mask_menu = mask_menu.Append(const.ID_CLEAN_MASK, _(u"Clean Mask\tCtrl+Shift+A"))
639 self.clean_mask_menu.Enable(False) 642 self.clean_mask_menu.Enable(False)
640 643
641 - file_edit.AppendMenu(-1, _(u"Mask"), mask_menu) 644 + tools_menu.AppendMenu(-1, _(u"Mask"), mask_menu)
642 645
643 646
644 # VIEW 647 # VIEW
@@ -688,6 +691,7 @@ class MenuBar(wx.MenuBar): @@ -688,6 +691,7 @@ class MenuBar(wx.MenuBar):
688 # Add all menus to menubar 691 # Add all menus to menubar
689 self.Append(file_menu, _("File")) 692 self.Append(file_menu, _("File"))
690 self.Append(file_edit, _("Edit")) 693 self.Append(file_edit, _("Edit"))
  694 + self.Append(tools_menu, _(u"Tools"))
691 #self.Append(view_menu, "View") 695 #self.Append(view_menu, "View")
692 #self.Append(tools_menu, "Tools") 696 #self.Append(tools_menu, "Tools")
693 self.Append(options_menu, _("Options")) 697 self.Append(options_menu, _("Options"))