docstring updates
This commit is contained in:
parent
355472271b
commit
727214ca45
|
@ -59,7 +59,20 @@ class PlotItem(GraphicsWidget):
|
||||||
sigXRangeChanged = QtCore.Signal(object, object)
|
sigXRangeChanged = QtCore.Signal(object, object)
|
||||||
sigRangeChanged = QtCore.Signal(object, object)
|
sigRangeChanged = QtCore.Signal(object, object)
|
||||||
|
|
||||||
"""Plot graphics item that can be added to any graphics scene. Implements axis titles, scales, interactive viewbox."""
|
"""
|
||||||
|
Plot graphics item that can be added to any graphics scene. Implements axis titles, scales, interactive viewbox.
|
||||||
|
|
||||||
|
Use plot(...) to create a new PlotDataItem and add it to the view.
|
||||||
|
Use addItem(...) add any QGraphicsItem to the view
|
||||||
|
|
||||||
|
This class wraps several methods from its internal ViewBox:
|
||||||
|
setXRange, setYRange, setXLink, setYLink,
|
||||||
|
setRange, autoRange, viewRect, setMouseEnabled,
|
||||||
|
enableAutoRange, disableAutoRange, setAspectLocked,
|
||||||
|
register, unregister.
|
||||||
|
|
||||||
|
The ViewBox itself can be accessed by calling getVewBox()
|
||||||
|
"""
|
||||||
lastFileDir = None
|
lastFileDir = None
|
||||||
managers = {}
|
managers = {}
|
||||||
|
|
||||||
|
@ -76,6 +89,8 @@ class PlotItem(GraphicsWidget):
|
||||||
Optionally, PlotItem my also be initialized with the keyword arguments left,
|
Optionally, PlotItem my also be initialized with the keyword arguments left,
|
||||||
right, top, or bottom to achieve the same effect.
|
right, top, or bottom to achieve the same effect.
|
||||||
*name* - Registers a name for this view so that others may link to it
|
*name* - Registers a name for this view so that others may link to it
|
||||||
|
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
GraphicsWidget.__init__(self, parent)
|
GraphicsWidget.__init__(self, parent)
|
||||||
|
@ -289,6 +304,7 @@ class PlotItem(GraphicsWidget):
|
||||||
return interface in ['ViewBoxWrapper']
|
return interface in ['ViewBoxWrapper']
|
||||||
|
|
||||||
def getViewBox(self):
|
def getViewBox(self):
|
||||||
|
"""Return the ViewBox within."""
|
||||||
return self.vb
|
return self.vb
|
||||||
|
|
||||||
|
|
||||||
|
@ -346,7 +362,7 @@ class PlotItem(GraphicsWidget):
|
||||||
#else:
|
#else:
|
||||||
#print "no manager"
|
#print "no manager"
|
||||||
|
|
||||||
def registerPlot(self, name):
|
def registerPlot(self, name): ## for backward compatibility
|
||||||
self.vb.register(name)
|
self.vb.register(name)
|
||||||
#self.name = name
|
#self.name = name
|
||||||
#win = str(self.window())
|
#win = str(self.window())
|
||||||
|
@ -398,7 +414,7 @@ class PlotItem(GraphicsWidget):
|
||||||
self.scales[k]['item'].setGrid(g)
|
self.scales[k]['item'].setGrid(g)
|
||||||
|
|
||||||
def viewGeometry(self):
|
def viewGeometry(self):
|
||||||
"""return the screen geometry of the viewbox"""
|
"""Return the screen geometry of the viewbox"""
|
||||||
v = self.scene().views()[0]
|
v = self.scene().views()[0]
|
||||||
b = self.vb.mapRectToScene(self.vb.boundingRect())
|
b = self.vb.mapRectToScene(self.vb.boundingRect())
|
||||||
wr = v.mapFromScene(b).boundingRect()
|
wr = v.mapFromScene(b).boundingRect()
|
||||||
|
@ -514,7 +530,7 @@ class PlotItem(GraphicsWidget):
|
||||||
self.replot()
|
self.replot()
|
||||||
|
|
||||||
def addAvgCurve(self, curve):
|
def addAvgCurve(self, curve):
|
||||||
"""Add a single curve into the pool of curves averaged together"""
|
## Add a single curve into the pool of curves averaged together
|
||||||
|
|
||||||
## If there are plot parameters, then we need to determine which to average together.
|
## If there are plot parameters, then we need to determine which to average together.
|
||||||
remKeys = []
|
remKeys = []
|
||||||
|
|
|
@ -15,7 +15,13 @@ class PlotWidget(GraphicsView):
|
||||||
|
|
||||||
#sigRangeChanged = QtCore.Signal(object, object) ## already defined in GraphicsView
|
#sigRangeChanged = QtCore.Signal(object, object) ## already defined in GraphicsView
|
||||||
|
|
||||||
"""Widget implementing a graphicsView with a single PlotItem inside."""
|
"""
|
||||||
|
Widget implementing a graphicsView with a single PlotItem inside.
|
||||||
|
|
||||||
|
The following methods are wrapped directly from PlotItem: addItem, removeItem,
|
||||||
|
clear, setXRange, setYRange, setRange, setAspectLocked, setMouseEnabled. For all
|
||||||
|
other methods, use getPlotItem.
|
||||||
|
"""
|
||||||
def __init__(self, parent=None, **kargs):
|
def __init__(self, parent=None, **kargs):
|
||||||
GraphicsView.__init__(self, parent)
|
GraphicsView.__init__(self, parent)
|
||||||
self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
|
||||||
|
@ -27,14 +33,7 @@ class PlotWidget(GraphicsView):
|
||||||
setattr(self, m, getattr(self.plotItem, m))
|
setattr(self, m, getattr(self.plotItem, m))
|
||||||
#QtCore.QObject.connect(self.plotItem, QtCore.SIGNAL('viewChanged'), self.viewChanged)
|
#QtCore.QObject.connect(self.plotItem, QtCore.SIGNAL('viewChanged'), self.viewChanged)
|
||||||
self.plotItem.sigRangeChanged.connect(self.viewRangeChanged)
|
self.plotItem.sigRangeChanged.connect(self.viewRangeChanged)
|
||||||
|
|
||||||
#def __dtor__(self):
|
|
||||||
##print "Called plotWidget sip destructor"
|
|
||||||
#self.quit()
|
|
||||||
|
|
||||||
|
|
||||||
#def quit(self):
|
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
self.plotItem.close()
|
self.plotItem.close()
|
||||||
self.plotItem = None
|
self.plotItem = None
|
||||||
|
@ -49,7 +48,7 @@ class PlotWidget(GraphicsView):
|
||||||
if hasattr(m, '__call__'):
|
if hasattr(m, '__call__'):
|
||||||
return m
|
return m
|
||||||
raise exceptions.NameError(attr)
|
raise exceptions.NameError(attr)
|
||||||
|
|
||||||
def viewRangeChanged(self, view, range):
|
def viewRangeChanged(self, view, range):
|
||||||
#self.emit(QtCore.SIGNAL('viewChanged'), *args)
|
#self.emit(QtCore.SIGNAL('viewChanged'), *args)
|
||||||
self.sigRangeChanged.emit(self, range)
|
self.sigRangeChanged.emit(self, range)
|
||||||
|
@ -64,6 +63,7 @@ class PlotWidget(GraphicsView):
|
||||||
return self.plotItem.restoreState(state)
|
return self.plotItem.restoreState(state)
|
||||||
|
|
||||||
def getPlotItem(self):
|
def getPlotItem(self):
|
||||||
|
"""Return the PlotItem contained within."""
|
||||||
return self.plotItem
|
return self.plotItem
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user