Commit 727214ca authored by Luke Campagnola's avatar Luke Campagnola
Browse files

docstring updates

parent 35547227
......@@ -59,7 +59,20 @@ class PlotItem(GraphicsWidget):
sigXRangeChanged = 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
managers = {}
......@@ -76,6 +89,8 @@ class PlotItem(GraphicsWidget):
Optionally, PlotItem my also be initialized with the keyword arguments left,
right, top, or bottom to achieve the same effect.
*name* - Registers a name for this view so that others may link to it
GraphicsWidget.__init__(self, parent)
......@@ -289,6 +304,7 @@ class PlotItem(GraphicsWidget):
return interface in ['ViewBoxWrapper']
def getViewBox(self):
"""Return the ViewBox within."""
return self.vb
......@@ -346,7 +362,7 @@ class PlotItem(GraphicsWidget):
#print "no manager"
def registerPlot(self, name):
def registerPlot(self, name): ## for backward compatibility
self.vb.register(name) = name
#win = str(self.window())
......@@ -398,7 +414,7 @@ class PlotItem(GraphicsWidget):
def viewGeometry(self):
"""return the screen geometry of the viewbox"""
"""Return the screen geometry of the viewbox"""
v = self.scene().views()[0]
b = self.vb.mapRectToScene(self.vb.boundingRect())
wr = v.mapFromScene(b).boundingRect()
......@@ -514,7 +530,7 @@ class PlotItem(GraphicsWidget):
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.
remKeys = []
......@@ -15,7 +15,13 @@ class PlotWidget(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):
GraphicsView.__init__(self, parent)
self.setSizePolicy(QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Expanding)
......@@ -27,14 +33,7 @@ class PlotWidget(GraphicsView):
setattr(self, m, getattr(self.plotItem, m))
#QtCore.QObject.connect(self.plotItem, QtCore.SIGNAL('viewChanged'), self.viewChanged)
#def __dtor__(self):
##print "Called plotWidget sip destructor"
#def quit(self):
def close(self):
self.plotItem = None
......@@ -49,7 +48,7 @@ class PlotWidget(GraphicsView):
if hasattr(m, '__call__'):
return m
raise exceptions.NameError(attr)
def viewRangeChanged(self, view, range):
#self.emit(QtCore.SIGNAL('viewChanged'), *args)
self.sigRangeChanged.emit(self, range)
......@@ -64,6 +63,7 @@ class PlotWidget(GraphicsView):
return self.plotItem.restoreState(state)
def getPlotItem(self):
"""Return the PlotItem contained within."""
return self.plotItem
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment