migrate pyqt5 to pyside6
This commit is contained in:
@@ -43,8 +43,9 @@ def _bootstrap_paths() -> None:
|
||||
|
||||
def collect(profile: str, *, keep_open_s: float) -> dict:
|
||||
"""Create a real window, let Qt initialise it, and report what it got."""
|
||||
from PyQt5.QtCore import QTimer
|
||||
from PyQt5.QtWidgets import QApplication, QOpenGLWidget
|
||||
from PySide6.QtCore import QTimer
|
||||
from PySide6.QtOpenGLWidgets import QOpenGLWidget
|
||||
from PySide6.QtWidgets import QApplication
|
||||
|
||||
from orisys_studio.scene3d.gl_backend import (
|
||||
GLDispatch,
|
||||
@@ -103,7 +104,7 @@ def collect(profile: str, *, keep_open_s: float) -> dict:
|
||||
self.ready = True
|
||||
|
||||
def report_caps(self, capabilities) -> None:
|
||||
from PyQt5.QtGui import QSurfaceFormat
|
||||
from PySide6.QtGui import QSurfaceFormat
|
||||
|
||||
fmt: QSurfaceFormat = self.context().format() if self.context() else QSurfaceFormat()
|
||||
ratio = float(self.devicePixelRatioF() or 1.0)
|
||||
@@ -118,8 +119,11 @@ def collect(profile: str, *, keep_open_s: float) -> dict:
|
||||
"max_texture_size": capabilities.max_texture_size,
|
||||
"qt_format": {
|
||||
"version": f"{fmt.majorVersion()}.{fmt.minorVersion()}",
|
||||
"renderable_type": int(fmt.renderableType()),
|
||||
"profile": int(fmt.profile()),
|
||||
# PySide6 enums are not ints: `int(QSurfaceFormat.OpenGLES)` raises
|
||||
# TypeError, so read `.value`. (PyQt5 exposed them as ints, which is
|
||||
# why this worked before the migration.)
|
||||
"renderable_type": int(fmt.renderableType().value),
|
||||
"profile": int(fmt.profile().value),
|
||||
"depth_buffer": int(fmt.depthBufferSize()),
|
||||
"samples": int(fmt.samples()),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user