Commit b13d34fff4ff440535bb8c815310348fafd91920
1 parent
e03753e2
Exists in
mactoolbar_bkp
Converted HistoryToolbar to auitoolbar
Showing
1 changed file
with
18 additions
and
9 deletions
Show diff stats
invesalius/gui/frame.py
... | ... | @@ -1327,6 +1327,7 @@ class SliceToolBar(AuiToolBar): |
1327 | 1327 | else: |
1328 | 1328 | self.SetStateProjectClose() |
1329 | 1329 | self._UntoggleAllItems() |
1330 | + self.Refresh() | |
1330 | 1331 | |
1331 | 1332 | def _UntoggleAllItems(self, pubsub_evt=None): |
1332 | 1333 | """ |
... | ... | @@ -1375,6 +1376,7 @@ class SliceToolBar(AuiToolBar): |
1375 | 1376 | """ |
1376 | 1377 | for tool in self.enable_items: |
1377 | 1378 | self.EnableTool(tool, False) |
1379 | + self.Refresh() | |
1378 | 1380 | |
1379 | 1381 | def SetStateProjectOpen(self): |
1380 | 1382 | """ |
... | ... | @@ -1382,6 +1384,7 @@ class SliceToolBar(AuiToolBar): |
1382 | 1384 | """ |
1383 | 1385 | for tool in self.enable_items: |
1384 | 1386 | self.EnableTool(tool, True) |
1387 | + self.Refresh() | |
1385 | 1388 | |
1386 | 1389 | # ------------------------------------------------------------------ |
1387 | 1390 | # ------------------------------------------------------------------ |
... | ... | @@ -1565,14 +1568,14 @@ class LayoutToolBar(AuiToolBar): |
1565 | 1568 | self.ontool_text = True |
1566 | 1569 | |
1567 | 1570 | |
1568 | -class HistoryToolBar(wx.ToolBar): | |
1571 | +class HistoryToolBar(AuiToolBar): | |
1569 | 1572 | """ |
1570 | 1573 | Toolbar related to general layout/ visualization configuration |
1571 | 1574 | e.g: show/hide task panel and show/hide text on viewers. |
1572 | 1575 | """ |
1573 | 1576 | def __init__(self, parent): |
1574 | 1577 | style = wx.TB_FLAT|wx.TB_NODIVIDER | wx.TB_DOCKABLE |
1575 | - wx.ToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1578 | + AuiToolBar.__init__(self, parent, -1, wx.DefaultPosition, | |
1576 | 1579 | wx.DefaultSize, |
1577 | 1580 | style) |
1578 | 1581 | |
... | ... | @@ -1630,15 +1633,19 @@ class HistoryToolBar(wx.ToolBar): |
1630 | 1633 | p = os.path.join(d, "redo_small.png") |
1631 | 1634 | self.BMP_REDO = wx.Bitmap(p, wx.BITMAP_TYPE_PNG) |
1632 | 1635 | |
1633 | - self.AddLabelTool(wx.ID_UNDO, | |
1636 | + self.AddTool(wx.ID_UNDO, | |
1634 | 1637 | "", |
1635 | - bitmap=self.BMP_UNDO, | |
1636 | - shortHelp= _("Undo")) | |
1638 | + self.BMP_UNDO, | |
1639 | + wx.NullBitmap, | |
1640 | + wx.ITEM_NORMAL, | |
1641 | + short_help_string= _("Undo")) | |
1637 | 1642 | |
1638 | - self.AddLabelTool(wx.ID_REDO, | |
1643 | + self.AddTool(wx.ID_REDO, | |
1639 | 1644 | "", |
1640 | - bitmap=self.BMP_REDO, | |
1641 | - shortHelp= _("Redo")) | |
1645 | + self.BMP_REDO, | |
1646 | + wx.NullBitmap, | |
1647 | + wx.ITEM_NORMAL, | |
1648 | + short_help_string=_("Redo")) | |
1642 | 1649 | |
1643 | 1650 | self.EnableTool(wx.ID_UNDO, False) |
1644 | 1651 | self.EnableTool(wx.ID_REDO, False) |
... | ... | @@ -1685,7 +1692,7 @@ class HistoryToolBar(wx.ToolBar): |
1685 | 1692 | self.ToggleText() |
1686 | 1693 | |
1687 | 1694 | for item in VIEW_TOOLS: |
1688 | - state = self.GetToolState(item) | |
1695 | + state = self.GetToolToggled(item) | |
1689 | 1696 | if state and (item != id): |
1690 | 1697 | self.ToggleTool(item, False) |
1691 | 1698 | |
... | ... | @@ -1746,6 +1753,7 @@ class HistoryToolBar(wx.ToolBar): |
1746 | 1753 | self.EnableTool(wx.ID_UNDO, True) |
1747 | 1754 | else: |
1748 | 1755 | self.EnableTool(wx.ID_UNDO, False) |
1756 | + self.Refresh() | |
1749 | 1757 | |
1750 | 1758 | def OnEnableRedo(self, pubsub_evt): |
1751 | 1759 | value = pubsub_evt.data |
... | ... | @@ -1753,3 +1761,4 @@ class HistoryToolBar(wx.ToolBar): |
1753 | 1761 | self.EnableTool(wx.ID_REDO, True) |
1754 | 1762 | else: |
1755 | 1763 | self.EnableTool(wx.ID_REDO, False) |
1764 | + self.Refresh() | ... | ... |