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)
|
||||
|
||||
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):
|
||||
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 pyqtgraph import getConfigOption
|
||||
import pyqtgraph as pg
|
||||
import numpy as np
|
||||
import decimal, re
|
||||
import ctypes
|
||||
@ -32,12 +32,12 @@ import sys, struct
|
||||
try:
|
||||
import scipy.ndimage
|
||||
HAVE_SCIPY = True
|
||||
WEAVE_DEBUG = getConfigOption('weaveDebug')
|
||||
try:
|
||||
import scipy.weave
|
||||
USE_WEAVE = getConfigOption('useWeave')
|
||||
except:
|
||||
USE_WEAVE = False
|
||||
WEAVE_DEBUG = pg.getConfigOption('weaveDebug')
|
||||
if pg.getConfigOption('useWeave'):
|
||||
try:
|
||||
import scipy.weave
|
||||
except ImportError:
|
||||
pg.setConfigOptions(useWeave=False)
|
||||
except ImportError:
|
||||
HAVE_SCIPY = False
|
||||
|
||||
@ -611,18 +611,19 @@ def rescaleData(data, scale, offset, dtype=None):
|
||||
|
||||
Uses scipy.weave (if available) to improve performance.
|
||||
"""
|
||||
global USE_WEAVE
|
||||
if dtype is None:
|
||||
dtype = data.dtype
|
||||
else:
|
||||
dtype = np.dtype(dtype)
|
||||
|
||||
try:
|
||||
if not USE_WEAVE:
|
||||
if not pg.getConfigOption('useWeave'):
|
||||
raise Exception('Weave is disabled; falling back to slower version.')
|
||||
|
||||
## require native dtype when using weave
|
||||
if not data.dtype.isnative():
|
||||
if not data.dtype.isnative:
|
||||
data = data.astype(data.dtype.newbyteorder('='))
|
||||
if not dtype.isnative():
|
||||
if not dtype.isnative:
|
||||
weaveDtype = dtype.newbyteorder('=')
|
||||
else:
|
||||
weaveDtype = dtype
|
||||
@ -643,10 +644,10 @@ def rescaleData(data, scale, offset, dtype=None):
|
||||
newData = newData.astype(dtype)
|
||||
data = newData.reshape(data.shape)
|
||||
except:
|
||||
if USE_WEAVE:
|
||||
if WEAVE_DEBUG:
|
||||
if pg.getConfigOption('useWeave'):
|
||||
if pg.getConfigOption('weaveDebug'):
|
||||
debug.printExc("Error; disabling weave.")
|
||||
USE_WEAVE = False
|
||||
pg.setConfigOption('useWeave', False)
|
||||
|
||||
#p = np.poly1d([scale, -offset*scale])
|
||||
#data = p(data).astype(dtype)
|
||||
@ -663,8 +664,6 @@ def applyLookupTable(data, lut):
|
||||
Uses scipy.weave to improve performance if it is available.
|
||||
Note: color gradient lookup tables can be generated using GradientWidget.
|
||||
"""
|
||||
global USE_WEAVE
|
||||
|
||||
if data.dtype.kind not in ('i', 'u'):
|
||||
data = data.astype(int)
|
||||
|
||||
|
@ -38,6 +38,21 @@ def rectStr(r):
|
||||
class ROI(GraphicsObject):
|
||||
"""Generic region-of-interest widget.
|
||||
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)
|
||||
|
@ -240,7 +240,7 @@ class GLGraphicsItem(QtCore.QObject):
|
||||
v = self.view()
|
||||
if v is None:
|
||||
return
|
||||
v.updateGL()
|
||||
v.update()
|
||||
|
||||
def mapToParent(self, point):
|
||||
tr = self.transform()
|
||||
|
Loading…
x
Reference in New Issue
Block a user