Added Dock.close()
Fixed bugs in functions weave usage Documented ROI signals Fixed 3D view updating after every scene change
This commit is contained in:
parent
017adec032
commit
a55d58024d
@ -209,6 +209,13 @@ class Dock(QtGui.QWidget, DockDrop):
|
|||||||
|
|
||||||
self.setOrientation(force=True)
|
self.setOrientation(force=True)
|
||||||
|
|
||||||
|
def close(self):
|
||||||
|
"""Remove this dock from the DockArea it lives inside."""
|
||||||
|
self.setParent(None)
|
||||||
|
self.label.setParent(None)
|
||||||
|
self._container.apoptose()
|
||||||
|
self._container = None
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<Dock %s %s>" % (self.name(), self.stretch())
|
return "<Dock %s %s>" % (self.name(), self.stretch())
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ SI_PREFIXES_ASCII = 'yzafpnum kMGTPEZY'
|
|||||||
|
|
||||||
|
|
||||||
from .Qt import QtGui, QtCore, USE_PYSIDE
|
from .Qt import QtGui, QtCore, USE_PYSIDE
|
||||||
from pyqtgraph import getConfigOption
|
import pyqtgraph as pg
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import decimal, re
|
import decimal, re
|
||||||
import ctypes
|
import ctypes
|
||||||
@ -32,12 +32,12 @@ import sys, struct
|
|||||||
try:
|
try:
|
||||||
import scipy.ndimage
|
import scipy.ndimage
|
||||||
HAVE_SCIPY = True
|
HAVE_SCIPY = True
|
||||||
WEAVE_DEBUG = getConfigOption('weaveDebug')
|
WEAVE_DEBUG = pg.getConfigOption('weaveDebug')
|
||||||
try:
|
if pg.getConfigOption('useWeave'):
|
||||||
import scipy.weave
|
try:
|
||||||
USE_WEAVE = getConfigOption('useWeave')
|
import scipy.weave
|
||||||
except:
|
except ImportError:
|
||||||
USE_WEAVE = False
|
pg.setConfigOptions(useWeave=False)
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HAVE_SCIPY = False
|
HAVE_SCIPY = False
|
||||||
|
|
||||||
@ -611,18 +611,19 @@ def rescaleData(data, scale, offset, dtype=None):
|
|||||||
|
|
||||||
Uses scipy.weave (if available) to improve performance.
|
Uses scipy.weave (if available) to improve performance.
|
||||||
"""
|
"""
|
||||||
global USE_WEAVE
|
|
||||||
if dtype is None:
|
if dtype is None:
|
||||||
dtype = data.dtype
|
dtype = data.dtype
|
||||||
|
else:
|
||||||
|
dtype = np.dtype(dtype)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not USE_WEAVE:
|
if not pg.getConfigOption('useWeave'):
|
||||||
raise Exception('Weave is disabled; falling back to slower version.')
|
raise Exception('Weave is disabled; falling back to slower version.')
|
||||||
|
|
||||||
## require native dtype when using weave
|
## require native dtype when using weave
|
||||||
if not data.dtype.isnative():
|
if not data.dtype.isnative:
|
||||||
data = data.astype(data.dtype.newbyteorder('='))
|
data = data.astype(data.dtype.newbyteorder('='))
|
||||||
if not dtype.isnative():
|
if not dtype.isnative:
|
||||||
weaveDtype = dtype.newbyteorder('=')
|
weaveDtype = dtype.newbyteorder('=')
|
||||||
else:
|
else:
|
||||||
weaveDtype = dtype
|
weaveDtype = dtype
|
||||||
@ -643,10 +644,10 @@ def rescaleData(data, scale, offset, dtype=None):
|
|||||||
newData = newData.astype(dtype)
|
newData = newData.astype(dtype)
|
||||||
data = newData.reshape(data.shape)
|
data = newData.reshape(data.shape)
|
||||||
except:
|
except:
|
||||||
if USE_WEAVE:
|
if pg.getConfigOption('useWeave'):
|
||||||
if WEAVE_DEBUG:
|
if pg.getConfigOption('weaveDebug'):
|
||||||
debug.printExc("Error; disabling weave.")
|
debug.printExc("Error; disabling weave.")
|
||||||
USE_WEAVE = False
|
pg.setConfigOption('useWeave', False)
|
||||||
|
|
||||||
#p = np.poly1d([scale, -offset*scale])
|
#p = np.poly1d([scale, -offset*scale])
|
||||||
#data = p(data).astype(dtype)
|
#data = p(data).astype(dtype)
|
||||||
@ -663,8 +664,6 @@ def applyLookupTable(data, lut):
|
|||||||
Uses scipy.weave to improve performance if it is available.
|
Uses scipy.weave to improve performance if it is available.
|
||||||
Note: color gradient lookup tables can be generated using GradientWidget.
|
Note: color gradient lookup tables can be generated using GradientWidget.
|
||||||
"""
|
"""
|
||||||
global USE_WEAVE
|
|
||||||
|
|
||||||
if data.dtype.kind not in ('i', 'u'):
|
if data.dtype.kind not in ('i', 'u'):
|
||||||
data = data.astype(int)
|
data = data.astype(int)
|
||||||
|
|
||||||
|
@ -38,6 +38,21 @@ def rectStr(r):
|
|||||||
class ROI(GraphicsObject):
|
class ROI(GraphicsObject):
|
||||||
"""Generic region-of-interest widget.
|
"""Generic region-of-interest widget.
|
||||||
Can be used for implementing many types of selection box with rotate/translate/scale handles.
|
Can be used for implementing many types of selection box with rotate/translate/scale handles.
|
||||||
|
|
||||||
|
Signals
|
||||||
|
----------------------- ----------------------------------------------------
|
||||||
|
sigRegionChangeFinished Emitted when the user stops dragging the ROI (or
|
||||||
|
one of its handles) or if the ROI is changed
|
||||||
|
programatically.
|
||||||
|
sigRegionChangeStarted Emitted when the user starts dragging the ROI (or
|
||||||
|
one of its handles).
|
||||||
|
sigRegionChanged Emitted any time the position of the ROI changes,
|
||||||
|
including while it is being dragged by the user.
|
||||||
|
sigHoverEvent Emitted when the mouse hovers over the ROI.
|
||||||
|
sigClicked Emitted when the user clicks on the ROI
|
||||||
|
sigRemoveRequested Emitted when the user selects 'remove' from the
|
||||||
|
ROI's context menu (if available).
|
||||||
|
----------------------- ----------------------------------------------------
|
||||||
"""
|
"""
|
||||||
|
|
||||||
sigRegionChangeFinished = QtCore.Signal(object)
|
sigRegionChangeFinished = QtCore.Signal(object)
|
||||||
|
@ -240,7 +240,7 @@ class GLGraphicsItem(QtCore.QObject):
|
|||||||
v = self.view()
|
v = self.view()
|
||||||
if v is None:
|
if v is None:
|
||||||
return
|
return
|
||||||
v.updateGL()
|
v.update()
|
||||||
|
|
||||||
def mapToParent(self, point):
|
def mapToParent(self, point):
|
||||||
tr = self.transform()
|
tr = self.transform()
|
||||||
|
Loading…
Reference in New Issue
Block a user