Wrap setLimits in PlotItem and PlotWidget

This commit is contained in:
Luke Campagnola 2014-02-04 20:28:23 -05:00
parent d0ed3ba245
commit 9093282a2a
2 changed files with 7 additions and 2 deletions

View File

@ -69,6 +69,7 @@ class PlotItem(GraphicsWidget):
:func:`setYLink <pyqtgraph.ViewBox.setYLink>`,
:func:`setAutoPan <pyqtgraph.ViewBox.setAutoPan>`,
:func:`setAutoVisible <pyqtgraph.ViewBox.setAutoVisible>`,
:func:`setLimits <pyqtgraph.ViewBox.setLimits>`,
:func:`viewRect <pyqtgraph.ViewBox.viewRect>`,
:func:`viewRange <pyqtgraph.ViewBox.viewRange>`,
:func:`setMouseEnabled <pyqtgraph.ViewBox.setMouseEnabled>`,
@ -195,7 +196,7 @@ class PlotItem(GraphicsWidget):
## Wrap a few methods from viewBox
for m in [
'setXRange', 'setYRange', 'setXLink', 'setYLink', 'setAutoPan', 'setAutoVisible',
'setRange', 'autoRange', 'viewRect', 'viewRange', 'setMouseEnabled',
'setRange', 'autoRange', 'viewRect', 'viewRange', 'setMouseEnabled', 'setLimits',
'enableAutoRange', 'disableAutoRange', 'setAspectLocked', 'invertY',
'register', 'unregister']: ## NOTE: If you update this list, please update the class docstring as well.
setattr(self, m, getattr(self.vb, m))

View File

@ -33,6 +33,7 @@ class PlotWidget(GraphicsView):
:func:`enableAutoRange <pyqtgraph.ViewBox.enableAutoRange>`,
:func:`disableAutoRange <pyqtgraph.ViewBox.disableAutoRange>`,
:func:`setAspectLocked <pyqtgraph.ViewBox.setAspectLocked>`,
:func:`setLimits <pyqtgraph.ViewBox.setLimits>`,
:func:`register <pyqtgraph.ViewBox.register>`,
:func:`unregister <pyqtgraph.ViewBox.unregister>`
@ -52,7 +53,10 @@ class PlotWidget(GraphicsView):
self.setCentralItem(self.plotItem)
## Explicitly wrap methods from plotItem
## NOTE: If you change this list, update the documentation above as well.
for m in ['addItem', 'removeItem', 'autoRange', 'clear', 'setXRange', 'setYRange', 'setRange', 'setAspectLocked', 'setMouseEnabled', 'setXLink', 'setYLink', 'enableAutoRange', 'disableAutoRange', 'register', 'unregister', 'viewRect']:
for m in ['addItem', 'removeItem', 'autoRange', 'clear', 'setXRange',
'setYRange', 'setRange', 'setAspectLocked', 'setMouseEnabled',
'setXLink', 'setYLink', 'enableAutoRange', 'disableAutoRange',
'setLimits', 'register', 'unregister', 'viewRect']:
setattr(self, m, getattr(self.plotItem, m))
#QtCore.QObject.connect(self.plotItem, QtCore.SIGNAL('viewChanged'), self.viewChanged)
self.plotItem.sigRangeChanged.connect(self.viewRangeChanged)