-
Notifications
You must be signed in to change notification settings - Fork 77
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
MNT: Move some calls to children classes to stop pyside6 throwing an error about __init__ in classes that use multiple inheritence. #1181
base: master
Are you sure you want to change the base?
Conversation
…classes with multiple inheritence not getting called, when we actually are calling them. There is no issue running on pyqt5, but on pyside6 throws a runtime error when initializing classes that use multiple inheritance of a qt base class and a pydm class. example class: class PyDMDrawing(QWidget, PyDMWidget, new_properties=_penRuleProperties)) ... def __init__(self, parent=None, init_channel=None): ... # explicitly calling base class __init__ functions QWidget.__init__(self, parent) PyDMWidget.__init__(self, init_channel=init_channel) ... The runtime error happens when a call is made in the base class that relies on the qt base class's __init__ call to have completed setting things up (such as 'installEventFilter()). example error: -> self.installEventFilter(self) RuntimeError: '__init__' method of object's base class (PyDMDrawingImage) not called. This error is thrown despite that we explicitly call each of it's base class __init__ functions. It seems like pyside6 is just being extra cautious here. The fix here is to move these "problem" calls out of our pydm base classes __init__ and into the children class's __init__, after we explicity call the parent class constructors. To match the functionality of b4, these calls need to be added to any classes with PyDMWidget as their parent.
…avoid pyside6 error
this patch addresses the same issue discussed here: #1177 |
Have you looked to see if |
…hild classes, to avoid pyside6 error
yes i messed around a bit with meaning we get access to "cls" but not "self", so in it we could only modify class attributes like 'RULE_PROPERTIES', which are vars shared across all instances of the class |
There is no issue running on pyqt5, but on pyside6 throws a runtime error when initializing classes that use multiple inheritance of a qt base class and a pydm class.
example class:
The runtime error happens when a call is made in the base class that relies on the qt base class's __init__ call to have completed setting things up (such as 'installEventFilter()).
example error:
This error is thrown despite that we explicitly call each of it's base class __init__ functions. It seems like pyside6 is just being extra cautious here.
The fix here is to move these "problem" calls out of our pydm base classes __init__ and into the children class's __init__, after we explicity call the parent class constructors. To match the functionality of b4, these calls need to be added to any classes with PyDMWidget as their parent.