diff options
Diffstat (limited to 'silx/gui/_glutils')
-rw-r--r-- | silx/gui/_glutils/OpenGLWidget.py | 5 | ||||
-rw-r--r-- | silx/gui/_glutils/Texture.py | 7 | ||||
-rw-r--r-- | silx/gui/_glutils/gl.py | 5 |
3 files changed, 12 insertions, 5 deletions
diff --git a/silx/gui/_glutils/OpenGLWidget.py b/silx/gui/_glutils/OpenGLWidget.py index 6cbf8f0..7f600a0 100644 --- a/silx/gui/_glutils/OpenGLWidget.py +++ b/silx/gui/_glutils/OpenGLWidget.py @@ -116,6 +116,9 @@ else: format_.setSwapBehavior(qt.QSurfaceFormat.DoubleBuffer) self.setFormat(format_) + # Enable receiving mouse move events when no buttons are pressed + self.setMouseTracking(True) + def getDevicePixelRatio(self): """Returns the ratio device-independent / device pixel size @@ -217,7 +220,7 @@ else: _logger.error('_OpenGLWidget has no parent') return - if qt.BINDING == 'PyQt5': + if qt.BINDING in ('PyQt5', 'PySide2'): devicePixelRatio = self.window().windowHandle().devicePixelRatio() if devicePixelRatio != self.getDevicePixelRatio(): diff --git a/silx/gui/_glutils/Texture.py b/silx/gui/_glutils/Texture.py index 9f09a86..0875ebe 100644 --- a/silx/gui/_glutils/Texture.py +++ b/silx/gui/_glutils/Texture.py @@ -1,7 +1,7 @@ # coding: utf-8 # /*########################################################################## # -# Copyright (c) 2014-2017 European Synchrotron Radiation Facility +# Copyright (c) 2014-2018 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -49,7 +49,8 @@ class Texture(object): :type data: numpy.ndarray or None :param format_: Input data format if different from internalFormat :param shape: If data is None, shape of the texture - :type shape: 2 or 3-tuple of int (height, width) or (depth, height, width) + (height, width) or (depth, height, width) + :type shape: List[int] :param int texUnit: The texture unit to use :param minFilter: OpenGL texture minimization filter (default: GL_NEAREST) :param magFilter: OpenGL texture magnification filter (default: GL_LINEAR) @@ -258,7 +259,7 @@ class Texture(object): :param format_: The OpenGL format of the data :param data: The data to use to update the texture :param offset: The offset in the texture where to copy the data - :type offset: 2 or 3-tuple of int + :type offset: List[int] :param int texUnit: The texture unit to use (default: the one provided at init) """ diff --git a/silx/gui/_glutils/gl.py b/silx/gui/_glutils/gl.py index 4b9a7bb..608d9ce 100644 --- a/silx/gui/_glutils/gl.py +++ b/silx/gui/_glutils/gl.py @@ -101,7 +101,10 @@ def enabled(capacity, enable=True): :param bool enable: True (default) to enable during context, False to disable """ - if enable: + if bool(enable) == glGetBoolean(capacity): + # Already in the right state: noop + yield + elif enable: glEnable(capacity) yield glDisable(capacity) |