enthought / pyface

pyface: traits-capable windowing framework
Other
105 stars 55 forks source link

Use integer division in DockSplitter.draw #1190

Closed greschd closed 1 year ago

greschd commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Great, thanks for taking the time to review!