本文整理汇总了Python中silx.gui.plot.PlotWindow.isKeepDataAspectRatio方法的典型用法代码示例。如果您正苦于以下问题:Python PlotWindow.isKeepDataAspectRatio方法的具体用法?Python PlotWindow.isKeepDataAspectRatio怎么用?Python PlotWindow.isKeepDataAspectRatio使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类silx.gui.plot.PlotWindow
的用法示例。
在下文中一共展示了PlotWindow.isKeepDataAspectRatio方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestPlotWindow
# 需要导入模块: from silx.gui.plot import PlotWindow [as 别名]
# 或者: from silx.gui.plot.PlotWindow import isKeepDataAspectRatio [as 别名]
class TestPlotWindow(TestCaseQt):
"""Base class for tests of PlotWindow."""
def setUp(self):
super(TestPlotWindow, self).setUp()
self.plot = PlotWindow()
self.plot.show()
self.qWaitForWindowExposed(self.plot)
def tearDown(self):
self.plot.setAttribute(qt.Qt.WA_DeleteOnClose)
self.plot.close()
del self.plot
super(TestPlotWindow, self).tearDown()
def testActions(self):
"""Test the actions QToolButtons"""
self.plot.setLimits(1, 100, 1, 100)
checkList = [ # QAction, Plot state getter
(self.plot.xAxisAutoScaleAction, self.plot.getXAxis().isAutoScale),
(self.plot.yAxisAutoScaleAction, self.plot.getYAxis().isAutoScale),
(self.plot.xAxisLogarithmicAction, self.plot.getXAxis()._isLogarithmic),
(self.plot.yAxisLogarithmicAction, self.plot.getYAxis()._isLogarithmic),
(self.plot.gridAction, self.plot.getGraphGrid),
]
for action, getter in checkList:
self.mouseMove(self.plot)
initialState = getter()
toolButton = getQToolButtonFromAction(action)
self.assertIsNot(toolButton, None)
self.mouseClick(toolButton, qt.Qt.LeftButton)
self.assertNotEqual(getter(), initialState,
msg='"%s" state not changed' % action.text())
self.mouseClick(toolButton, qt.Qt.LeftButton)
self.assertEqual(getter(), initialState,
msg='"%s" state not changed' % action.text())
# Trigger a zoom reset
self.mouseMove(self.plot)
resetZoomAction = self.plot.resetZoomAction
toolButton = getQToolButtonFromAction(resetZoomAction)
self.assertIsNot(toolButton, None)
self.mouseClick(toolButton, qt.Qt.LeftButton)
def testToolAspectRatio(self):
self.plot.toolBar()
self.plot.keepDataAspectRatioButton.keepDataAspectRatio()
self.assertTrue(self.plot.isKeepDataAspectRatio())
self.plot.keepDataAspectRatioButton.dontKeepDataAspectRatio()
self.assertFalse(self.plot.isKeepDataAspectRatio())
def testToolYAxisOrigin(self):
self.plot.toolBar()
self.plot.yAxisInvertedButton.setYAxisUpward()
self.assertFalse(self.plot.getYAxis().isInverted())
self.plot.yAxisInvertedButton.setYAxisDownward()
self.assertTrue(self.plot.getYAxis().isInverted())