Fixed bug 1089042 (AttributeError in PlotItem)
This commit is contained in:
parent
01f2099b46
commit
5e27ab70e2
@ -158,6 +158,8 @@ class PlotItem(GraphicsWidget):
|
|||||||
self.autoAlpha = True
|
self.autoAlpha = True
|
||||||
self.spectrumMode = False
|
self.spectrumMode = False
|
||||||
|
|
||||||
|
self.legend = None
|
||||||
|
|
||||||
## Create and place axis items
|
## Create and place axis items
|
||||||
if axisItems is None:
|
if axisItems is None:
|
||||||
axisItems = {}
|
axisItems = {}
|
||||||
@ -538,7 +540,7 @@ class PlotItem(GraphicsWidget):
|
|||||||
#item.sigPlotChanged.connect(self.plotChanged)
|
#item.sigPlotChanged.connect(self.plotChanged)
|
||||||
#self.plotChanged()
|
#self.plotChanged()
|
||||||
name = kargs.get('name', getattr(item, 'opts', {}).get('name', None))
|
name = kargs.get('name', getattr(item, 'opts', {}).get('name', None))
|
||||||
if name is not None and self.legend is not None:
|
if name is not None and hasattr(self, 'legend') and self.legend is not None:
|
||||||
self.legend.addItem(item, name=name)
|
self.legend.addItem(item, name=name)
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user