本文整理汇总了Python中silx.gui.plot.PlotWindow._getAllMarkers方法的典型用法代码示例。如果您正苦于以下问题:Python PlotWindow._getAllMarkers方法的具体用法?Python PlotWindow._getAllMarkers怎么用?Python PlotWindow._getAllMarkers使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类silx.gui.plot.PlotWindow
的用法示例。
在下文中一共展示了PlotWindow._getAllMarkers方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCurvesROIWidget
# 需要导入模块: from silx.gui.plot import PlotWindow [as 别名]
# 或者: from silx.gui.plot.PlotWindow import _getAllMarkers [as 别名]
#.........这里部分代码省略.........
roiWidget = self.plot.getCurvesRoiDockWidget().roiWidget
self.plot.getCurvesRoiDockWidget().setRois(roisDefs)
self.assertTrue(len(roiWidget.getRois()) is len(roisDefs))
self.plot.getCurvesRoiDockWidget().setVisible(True)
self.assertTrue(len(roiWidget.getRois()) is len(roisDefs))
def testDictCompatibility(self):
"""Test that ROI api is valid with dict and not information is lost"""
roiDict = {'from': 20, 'to': 200, 'type': 'energy', 'comment': 'no',
'name': 'myROI', 'calibration': [1, 2, 3]}
roi = CurvesROIWidget.ROI._fromDict(roiDict)
self.assertTrue(roi.toDict() == roiDict)
def testShowAllROI(self):
"""Test the show allROI action"""
x = numpy.arange(100.)
y = numpy.arange(100.)
self.plot.addCurve(x=x, y=y, legend="name", replace="True")
roisDefsDict = {
"range1": {"from": 20, "to": 200,"type": "energy"},
"range2": {"from": 300, "to": 500, "type": "energy"}
}
roisDefsObj = (
CurvesROIWidget.ROI(name='range3', fromdata=20, todata=200,
type_='energy'),
CurvesROIWidget.ROI(name='range4', fromdata=300, todata=500,
type_='energy')
)
self.widget.roiWidget.showAllMarkers(True)
roiWidget = self.plot.getCurvesRoiDockWidget().roiWidget
roiWidget.setRois(roisDefsDict)
self.assertTrue(len(self.plot._getAllMarkers()) is 2*3)
markersHandler = self.widget.roiWidget.roiTable._markersHandler
roiWidget.showAllMarkers(True)
ICRROI = markersHandler.getVisibleRois()
self.assertTrue(len(ICRROI) is 2)
roiWidget.showAllMarkers(False)
ICRROI = markersHandler.getVisibleRois()
self.assertTrue(len(ICRROI) is 1)
roiWidget.setRois(roisDefsObj)
self.qapp.processEvents()
self.assertTrue(len(self.plot._getAllMarkers()) is 2*3)
markersHandler = self.widget.roiWidget.roiTable._markersHandler
roiWidget.showAllMarkers(True)
ICRROI = markersHandler.getVisibleRois()
self.assertTrue(len(ICRROI) is 2)
roiWidget.showAllMarkers(False)
ICRROI = markersHandler.getVisibleRois()
self.assertTrue(len(ICRROI) is 1)
def testRoiEdition(self):
"""Make sure if the ROI object is edited the ROITable will be updated
"""
roi = CurvesROIWidget.ROI(name='linear', fromdata=0, todata=5)
self.widget.roiWidget.setRois((roi, ))
x = (0, 1, 1, 2, 2, 3)
y = (1, 1, 2, 2, 1, 1)
self.plot.addCurve(x=x, y=y, legend='linearCurve')