From ae4a5dc665a8d50a0dca3714bf9c417e3cc27996 Mon Sep 17 00:00:00 2001 From: Tianzhu Qiao Date: Sun, 27 May 2018 16:08:28 -0700 Subject: [PATCH] Fix a bug in calculating whether a tool fits into the AuiToolBar. --- CHANGES.rst | 1 + wx/lib/agw/aui/auibar.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index e06440b7..9fc1bd31 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -105,6 +105,7 @@ Changes in this release include the following: * Fixed a problem in wx.lib.mixins.listctrl.TextEditMixin where the height of the editor widget could be set to zero. (See discussion in #849) +* Fix a bug in calculating whether a tool fits into the AuiToolBar. (#863) diff --git a/wx/lib/agw/aui/auibar.py b/wx/lib/agw/aui/auibar.py index af61dc72..5c6a9d58 100644 --- a/wx/lib/agw/aui/auibar.py +++ b/wx/lib/agw/aui/auibar.py @@ -2935,11 +2935,12 @@ class AuiToolBar(wx.Control): cli_w, cli_h = self.GetClientSize() rect = self._items[tool_id].sizer_item.GetRect() + dropdown_size = self._art.GetElementSize(AUI_TBART_OVERFLOW_SIZE) if self._agwStyle & AUI_TB_VERTICAL: # take the dropdown size into account if self._overflow_visible: - cli_h -= self._overflow_sizer_item.GetSize().y + cli_h -= dropdown_size if rect.y+rect.height < cli_h: return True @@ -2948,7 +2949,7 @@ class AuiToolBar(wx.Control): # take the dropdown size into account if self._overflow_visible: - cli_w -= self._overflow_sizer_item.GetSize().x + cli_w -= dropdown_size if rect.x+rect.width < cli_w: return True