PlotPyStack / PythonQwt

Qt plotting widgets for Python (pure Python reimplementation of Qwt C++ library)
https://pypi.org/project/PythonQwt/
Other
86 stars 25 forks source link

AttributeError: 'QwtScaleWidget' object has no attribute 'maxMajor' / 'maxMinor' / 'stepSize' #72

Closed jkaercher closed 1 year ago

jkaercher commented 2 years ago

Hi,

QwtPlot.axisMaxMinor and QwtPlot.axisStepSize access their respective attributes from self.axisWidget(axisId). This results in these exceptions:

Traceback (most recent call last):
  File "/tmp/example.py", line 13, in <module>
    plot.axisMaxMinor(qwt.QwtPlot.xBottom)
  File "/opt/conda/envs/bnpython/lib/python3.10/site-packages/qwt/plot.py", line 603, in axisMaxMinor
    return self.axisWidget(axisId).maxMinor
AttributeError: 'QwtScaleWidget' object has no attribute 'maxMinor'
Traceback (most recent call last):
  File "/tmp/example.py", line 16, in <module>
    plot.axisStepSize(qwt.QwtPlot.xBottom)
  File "/opt/conda/envs/bnpython/lib/python3.10/site-packages/qwt/plot.py", line 644, in axisStepSize
    return self.axisWidget(axisId).stepSize
AttributeError: 'QwtScaleWidget' object has no attribute 'stepSize'

Looks like both methods should access from self.__axisData[axisId] instead.

Example code to reproduce the exceptions:

import sys

from PyQt5 import QtWidgets
import qwt

if __name__ == "__main__":
    app = QtWidgets.QApplication(sys.argv)

    plot = qwt.QwtPlot()

    # exception 1:
    plot.axisMaxMinor(qwt.QwtPlot.xBottom)

    # exception 2:
    plot.axisStepSize(qwt.QwtPlot.xBottom)

    plot.show()
    sys.exit(app.exec_())