Fix performance issue in customtreectrl, beautify some ugly code.

This commit is contained in:
Mesalu
2018-10-24 18:38:34 -07:00
parent 2f8d1b2e9a
commit d27efc3158
3 changed files with 7 additions and 7 deletions

View File

@@ -113,12 +113,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
@@ -135,7 +135,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)
@@ -152,8 +152,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)

View File

@@ -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):

View File

@@ -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