Commit 942c7b0d6ada8324abd97d03fd2afbb85fa4ebb1

Authored by Paulo Henrique Junqueira Amorim
1 parent f6150e88

ENH: Enhanced undo and redo icons

Showing 1 changed file with 50 additions and 4 deletions   Show diff stats
invesalius/gui/frame.py
... ... @@ -547,8 +547,29 @@ class MenuBar(wx.MenuBar):
547 547 file_edit = wx.Menu()
548 548 file_edit.AppendMenu(wx.NewId(), _('Flip'), flip_menu)
549 549 file_edit.AppendMenu(wx.NewId(), _('Swap axes'), swap_axes_menu)
550   - file_edit.Append(wx.ID_UNDO, _("Undo\tCtrl+Z")).Enable(False)
551   - file_edit.Append(wx.ID_REDO, _("Redo\tCtrl+Y")).Enable(False)
  550 +
  551 +
  552 + d = const.ICON_DIR
  553 + if not(sys.platform == 'darwin'):
  554 + # Bitmaps for show/hide task panel item
  555 + p = os.path.join(d, "undo_menu.png")
  556 + self.BMP_UNDO = wx.Bitmap(p, wx.BITMAP_TYPE_PNG)
  557 +
  558 + p = os.path.join(d, "redo_menu.png")
  559 + self.BMP_REDO = wx.Bitmap(p, wx.BITMAP_TYPE_PNG)
  560 +
  561 + file_edit_item_undo = wx.MenuItem(file_edit, wx.ID_UNDO, _("Undo\tCtrl+Z"))
  562 + file_edit_item_undo.SetBitmap(self.BMP_UNDO)
  563 + file_edit_item_undo.Enable(False)
  564 + file_edit.AppendItem(file_edit_item_undo)
  565 +
  566 + file_edit_item_redo = wx.MenuItem(file_edit, wx.ID_REDO, _("Redo\tCtrl+Y"))
  567 + file_edit_item_redo.SetBitmap(self.BMP_REDO)
  568 + file_edit_item_redo.Enable(False)
  569 + file_edit.AppendItem(file_edit_item_redo)
  570 + else:
  571 + file_edit.Append(wx.ID_UNDO, _("Undo\tCtrl+Z")).Enable(False)
  572 + file_edit.Append(wx.ID_REDO, _("Redo\tCtrl+Y")).Enable(False)
552 573 #app(const.ID_EDIT_LIST, "Show Undo List...")
553 574 #################################################################
554 575  
... ... @@ -1479,8 +1500,33 @@ class HistoryToolBar(wx.ToolBar):
1479 1500 """
1480 1501 Add tools into toolbar.
1481 1502 """
1482   - self.AddSimpleTool(wx.ID_UNDO, wx.ArtProvider_GetBitmap(wx.ART_UNDO, wx.ART_OTHER, wx.Size( 16, 16)), _('Undo'), '')
1483   - self.AddSimpleTool(wx.ID_REDO, wx.ArtProvider_GetBitmap(wx.ART_REDO, wx.ART_OTHER, wx.Size( 16, 16)), _('Redo'), '')
  1503 + d = const.ICON_DIR
  1504 + if sys.platform == 'darwin':
  1505 + # Bitmaps for show/hide task panel item
  1506 + p = os.path.join(d, "undo_original.png")
  1507 + self.BMP_UNDO = wx.Bitmap(p, wx.BITMAP_TYPE_PNG)
  1508 +
  1509 + p = os.path.join(d, "redo_original.png")
  1510 + self.BMP_REDO = wx.Bitmap(p, wx.BITMAP_TYPE_PNG)
  1511 +
  1512 + else:
  1513 + # Bitmaps for show/hide task panel item
  1514 + p = os.path.join(d, "undo_small.png")
  1515 + self.BMP_UNDO = wx.Bitmap(p, wx.BITMAP_TYPE_PNG)
  1516 +
  1517 + p = os.path.join(d, "redo_small.png")
  1518 + self.BMP_REDO = wx.Bitmap(p, wx.BITMAP_TYPE_PNG)
  1519 +
  1520 + self.AddLabelTool(wx.ID_UNDO,
  1521 + "",
  1522 + bitmap=self.BMP_UNDO,
  1523 + shortHelp= _("Undo"))
  1524 +
  1525 + self.AddLabelTool(wx.ID_REDO,
  1526 + "",
  1527 + bitmap=self.BMP_REDO,
  1528 + shortHelp= _("Redo"))
  1529 +
1484 1530 self.EnableTool(wx.ID_UNDO, False)
1485 1531 self.EnableTool(wx.ID_REDO, False)
1486 1532  
... ...