Skip to content

Commit

Permalink
Merge pull request #4053 from t20100/fix-roi-parent
Browse files Browse the repository at this point in the history
[2.0] silx.gui.plot: Fixed ROI initialisation with parent
  • Loading branch information
vallsv authored Jan 26, 2024
2 parents a151fa9 + ff1b8ed commit f3cf438
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/silx/gui/plot/items/_roi_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ def __init__(self, parent=None):
from ..tools import roi as roi_tools

assert parent is None or isinstance(parent, roi_tools.RegionOfInterestManager)
# Must be done before _RegionOfInterestBase.__init__
self._child = WeakList()
_RegionOfInterestBase.__init__(self, parent)
core.HighlightedMixIn.__init__(self)
self.__text = None
Expand All @@ -261,7 +263,6 @@ def __init__(self, parent=None):
self._selectable = False
self._focusProxy = None
self._visible = True
self._child = WeakList()

def _connectToPlot(self, plot):
"""Called after connection to a plot"""
Expand Down
8 changes: 8 additions & 0 deletions src/silx/gui/plot/tools/test/testRoiCore.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,14 @@ def testRemovedSelection(self):
manager.removeRoi(item1)
self.assertIs(manager.getCurrentRoi(), None)

def testInitROIWithParent(self):
manager = roi.RegionOfInterestManager(self.plot)
item = roi_items.PointROI(manager)
manager.addRoi(item)
self.qapp.processEvents()
manager.removeRoi(item)
self.qapp.processEvents()

def testMaxROI(self):
"""Test Max ROI"""
origin1 = numpy.array([1.0, 10.0])
Expand Down

0 comments on commit f3cf438

Please sign in to comment.