anetczuk/LinakDeskApp

Matplotlib: NotImplementedError on removeButton('Subplots')

monofox opened this issue · 3 comments

I tried this app (master clone) and failing. I'm using Gentoo Linux.

Environment:

Linux 5.9.2-gentoo #2 SMP Sat Nov 7 13:43:31 CET 2020
Python 3.8.6
Matplotlib 3.3.3 (with wxwidgets, cairo, qt5)
Pandas 1.1.4-r1

Hardware: Linak DPG1C

Executing python3 -m linakdeskapp results in:

2020-11-28 20:35:58,177 DEBUG    MainThread linakdeskapp.main:main [main.py:108] Starting the application
2020-11-28 20:35:58,177 DEBUG    MainThread linakdeskapp.main:main [main.py:109] Logger log file: /home/mono/.projects/LinakDeskApp/src/log.txt
/home/mono/.projects/LinakDeskApp/src/linakdeskapp/gui/mpl/mpl_toolbar.py:39: MatplotlibDeprecationWarning:
The _init_toolbar function was deprecated in Matplotlib 3.3 and will be removed two minor releases later. Use __init__ instead.
  self._init_toolbar()    ## add current buttons
2020-11-28 20:35:58,632 ERROR    MainThread linakdeskapp.main:main [main.py:131] Exception occurred
Traceback (most recent call last):
  File "/home/mono/.projects/LinakDeskApp/src/linakdeskapp/main.py", line 124, in main
    exitCode = runApp(args)
  File "/home/mono/.projects/LinakDeskApp/src/linakdeskapp/main.py", line 77, in runApp
    window = MainWindow()
  File "/home/mono/.projects/LinakDeskApp/src/linakdeskapp/gui/main_window.py", line 51, in __init__
    self.ui.setupUi(self)
  File "<string>", line 26, in setupUi
  File "/home/mono/.projects/LinakDeskApp/src/linakdeskapp/gui/app_settings_widget.py", line 85, in __init__
    self.ui.setupUi(self)
  File "<string>", line 41, in setupUi
  File "/home/mono/.projects/LinakDeskApp/src/linakdeskapp/gui/position_chart_widget.py", line 57, in __init__
    self.toolbar = DynamicToolbar(self.ui.positionChart, self)
  File "/home/mono/.projects/LinakDeskApp/src/linakdeskapp/gui/mpl/mpl_toolbar.py", line 27, in __init__
    self.removeButton( 'Subplots' )
  File "/home/mono/.projects/LinakDeskApp/src/linakdeskapp/gui/mpl/mpl_toolbar.py", line 39, in removeButton
    self._init_toolbar()    ## add current buttons
  File "/usr/lib/python3.8/site-packages/matplotlib/cbook/deprecation.py", line 234, in wrapper
    return func(*args, **kwargs)
  File "/usr/lib/python3.8/site-packages/matplotlib/backend_bases.py", line 2942, in _init_toolbar
    raise NotImplementedError
NotImplementedError

2020-11-28 20:35:58,634 INFO     MainThread linakdeskapp.main:main [main.py:147] Calculation time:  456.26497269ms

May i need some different versions of libraries? To be honest, i didn't worked yet with matplotlib and not sure, whats its trying here.

If i should try something, please let me know.

Thanks and best regards.

Confirming, its because of _init_toolbar deprecation. Commenting it out as well as the prev. clear, shows the gui

Fixed, please test/verify with new code

Works perfectly, thank you @anetczuk !