Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Benjamin Jakimow
EO Time Series Viewer
Commits
727214ca
Commit
727214ca
authored
Apr 15, 2012
by
Luke Campagnola
Browse files
docstring updates
parent
35547227
Changes
2
Hide whitespace changes
Inline
Side-by-side
graphicsItems/PlotItem/PlotItem.py
View file @
727214ca
...
...
@@ -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):
#else:
#print "no manager"
def
registerPlot
(
self
,
name
):
def
registerPlot
(
self
,
name
):
## for backward compatibility
self
.
vb
.
register
(
name
)
#self.name = name
#win = str(self.window())
...
...
@@ -398,7 +414,7 @@ class PlotItem(GraphicsWidget):
self
.
scales
[
k
][
'item'
].
setGrid
(
g
)
def
viewGeometry
(
self
):
"""
r
eturn the screen geometry of the viewbox"""
"""
R
eturn 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):
self
.
replot
()
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
=
[]
...
...
widgets/PlotWidget.py
View file @
727214ca
...
...
@@ -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)
self
.
plotItem
.
sigRangeChanged
.
connect
(
self
.
viewRangeChanged
)
#def __dtor__(self):
##print "Called plotWidget sip destructor"
#self.quit()
#def quit(self):
def
close
(
self
):
self
.
plotItem
.
close
()
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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment