enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.28k stars 282 forks source link

QVTKRenderWindowInteractor.py _emit_wheel_event() will produce a NameError QWheelEvent undefined. #1276

Open chrisgmorton opened 9 months ago

chrisgmorton commented 9 months ago

The import of QWheelEvent from QtGui was accidentally dropped with https://github.com/enthought/mayavi/commit/502c3f06934d7d731eef8aff07fd2cba0ac60662.

The current logic in __init__ implies this is also only needed for Qt4 (if is_qt4:...). However, https://github.com/enthought/mayavi/commit/539aba1530dbb271782a9c06e05f8d0bb76902c5 also seems to break scrollwheel zooming for PySide2 (I'm running a modified version of 5.15.10 to support Python 3.11 with VTK 9.3.0.rc1 on Ubuntu 20.04). We need the QWheelEvent import for the PySide2 case too and updated logic:

if is_qt4 or PyQtImpl == 'PySide2': 
    ..

This addresses the zooming for PySide2 and I assume avoids the NameError with PySide and PyQt4.

chnce commented 7 months ago

I have the same /a related issue. Zooming with the scroll wheel does not work (no error).

Windows 11 python 3.11.6 h2628c8c_0_cpython conda-forge mayavi 4.8.1 py311hd333e61_7 conda-forge pyside2 5.15.8 py311h2411a93_2 conda-forge