diff options
Diffstat (limited to 'silx/gui/plot/CurvesROIWidget.py')
-rw-r--r-- | silx/gui/plot/CurvesROIWidget.py | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/silx/gui/plot/CurvesROIWidget.py b/silx/gui/plot/CurvesROIWidget.py index 4508c60..4865b8e 100644 --- a/silx/gui/plot/CurvesROIWidget.py +++ b/silx/gui/plot/CurvesROIWidget.py @@ -410,7 +410,7 @@ class CurvesROIWidget(qt.QWidget): """ if visible: # if no ROI existing yet, add the default one - if self.roiTable.rowCount() is 0: + if self.roiTable.rowCount() == 0: old = self.blockSignals(True) # avoid several sigROISignal emission self._add() self.blockSignals(old) @@ -703,7 +703,7 @@ class ROITable(TableWidget): remove the current active roi """ activeItems = self.selectedItems() - if len(activeItems) is 0: + if len(activeItems) == 0: return old = self.blockSignals(True) # avoid several emission of sigROISignal roiToRm = set() @@ -1069,7 +1069,8 @@ class ROI(_RegionOfInterestBase): """Signal emitted when the ROI is edited""" def __init__(self, name, fromdata=None, todata=None, type_=None): - _RegionOfInterestBase.__init__(self, name=name) + _RegionOfInterestBase.__init__(self) + self.setName(name) global _indexNextROI self._id = _indexNextROI _indexNextROI += 1 @@ -1255,7 +1256,7 @@ class ROI(_RegionOfInterestBase): y = y[(x >= self._fromdata) & (x <= self._todata)] x = x[(x >= self._fromdata) & (x <= self._todata)] - if x.size is 0: + if x.size == 0: return 0.0, 0.0 rawArea = numpy.trapz(y, x=x) @@ -1268,6 +1269,10 @@ class ROI(_RegionOfInterestBase): netArea = rawArea - background return rawArea, netArea + @docstring(_RegionOfInterestBase) + def contains(self, position): + return self._fromdata <= position[0] <= self._todata + class _RoiMarkerManager(object): """ |