microscope-cockpit / cockpit

Cockpit is a microscope graphical user interface. It is a flexible and easy to extend platform aimed at life scientists using bespoke microscopes.
https://microscope-cockpit.org
GNU General Public License v3.0
37 stars 27 forks source link

Python 3.10 wxWidgets type conversion issues #799

Closed dstoychev closed 2 years ago

dstoychev commented 2 years ago

In Python 3.10, built-in and extension functions which take integers as arguments no longer implicitly convert to integer if there will be loss of information, e.g. when converting from a Decimal or float. This affects wxWidgets in quite a few places and has been fixed since December, but it is only available in the developmental snapshots at the moment: PR #2039 at https://github.com/wxWidgets/Phoenix.

Cockpit has custom widgets which are affected in the same way and require similar treatment. Just by starting a default (no config) Cockpit instance, I have encountered issues in the MacroStageBase (built on top of wx.glcanvas.GLCanvas) and safe controls (built on top of wx.Window). Fixes can be found here: https://github.com/dstoychev/cockpit/tree/python10-fixes.

iandobbie commented 2 years ago

This is all explicit casting to int so I have just going to pull it into the main branch.