Merge branch 'master' into merge-test-data

This commit is contained in:
Ogi Moore 2021-06-02 22:15:46 -07:00 committed by GitHub
commit 31b4210f4e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 7 additions and 10 deletions

View File

@ -1423,10 +1423,6 @@ def ndarray_to_qimage(arr, fmt):
h, w = arr.shape[:2]
bytesPerLine = arr.strides[0]
qimg = QtGui.QImage(img_ptr, w, h, bytesPerLine, fmt)
# Note that the bindings that support ndarray directly already hold a reference
# to it. The manual reference below is only needed for those bindings that take
# in a raw pointer.
qimg.data = arr
return qimg

View File

@ -235,7 +235,7 @@ class ImageItem(GraphicsObject):
self._processingBuffer = self._xp.empty(shape[:2] + (4,), dtype=self._xp.ubyte)
else:
self._processingBuffer = self._displayBuffer
self.qimage = fn.makeQImage(self._displayBuffer, transpose=False, copy=False)
self.qimage = None
def setImage(self, image=None, autoLevels=None, **kargs):
"""
@ -471,6 +471,7 @@ class ImageItem(GraphicsObject):
fn.makeARGB(image, lut=lut, levels=levels, output=self._processingBuffer)
if self._xp == getCupy():
self._processingBuffer.get(out=self._displayBuffer)
self.qimage = fn.ndarray_to_qimage(self._displayBuffer, QtGui.QImage.Format.Format_ARGB32)
self._renderRequired = False
self._unrenderable = False

View File

@ -373,8 +373,8 @@ class PlotItem(GraphicsWidget):
if y is not None:
self.ctrl.yGridCheck.setChecked(y)
if alpha is not None:
v = fn.clip_scalar(alpha, 0., 1.)*self.ctrl.gridAlphaSlider.maximum()
self.ctrl.gridAlphaSlider.setValue(v)
v = fn.clip_scalar(alpha, 0, 1) * self.ctrl.gridAlphaSlider.maximum() # slider range 0 to 255
self.ctrl.gridAlphaSlider.setValue( int(v) )
def close(self):
## Most of this crap is needed to avoid PySide trouble.

View File

@ -314,7 +314,7 @@ class GLViewWidget(QtWidgets.QOpenGLWidget):
center = self.opts['center']
dist = self.opts['distance']
if self.opts['rotationMethod'] == "quaternion":
pos = center - self.opts['rotation'].rotatedVector( Vector(0,0,dist) )
pos = Vector(center - self.opts['rotation'].rotatedVector(Vector(0,0,dist) ))
else:
# using 'euler' rotation method
elev = radians(self.opts['elevation'])

View File

@ -441,13 +441,13 @@ class Parameter(QtCore.QObject):
def valueIsDefault(self):
"""Returns True if this parameter's value is equal to the default value."""
return self.value() == self.defaultValue()
return fn.eq(self.value(), self.defaultValue())
def setLimits(self, limits):
"""Set limits on the acceptable values for this parameter.
The format of limits depends on the type of the parameter and
some parameters do not make use of limits at all."""
if 'limits' in self.opts and self.opts['limits'] == limits:
if 'limits' in self.opts and fn.eq(self.opts['limits'], limits):
return
self.opts['limits'] = limits
self.sigLimitsChanged.emit(self, limits)