diff options
Diffstat (limited to 'examples/shiftPlotAction.py')
-rwxr-xr-x | examples/shiftPlotAction.py | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/examples/shiftPlotAction.py b/examples/shiftPlotAction.py index f272cda..3828732 100755 --- a/examples/shiftPlotAction.py +++ b/examples/shiftPlotAction.py @@ -1,8 +1,7 @@ #!/usr/bin/env python -# coding: utf-8 # /*########################################################################## # -# Copyright (c) 2016-2018 European Synchrotron Radiation Facility +# Copyright (c) 2016-2021 European Synchrotron Radiation Facility # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -46,14 +45,17 @@ class ShiftUpAction(PlotAction): :param plot: :class:`.PlotWidget` instance on which to operate :param parent: See :class:`QAction` """ + def __init__(self, plot, parent=None): - PlotAction.__init__(self, - plot, - icon='shape-circle', - text='Shift up', - tooltip='Shift active curve up by one unit', - triggered=self.shiftActiveCurveUp, - parent=parent) + PlotAction.__init__( + self, + plot, + icon="shape-circle", + text="Shift up", + tooltip="Shift active curve up by one unit", + triggered=self.shiftActiveCurveUp, + parent=parent, + ) def shiftActiveCurveUp(self): """Get the active curve, add 1 to all y values, use this new y @@ -63,9 +65,9 @@ class ShiftUpAction(PlotAction): activeCurve = self.plot.getActiveCurve() if activeCurve is None: - qt.QMessageBox.information(self.plot, - 'Shift Curve', - 'Please select a curve.') + qt.QMessageBox.information( + self.plot, "Shift Curve", "Please select a curve." + ) else: # Unpack curve data. # Each curve is represented by an object with methods to access: @@ -110,4 +112,4 @@ plotwin.addCurve(x, y1, legend="triangle shaped curve") plotwin.addCurve(x, y2, legend="oblique line") plotwin.show() -app.exec_() +app.exec() |