Skip to content
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

Use integer division in DockSplitter.draw #1190

Merged
merged 2 commits into from
Jan 10, 2023

Conversation

greschd
Copy link
Contributor

@greschd greschd commented Jan 9, 2023

Tiny fix: use integer division in calls to wx.DC.DrawLine in the DockSplitter.draw method.

Trying to run with wxPython==4.2.0 (Python 3.10, Linux+Windows), this caused the following error:

Traceback (most recent call last):
  File "<venv>/python/lib/python3.10/site-packages/pyface/dock/dock_window.py", line 494, in _paint
    sizer.Draw(self.control)
  File "<venv>/python/lib/python3.10/site-packages/pyface/dock/dock_sizer.py", line 4233, in Draw
    self._contents.draw(set_standard_font(wx.PaintDC(window)))
  File "<venv>/python/lib/python3.10/site-packages/pyface/dock/dock_sizer.py", line 3510, in draw
    item.draw(dc)
  File "<venv>/python/lib/python3.10/site-packages/pyface/dock/dock_sizer.py", line 3514, in draw
    item.draw(dc)
  File "<venv>/python/lib/python3.10/site-packages/pyface/dock/dock_sizer.py", line 1317, in draw
    dc.DrawLine(x + idx + 1, y + dy / 2, x + dx - 2, y + dy / 2)
TypeError: DC.DrawLine(): arguments did not match any overloaded call:
  overload 1: argument 2 has unexpected type 'float'
  overload 2: argument 1 has unexpected type 'int'

Related: #1187

@corranwebster
Copy link
Contributor

Thanks for the contribution! We haven't had the resources for bringing things up to date with WxPython beyond 4.0, so any further fixes (or even simply reports) of issues that you've run into would be much appreciated.

The fix itself looks good, so assuming tests pass, I'll merge it later today. It might be a couple of months before the next release, however.

@corranwebster
Copy link
Contributor

Looks like the copyright date check failed with the new year - not your problem, but this may have to wait until we get that resolved.

@greschd
Copy link
Contributor Author

greschd commented Jan 10, 2023

Great, thanks for taking the time to review!

Copy link
Contributor

@corranwebster corranwebster left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style failures are fixed in #1191, otherwise this is good.

@corranwebster corranwebster merged commit 9aeb3bd into enthought:main Jan 10, 2023
@greschd greschd deleted the fix/dock_sizer_draw_type branch January 10, 2023 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants