Show More
@@ -302,13 +302,25 b' def import_pyside6():' | |||||
302 |
|
302 | |||
303 | ImportErrors raised within this function are non-recoverable |
|
303 | ImportErrors raised within this function are non-recoverable | |
304 | """ |
|
304 | """ | |
|
305 | ||||
|
306 | def get_attrs(module): | |||
|
307 | return { | |||
|
308 | name: getattr(module, name) | |||
|
309 | for name in dir(module) | |||
|
310 | if not name.startswith("_") | |||
|
311 | } | |||
|
312 | ||||
305 | from PySide6 import QtGui, QtCore, QtSvg, QtWidgets, QtPrintSupport |
|
313 | from PySide6 import QtGui, QtCore, QtSvg, QtWidgets, QtPrintSupport | |
306 |
|
314 | |||
307 | # Join QtGui and QtWidgets for Qt4 compatibility. |
|
315 | # Join QtGui and QtWidgets for Qt4 compatibility. | |
308 | QtGuiCompat = types.ModuleType("QtGuiCompat") |
|
316 | QtGuiCompat = types.ModuleType("QtGuiCompat") | |
309 | QtGuiCompat.__dict__.update(QtGui.__dict__) |
|
317 | QtGuiCompat.__dict__.update(QtGui.__dict__) | |
|
318 | if QtCore.__version_info__ < (6, 7): | |||
310 | QtGuiCompat.__dict__.update(QtWidgets.__dict__) |
|
319 | QtGuiCompat.__dict__.update(QtWidgets.__dict__) | |
311 | QtGuiCompat.__dict__.update(QtPrintSupport.__dict__) |
|
320 | QtGuiCompat.__dict__.update(QtPrintSupport.__dict__) | |
|
321 | else: | |||
|
322 | QtGuiCompat.__dict__.update(get_attrs(QtWidgets)) | |||
|
323 | QtGuiCompat.__dict__.update(get_attrs(QtPrintSupport)) | |||
312 |
|
324 | |||
313 | return QtCore, QtGuiCompat, QtSvg, QT_API_PYSIDE6 |
|
325 | return QtCore, QtGuiCompat, QtSvg, QT_API_PYSIDE6 | |
314 |
|
326 |
General Comments 0
You need to be logged in to leave comments.
Login now