Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Skip import of QOpenGLTime* on architectures where not available #333

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
14 changes: 12 additions & 2 deletions qtpy/QtOpenGL.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,14 @@
QOpenGLFramebufferObjectFormat, QOpenGLShader, QOpenGLShaderProgram,
QOpenGLContext, QOpenGLContextGroup, QOpenGLDebugLogger,
QOpenGLDebugMessage, QOpenGLPixelTransferOptions, QOpenGLTexture,
QOpenGLTextureBlitter, QOpenGLTimeMonitor, QOpenGLTimerQuery,
QOpenGLTextureBlitter,
QOpenGLVersionProfile, QOpenGLVertexArrayObject, QOpenGLWindow
)
# These are not present on some architectures
dalthviz marked this conversation as resolved.
Show resolved Hide resolved
try:
from PyQt5.QtGui import QOpenGLTimeMonitor, QOpenGLTimerQuery
except ImportError:
pass
elif PYQT6:
from PyQt6.QtOpenGL import *
from PyQt6.QtGui import (QOpenGLContext, QOpenGLContextGroup)
Expand All @@ -32,9 +37,14 @@
QOpenGLFramebufferObjectFormat, QOpenGLShader, QOpenGLShaderProgram,
QOpenGLContext, QOpenGLContextGroup, QOpenGLDebugLogger,
QOpenGLDebugMessage, QOpenGLPixelTransferOptions, QOpenGLTexture,
QOpenGLTextureBlitter, QOpenGLTimeMonitor, QOpenGLTimerQuery,
QOpenGLTextureBlitter,
QOpenGLVersionProfile, QOpenGLVertexArrayObject, QOpenGLWindow
)
# These are not present on some architectures
dalthviz marked this conversation as resolved.
Show resolved Hide resolved
try:
from PySide2.QtGui import QOpenGLTimeMonitor, QOpenGLTimerQuery
except ImportError:
pass
else:
raise PythonQtError('No Qt bindings could be found')

5 changes: 2 additions & 3 deletions qtpy/tests/test_qtopengl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ def test_qtopengl():
assert QtOpenGL.QOpenGLShaderProgram is not None
assert QtOpenGL.QOpenGLTexture is not None
assert QtOpenGL.QOpenGLTextureBlitter is not None
assert QtOpenGL.QOpenGLTimeMonitor is not None
assert QtOpenGL.QOpenGLTimerQuery is not None
assert QtOpenGL.QOpenGLVersionProfile is not None
assert QtOpenGL.QOpenGLVertexArrayObject is not None
assert QtOpenGL.QOpenGLWindow is not None

# We do not test for QOpenGLTimeMonitor or QOpenGLTimerQuery as
# they are not present on some architectures
dalthviz marked this conversation as resolved.
Show resolved Hide resolved