Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 02160bc

Browse files
committed
Fix use of pyside6 >= 6.7.0
1 parent 9b8cd4a commit 02160bc

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

IPython/external/qt_loaders.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,13 +302,24 @@ def import_pyside6():
302302
303303
ImportErrors raised within this function are non-recoverable
304304
"""
305+
def get_attrs(module):
306+
return {
307+
name: getattr(module, name)
308+
for name in dir(module)
309+
if not name.startswith("_")
310+
}
311+
305312
from PySide6 import QtGui, QtCore, QtSvg, QtWidgets, QtPrintSupport
306313

307314
# Join QtGui and QtWidgets for Qt4 compatibility.
308315
QtGuiCompat = types.ModuleType("QtGuiCompat")
309316
QtGuiCompat.__dict__.update(QtGui.__dict__)
310-
QtGuiCompat.__dict__.update(QtWidgets.__dict__)
311-
QtGuiCompat.__dict__.update(QtPrintSupport.__dict__)
317+
if QtCore.__version_info__ < (6, 7):
318+
QtGuiCompat.__dict__.update(QtWidgets.__dict__)
319+
QtGuiCompat.__dict__.update(QtPrintSupport.__dict__)
320+
else:
321+
QtGuiCompat.__dict__.update(get_attrs(QtWidgets))
322+
QtGuiCompat.__dict__.update(get_attrs(QtPrintSupport))
312323

313324
return QtCore, QtGuiCompat, QtSvg, QT_API_PYSIDE6
314325

0 commit comments

Comments
 (0)