本文整理匯總了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)