slaclab / pydm

Python Display Manager
http://slaclab.github.io/pydm/
Other
111 stars 76 forks source link

FIX: in analong_indicator, explicitly cast to int for py310+ compat #1080

Closed ZLLentz closed 1 month ago

ZLLentz commented 1 month ago

Starting at python 3.10, the rules for passing floats into python C extension modules like pyqt has gotten stricter. See #951 (closes #951)

The analog indicator widgets have this issue, but they mask over it with try/except blocks to prevent the app from crashing. This PR makes the widget render as intended by casting all variable inputs to int. Some of these are guaranteed to always be ints, but some of them are floats. Rather than parse out which is which, I figured it was better to cover all of them.

Python 3.9 pre-PR: indicatorpy39

Python 3.12 pre-PR: indicatorpy312

Python 3.12 post-PR: indicator312_fixed

ZLLentz commented 1 month ago

I marked this as closing the linked issue because, as far as I can tell, this is the only remaining case in pydm that has the problem.