Commit 5d181cf2 authored by Valentin Valls's avatar Valentin Valls
Browse files

Handle ROIs in copy config

parent 6fdbf411
......@@ -705,27 +705,30 @@ def copyItemsFromChannelNames(
def copyItemConfig(sourceItem: plot_model.Item, destinationItem: plot_model.Item):
"""Copy the configuration and the item tree from a source item to a
destination item"""
if not isinstance(sourceItem, plot_item_model.CurveItem):
raise TypeError("Only available for curve item. Found %s" % type(sourceItem))
if not isinstance(destinationItem, type(sourceItem)):
raise TypeError(
"Both items must have the same type. Found %s" % type(destinationItem)
)
destinationItem.setYAxis(sourceItem.yAxis())
sourceToDest = {}
sourceToDest[sourceItem] = destinationItem
destinationPlot = destinationItem.plot()
for item in sourceItem.plot().items():
if item.isChildOf(sourceItem):
newItem = item.copy(destinationPlot)
newItem.setParent(destinationPlot)
destinationSource = sourceToDest[item.source()]
newItem.setSource(destinationSource)
destinationPlot.addItem(newItem)
sourceToDest[item] = newItem
if isinstance(sourceItem, plot_item_model.CurveItem):
destinationItem.setVisible(sourceItem.isVisible())
destinationItem.setYAxis(sourceItem.yAxis())
sourceToDest = {}
sourceToDest[sourceItem] = destinationItem
destinationPlot = destinationItem.plot()
for item in sourceItem.plot().items():
if item.isChildOf(sourceItem):
newItem = item.copy(destinationPlot)
newItem.setParent(destinationPlot)
destinationSource = sourceToDest[item.source()]
newItem.setSource(destinationSource)
destinationPlot.addItem(newItem)
sourceToDest[item] = newItem
elif isinstance(sourceItem, plot_item_model.RoiItem):
destinationItem.setVisible(sourceItem.isVisible())
else:
raise TypeError("Only available for curve item. Found %s" % type(sourceItem))
def updateXAxis(
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment