BU-hammerTeam / PyHammer

A Python Spectral Typing Suite
MIT License
53 stars 14 forks source link

_active deprecated in NavigationToolbar2QT in newer version of matplotlib #40

Open ctheissen opened 4 years ago

ctheissen commented 4 years ago

It seems the _active trait is deprecated in NavigationToolbar2QT in newer version of matplotlib. The new trait is _actions. This is a small fix in eyecheck.py line 532. Just change _active to _actions. I am currently using matplotlib 3.3.1

zephyr5050 commented 4 years ago

Looks like this is Line 649 on the master branch. You may be referencing an older version of the file. I would also be cautious about breaking backwards compatibility. I think the best option here would be to check matplotlib.__version__ and if it is newer than whatever version the change occurred in, use _active and otherwise use _actions.

I'd suggest something like the following:

            action = self.toolbar._active if matplotlib< <specific_version> else self.toolbar._actions
            if action != 'ZOOM':
                # Make it so the zoom button is selected by default
                self.toolbar.zoom()

where a more correct method is used for comparing the version as matplotlib.__version__ returns a string.