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

Fix graph not displaying due to matplotlib class update #197

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

RephlexZero
Copy link

@RephlexZero RephlexZero commented Apr 16, 2024

I use arch (AUR Package), the calibration graph display had stopped working, I saw the following error:

Traceback (most recent call last):
  File "/usr/lib/python3.11/site-packages/oversteer/gtk_handlers.py", line 265, in on_test_open_chart_button_clicked
    self.controller.open_test_chart()
  File "/usr/lib/python3.11/site-packages/oversteer/gui.py", line 599, in open_test_chart
    toolbar = self.combined_chart.get_navigation_toolbar(canvas, self.ui.window)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/oversteer/combined_chart.py", line 88, in get_navigation_toolbar
    return NavigationToolbar(canvas, window)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: NavigationToolbar2GTK3.__init__() takes 2 positional arguments but 3 were given

Caused by: https://github.com/matplotlib/matplotlib/blob/2723052176c2e1e5cc192061121423ad6685c954/lib/matplotlib/backends/backend_gtk3.py#L290

This PR proposes a fix to the matplotlib class changes only taking one argument by removing the window.

Hope this is helpful :)

@berarma
Copy link
Owner

berarma commented Apr 18, 2024

Yes, thanks!

I guess this change will be incompatible with previous versions. Would there be a way to keep the compatibility?

I'm having an issue with the Gtk3 backend on my computer and can't test this PR. I will get back to it when I fix it.

@RephlexZero
Copy link
Author

Not sure, but I think it makes most sense to update oversteer to follow matplotlib? Package manager should be keeping matplotlib up to date so putting in checks for its version and working around it seems wrong?
Thanks for your great work.

@jo5huajohn
Copy link
Contributor

Could something like this work?

def get_navigation_toolbar(self, canvas, window=None):
    return NavigationToolbar(canvas) if matplotlib.__version__ >= '3.6' else NavigationToolbar(canvas, window)

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.

3 participants