New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CustomTreeCtrl.HasAGWFlag not returning boolean affects HyperTreeList #1049

cbeytas opened this Issue Oct 24, 2018 · 0 comments


None yet
1 participant
Copy link

cbeytas commented Oct 24, 2018

wxPython 4.0.3 msw

The HasAGWFlag method of lib.agw.customtreectrl (line 3473) returns an integer.

return self._agwStyle & flag

This messes up the TreeListMainWindow draw logic in lib.agw.hypertreelist (line 3105):

draw_row_lines = self.HasAGWFlag(TR_ROW_LINES)
if self.IsExposed(exposed_x, exposed_y, _MAX_WIDTH, h + draw_row_lines):

'draw_row_lines' ends up being 1024 (value of TR_ROW_LINES) instead of True when the flag is set.
This causes the HyperTreeList to always draw every single row when repainting resulting in a very slow update near the bottom of long lists.

The HasAGWFlag method of HyperTreeList is correct:

agwStyle = self.GetAGWWindowStyleFlag()
res = (agwStyle & flag and [True] or [False])[0]
return res

But this doesn't get used since the TreeListMainWindow subclasses CustomTreeCtrl.

Not to editorialize, but the line:
res = (agwStyle & flag and [True] or [False])[0]
Is absurdly complex and difficult to read. Why not something like:
res = bool(agwStyle & flag)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment