Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added missing import MplToolbar. #178

Closed
wants to merge 1 commit into from
Closed

Added missing import MplToolbar. #178

wants to merge 1 commit into from

Conversation

JanCBrammer
Copy link

No description provided.

@JanCBrammer JanCBrammer closed this Aug 7, 2020
@chipmuenk
Copy link
Owner

Thanx for contributing! Was your commit unneccessary or why did you close it so fast?

@JanCBrammer
Copy link
Author

@chipmuenk, calling pyfdax in a conda environment with Matplotlib 3.3.0 produces an error (works fine with 3.2.0).

I thought that it'd be easily fixed by importing MplToolbar. However, after (prematurely) making the PR I saw that you wrote a custom MplToolbar by subclassing NavigationToolbar.

The traceback for the pyfdax call is as follows :

Traceback (most recent call last):
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\runpy.py", line 193, in _run_module_as_main
    "__main__", mod_spec)
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "C:\Users\JohnDoe\miniconda3\envs\pyfda\Scripts\pyfdax.exe\__main__.py", line 7, in <module>
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\pyfdax.py", line 290, in main
    mainw = pyFDA()
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\pyfdax.py", line 134, in __init__
    self._construct_UI()
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\pyfdax.py", line 147, in _construct_UI
    pltTabWidgets = plot_tab_widgets.PlotTabWidgets(self) # plot widgets
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\plot_widgets\plot_tab_widgets.py", line 34, in __init__
    self._construct_UI()
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\plot_widgets\plot_tab_widgets.py", line 72, in _construct_UI
    inst = wdg_class(self)
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\plot_widgets\plot_hf.py", line 49, in __init__
    self._construct_ui()
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\plot_widgets\plot_hf.py", line 159, in _construct_ui
    self.mplwidget = MplWidget(self)
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\plot_widgets\mpl_widget.py", line 96, in __init__
    self.mplToolbar = MplToolbar(self.pltCanv, self) # inherits all methods
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\plot_widgets\mpl_widget.py", line 241, in __init__
    NavigationToolbar.__init__(self, *args, **kwargs)
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\matplotlib\backends\backend_qt5.py", line 687, in __init__
    NavigationToolbar2.__init__(self, canvas)
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\matplotlib\backend_bases.py", line 2853, in __init__
    init()
  File "c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\plot_widgets\mpl_widget.py", line 284, in _init_toolbar
    'Zoom full extent', self.parent.plt_full_view)
AttributeError: 'NoneType' object has no attribute 'plt_full_view'

There are two Matplotlib deprecation warnings that might be related to the AttributeError:

The _init_toolbar method was deprecated in Matplotlib 3.3 and will be removed two minor releases later. Please fully initialize the toolbar in your subclass' __init__; a fully empty _init_toolbar implementation may be kept for compatibility with earlier versions of Matplotlib.
  NavigationToolbar.__init__(self, *args, **kwargs)
c:\users\johndoe\miniconda3\envs\pyfda\lib\site-packages\pyfda\plot_widgets\mpl_widget.py:284: MatplotlibDeprecationWarning:
The parent attribute was deprecated in Matplotlib 3.3 and will be removed two minor releases later. Use self.canvas.setParent() instead.

This is the environment:

# Name                    Version                   Build  Channel
ca-certificates           2020.6.20            hecda079_0    conda-forge
certifi                   2020.6.20        py37hc8dfbb8_0    conda-forge
colorama                  0.4.3                    pypi_0    pypi
cycler                    0.10.0                   pypi_0    pypi
docutils                  0.16                     pypi_0    pypi
icu                       64.2                 he025d50_1    conda-forge
jpeg                      9d                   he774522_0    conda-forge
kiwisolver                1.2.0                    pypi_0    pypi
libclang                  9.0.1           default_hf44288c_0    conda-forge
libpng                    1.6.37               hfe6a214_1    conda-forge
matplotlib                3.3.0                    pypi_0    pypi
migen                     0.9.2                    pypi_0    pypi
numpy                     1.19.1                   pypi_0    pypi
openssl                   1.1.1g               he774522_1    conda-forge
pillow                    7.2.0                    pypi_0    pypi
pip                       20.2.1                     py_0    conda-forge
pyfda                     0.3.1                    pypi_0    pypi
pyparsing                 2.4.7                    pypi_0    pypi
pyqt                      5.12.3           py37h6538335_1    conda-forge
pyqt5-sip                 4.19.18                  pypi_0    pypi
pyqtwebengine             5.12.1                   pypi_0    pypi
python                    3.7.8           h60c2a47_1_cpython    conda-forge
python-dateutil           2.8.1                    pypi_0    pypi
python_abi                3.7                     1_cp37m    conda-forge
qt                        5.12.5               h7ef1ec2_0    conda-forge
scipy                     1.5.2                    pypi_0    pypi
setuptools                49.2.1           py37hc8dfbb8_0    conda-forge
six                       1.15.0                   pypi_0    pypi
sqlite                    3.32.3               he774522_1    conda-forge
vc                        14.1                 h869be7e_1    conda-forge
vs2015_runtime            14.16.27012          h30e32a0_2    conda-forge
wheel                     0.34.2                     py_1    conda-forge
wincertstore              0.2                   py37_1003    conda-forge
zlib                      1.2.11            h2fa13f4_1006    conda-forge

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants