當前位置: 首頁>>代碼示例>>Python>>正文


Python PlotWindow.isYAxisInverted方法代碼示例

本文整理匯總了Python中silx.gui.plot.PlotWindow.isYAxisInverted方法的典型用法代碼示例。如果您正苦於以下問題:Python PlotWindow.isYAxisInverted方法的具體用法?Python PlotWindow.isYAxisInverted怎麽用?Python PlotWindow.isYAxisInverted使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在silx.gui.plot.PlotWindow的用法示例。


在下文中一共展示了PlotWindow.isYAxisInverted方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: TestPlotWindow

# 需要導入模塊: from silx.gui.plot import PlotWindow [as 別名]
# 或者: from silx.gui.plot.PlotWindow import isYAxisInverted [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.isXAxisAutoScale),
            (self.plot.yAxisAutoScaleAction, self.plot.isYAxisAutoScale),
            (self.plot.xAxisLogarithmicAction, self.plot.isXAxisLogarithmic),
            (self.plot.yAxisLogarithmicAction, self.plot.isYAxisLogarithmic),
            (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.isYAxisInverted())
        self.plot.yAxisInvertedButton.setYAxisDownward()
        self.assertTrue(self.plot.isYAxisInverted())
開發者ID:CaptainNemoz,項目名稱:silx,代碼行數:62,代碼來源:testPlotWindow.py


注:本文中的silx.gui.plot.PlotWindow.isYAxisInverted方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。