From 73e13bf5f7de176ddf925339b660e9491bae8080 Mon Sep 17 00:00:00 2001 From: Robin Dunn Date: Wed, 24 Oct 2018 19:36:41 -0700 Subject: [PATCH] Merge pull request #1050 from mesalu/fix_1049 CustomTreeCtrl and HyperTreeList fixes (cherry picked from commit da9f69c3800ec055eb1373e7ad2f8f0d458f7a9b) --- CHANGES.rst | 8 ++++---- wx/lib/agw/customtreectrl.py | 2 +- wx/lib/agw/hypertreelist.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index ece8fbbc..18ae7048 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -84,12 +84,12 @@ Changes in this release include the following: * Fix rendering and mouse sensitivity in UltimateListCtrl when adding HyperText items. (#1010) - + * Added a parameter to lib.agw.CustomTreeCtrl.SetItemWindow(), to allow positioning the Window (a small image) on the left of text in a CustomTreeItem. (#PR886). -* Declared DeleteAllPages in the notebook subclasses, so the proper C++ +* Declared DeleteAllPages in the notebook subclasses, so the proper C++ implementation will be called. (#972) * Removed wx.lib.floatbar, which has been deprecated forever and probably @@ -106,7 +106,7 @@ Changes in this release include the following: * Fixed wx.ListCtrl.Append when wx.LC_SORT style is used, so appending items out of order does not lose the data for the remaining columns. (#906) - + * Add wx.Accessible, it's Windows-only, will raise a NotImplementedError exception on the other platforms. (#958) @@ -123,8 +123,8 @@ Changes in this release include the following: way. If you need to use some other encoding for some reason you can first convert the text to a bytesarray or other buffer protocol compatible object and then create the virtual file from that data. (#969) - +* Performance update for `wx.lib.agw.customtreectrl` (#1049) diff --git a/wx/lib/agw/customtreectrl.py b/wx/lib/agw/customtreectrl.py index e4f758cc..70a356fb 100644 --- a/wx/lib/agw/customtreectrl.py +++ b/wx/lib/agw/customtreectrl.py @@ -3504,7 +3504,7 @@ class CustomTreeCtrl(wx.ScrolledWindow): :see: The :meth:`~CustomTreeCtrl.__init__` method for the `flag` parameter description. """ - return self._agwStyle & flag + return bool(self._agwStyle & flag) def SetAGWWindowStyleFlag(self, agwStyle): diff --git a/wx/lib/agw/hypertreelist.py b/wx/lib/agw/hypertreelist.py index 2c3bd0b2..ce008d11 100644 --- a/wx/lib/agw/hypertreelist.py +++ b/wx/lib/agw/hypertreelist.py @@ -3104,7 +3104,7 @@ class TreeListMainWindow(CustomTreeCtrl): # horizontal lines between rows? draw_row_lines = self.HasAGWFlag(TR_ROW_LINES) - if self.IsExposed(exposed_x, exposed_y, _MAX_WIDTH, h + draw_row_lines): + if self.IsExposed(exposed_x, exposed_y, _MAX_WIDTH, h + int(draw_row_lines)): if draw_row_lines: total_width = self._owner.GetHeaderWindow().GetWidth() # if the background colour is white, choose a @@ -4365,7 +4365,7 @@ class HyperTreeList(wx.Control): """ agwStyle = self.GetAGWWindowStyleFlag() - res = (agwStyle & flag and [True] or [False])[0] + res = bool(agwStyle & flag) return res