Skip to content

Commit b9dd81d

Browse files
authored
Merge pull request #91 from hsorby/main
Fix issue with MRO not working when multiple inheritance involving C++ classes.
2 parents 34166f1 + 2224dc0 commit b9dd81d

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/cmlibs/widgets/basesceneviewerwidget.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ def __init__(self, parent=None):
3939
Initialise other attributes that deal with selection and the rotation of the plane.
4040
"""
4141
super().__init__(parent)
42+
# For some (older) versions of Python, the QOpenGLWidget (or subclass) does not call super().__init(parent),
43+
# this causes the MRO to not include the InteractionManager class __init__ function call.
44+
# So we must call the InteractionManager __init__ function manually to set up the interaction handlers.
45+
InteractionManager.__init__(self)
4246
# Create a Zinc context from which all other objects can be derived either directly or indirectly.
4347
self._graphics_initialized = False
4448
self._context = None

src/cmlibs/widgets/handlers/interactionmanager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ class InteractionManager:
66
handler_deactivated = QtCore.Signal()
77

88
def __init__(self, *args, **kwargs):
9+
super().__init__()
910
self._handlers = {}
1011
self._key_code_handler_map = {}
1112
self._active_handler = None

0 commit comments

Comments
 (0)