Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion ipykernel/eventloops.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,16 @@ def loop_qt4(kernel):
@register_integration('qt', 'qt5')
def loop_qt5(kernel):
"""Start a kernel with PyQt5 event loop integration."""
os.environ['QT_API'] = 'pyqt5'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is not set, then there's no way to select the right Python bindings to create the event loop (unless users set QT_API by hand).

Therefore, I'm -1 on this one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, changed it to set if unset. This also prevents it from being overwritten in every loop (as it was originally).

if os.environ.get('QT_API', None) is None:
try:
import PyQt5
os.environ['QT_API'] = 'pyqt5'
except ImportError:
try:
import PySide2
os.environ['QT_API'] = 'pyside2'
except ImportError:
os.environ['QT_API'] = 'pyqt5'
return loop_qt4(kernel)


Expand Down