Added setMinimumPlotHeight method, set default min height to 50px.
This commit is contained in:
parent
5a1a663a50
commit
d86beb5a5a
@ -12,7 +12,7 @@ __all__ = ['MultiPlotWidget']
|
|||||||
class MultiPlotWidget(GraphicsView):
|
class MultiPlotWidget(GraphicsView):
|
||||||
"""Widget implementing a graphicsView with a single MultiPlotItem inside."""
|
"""Widget implementing a graphicsView with a single MultiPlotItem inside."""
|
||||||
def __init__(self, parent=None):
|
def __init__(self, parent=None):
|
||||||
self.minPlotHeight = 150
|
self.minPlotHeight = 50
|
||||||
self.mPlotItem = MultiPlotItem.MultiPlotItem()
|
self.mPlotItem = MultiPlotItem.MultiPlotItem()
|
||||||
GraphicsView.__init__(self, parent)
|
GraphicsView.__init__(self, parent)
|
||||||
self.enableMouse(False)
|
self.enableMouse(False)
|
||||||
@ -29,7 +29,16 @@ class MultiPlotWidget(GraphicsView):
|
|||||||
if hasattr(m, '__call__'):
|
if hasattr(m, '__call__'):
|
||||||
return m
|
return m
|
||||||
raise AttributeError(attr)
|
raise AttributeError(attr)
|
||||||
|
|
||||||
|
def setMinimumPlotHeight(self, min):
|
||||||
|
"""Set the minimum height for each sub-plot displayed.
|
||||||
|
|
||||||
|
If the total height of all plots is greater than the height of the
|
||||||
|
widget, then a scroll bar will appear to provide access to the entire
|
||||||
|
set of plots.
|
||||||
|
"""
|
||||||
|
self.minPlotHeight = min
|
||||||
|
self.resizeEvent(None)
|
||||||
|
|
||||||
def widgetGroupInterface(self):
|
def widgetGroupInterface(self):
|
||||||
return (None, MultiPlotWidget.saveState, MultiPlotWidget.restoreState)
|
return (None, MultiPlotWidget.saveState, MultiPlotWidget.restoreState)
|
||||||
@ -55,7 +64,7 @@ class MultiPlotWidget(GraphicsView):
|
|||||||
minHeight = len(self.mPlotItem.plots) * self.minPlotHeight
|
minHeight = len(self.mPlotItem.plots) * self.minPlotHeight
|
||||||
if r.height() < minHeight:
|
if r.height() < minHeight:
|
||||||
r.setHeight(minHeight)
|
r.setHeight(minHeight)
|
||||||
r.setWidth(r.width() - 25)
|
r.setWidth(r.width() - self.verticalScrollBar().width())
|
||||||
self.centralWidget.setGeometry(r)
|
self.centralWidget.setGeometry(r)
|
||||||
|
|
||||||
def resizeEvent(self, ev):
|
def resizeEvent(self, ev):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user