PlotItem doesn't add item if already there

This commit is contained in:
Ogi 2020-06-08 21:36:09 -07:00
parent f76fb3ac72
commit 66d8943317

View File

@ -1,5 +1,6 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
import sys import sys
import warnings
import weakref import weakref
import numpy as np import numpy as np
import os import os
@ -514,6 +515,9 @@ class PlotItem(GraphicsWidget):
If the item has plot data (PlotDataItem, PlotCurveItem, ScatterPlotItem), it may If the item has plot data (PlotDataItem, PlotCurveItem, ScatterPlotItem), it may
be included in analysis performed by the PlotItem. be included in analysis performed by the PlotItem.
""" """
if item in self.items:
warnings.warn('Item already added to PlotItem, ignoring.')
return
self.items.append(item) self.items.append(item)
vbargs = {} vbargs = {}
if 'ignoreBounds' in kargs: if 'ignoreBounds' in kargs: