2010-03-22 05:48:52 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
MultiPlotWidget.py - Convenience class--GraphicsView widget displaying a MultiPlotItem
|
|
|
|
Copyright 2010 Luke Campagnola
|
|
|
|
Distributed under MIT/X11 license. See license.txt for more infomation.
|
|
|
|
"""
|
|
|
|
|
2012-05-11 22:05:41 +00:00
|
|
|
from .GraphicsView import GraphicsView
|
2012-03-02 02:55:32 +00:00
|
|
|
import pyqtgraph.graphicsItems.MultiPlotItem as MultiPlotItem
|
2010-03-22 05:48:52 +00:00
|
|
|
|
2012-03-02 02:55:32 +00:00
|
|
|
__all__ = ['MultiPlotWidget']
|
2010-03-22 05:48:52 +00:00
|
|
|
class MultiPlotWidget(GraphicsView):
|
|
|
|
"""Widget implementing a graphicsView with a single PlotItem inside."""
|
|
|
|
def __init__(self, parent=None):
|
|
|
|
GraphicsView.__init__(self, parent)
|
|
|
|
self.enableMouse(False)
|
2012-03-02 02:55:32 +00:00
|
|
|
self.mPlotItem = MultiPlotItem.MultiPlotItem()
|
2010-03-22 05:48:52 +00:00
|
|
|
self.setCentralItem(self.mPlotItem)
|
|
|
|
## Explicitly wrap methods from mPlotItem
|
|
|
|
#for m in ['setData']:
|
|
|
|
#setattr(self, m, getattr(self.mPlotItem, m))
|
|
|
|
|
|
|
|
def __getattr__(self, attr): ## implicitly wrap methods from plotItem
|
|
|
|
if hasattr(self.mPlotItem, attr):
|
|
|
|
m = getattr(self.mPlotItem, attr)
|
|
|
|
if hasattr(m, '__call__'):
|
|
|
|
return m
|
2012-05-11 22:05:41 +00:00
|
|
|
raise NameError(attr)
|
2010-03-22 05:48:52 +00:00
|
|
|
|
|
|
|
def widgetGroupInterface(self):
|
|
|
|
return (None, MultiPlotWidget.saveState, MultiPlotWidget.restoreState)
|
|
|
|
|
|
|
|
def saveState(self):
|
|
|
|
return {}
|
|
|
|
#return self.plotItem.saveState()
|
|
|
|
|
|
|
|
def restoreState(self, state):
|
|
|
|
pass
|
|
|
|
#return self.plotItem.restoreState(state)
|
2011-04-05 14:35:50 +00:00
|
|
|
|
|
|
|
def close(self):
|
|
|
|
self.mPlotItem.close()
|
2011-04-25 12:51:18 +00:00
|
|
|
self.mPlotItem = None
|
|
|
|
self.setParent(None)
|
|
|
|
GraphicsView.close(self)
|