From 09691831380ca7c15cfed3445465e27837c4130d Mon Sep 17 00:00:00 2001 From: robot-piglet Date: Thu, 17 Oct 2024 11:21:34 +0300 Subject: Intermediate changes commit_hash:2d9a1d3a3501b70a635f24b69a195c83059b71da --- .../python/ipython/py3/IPython/external/qt_loaders.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'contrib/python/ipython/py3/IPython/external') diff --git a/contrib/python/ipython/py3/IPython/external/qt_loaders.py b/contrib/python/ipython/py3/IPython/external/qt_loaders.py index 1486cf9d773..6058ee5a9a8 100644 --- a/contrib/python/ipython/py3/IPython/external/qt_loaders.py +++ b/contrib/python/ipython/py3/IPython/external/qt_loaders.py @@ -302,13 +302,25 @@ def import_pyside6(): ImportErrors raised within this function are non-recoverable """ + + def get_attrs(module): + return { + name: getattr(module, name) + for name in dir(module) + if not name.startswith("_") + } + from PySide6 import QtGui, QtCore, QtSvg, QtWidgets, QtPrintSupport # Join QtGui and QtWidgets for Qt4 compatibility. QtGuiCompat = types.ModuleType("QtGuiCompat") QtGuiCompat.__dict__.update(QtGui.__dict__) - QtGuiCompat.__dict__.update(QtWidgets.__dict__) - QtGuiCompat.__dict__.update(QtPrintSupport.__dict__) + if QtCore.__version_info__ < (6, 7): + QtGuiCompat.__dict__.update(QtWidgets.__dict__) + QtGuiCompat.__dict__.update(QtPrintSupport.__dict__) + else: + QtGuiCompat.__dict__.update(get_attrs(QtWidgets)) + QtGuiCompat.__dict__.update(get_attrs(QtPrintSupport)) return QtCore, QtGuiCompat, QtSvg, QT_API_PYSIDE6 -- cgit v1.3