本文整理汇总了Python中silx.gui.plot.PlotWindow.addTabbedDockWidget方法的典型用法代码示例。如果您正苦于以下问题:Python PlotWindow.addTabbedDockWidget方法的具体用法?Python PlotWindow.addTabbedDockWidget怎么用?Python PlotWindow.addTabbedDockWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类silx.gui.plot.PlotWindow
的用法示例。
在下文中一共展示了PlotWindow.addTabbedDockWidget方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestCurveLegendsWidget
# 需要导入模块: from silx.gui.plot import PlotWindow [as 别名]
# 或者: from silx.gui.plot.PlotWindow import addTabbedDockWidget [as 别名]
class TestCurveLegendsWidget(TestCaseQt, ParametricTestCase):
"""Tests for CurveLegendsWidget class"""
def setUp(self):
super(TestCurveLegendsWidget, self).setUp()
self.plot = PlotWindow()
self.legends = CurveLegendsWidget.CurveLegendsWidget()
self.legends.setPlotWidget(self.plot)
dock = qt.QDockWidget()
dock.setWindowTitle('Curve Legends')
dock.setWidget(self.legends)
self.plot.addTabbedDockWidget(dock)
self.plot.show()
self.qWaitForWindowExposed(self.plot)
def tearDown(self):
del self.legends
self.qapp.processEvents()
self.plot.setAttribute(qt.Qt.WA_DeleteOnClose)
self.plot.close()
del self.plot
super(TestCurveLegendsWidget, self).tearDown()
def _assertNbLegends(self, count):
"""Check the number of legends in the CurveLegendsWidget"""
children = self.legends.findChildren(CurveLegendsWidget._LegendWidget)
self.assertEqual(len(children), count)
def testAddRemoveCurves(self):
"""Test CurveLegendsWidget while adding/removing curves"""
self.plot.addCurve((0, 1), (1, 2), legend='a')
self._assertNbLegends(1)
self.plot.addCurve((0, 1), (2, 3), legend='b')
self._assertNbLegends(2)
# Detached/attach
self.legends.setPlotWidget(None)
self._assertNbLegends(0)
self.legends.setPlotWidget(self.plot)
self._assertNbLegends(2)
self.plot.clear()
self._assertNbLegends(0)
def testUpdateCurves(self):
"""Test CurveLegendsWidget while updating curves """
self.plot.addCurve((0, 1), (1, 2), legend='a')
self._assertNbLegends(1)
self.plot.addCurve((0, 1), (2, 3), legend='b')
self._assertNbLegends(2)
# Activate curve
self.plot.setActiveCurve('a')
self.qapp.processEvents()
self.plot.setActiveCurve('b')
self.qapp.processEvents()
# Change curve style
curve = self.plot.getCurve('a')
curve.setLineWidth(2)
for linestyle in (':', '', '--', '-'):
with self.subTest(linestyle=linestyle):
curve.setLineStyle(linestyle)
self.qapp.processEvents()
self.qWait(1000)
for symbol in ('o', 'd', '', 's'):
with self.subTest(symbol=symbol):
curve.setSymbol(symbol)
self.qapp.processEvents()
self.qWait(1000)