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 initialization problem with useblit on SpanSelector instance creatio... #1971

Closed

Conversation

cimarronm
Copy link
Contributor

...n.

@cimarronm
Copy link
Contributor Author

This fixes an initialization problem where useblit variable is used in function new_axes before it is initialized as seen below

  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.3.x-py3.3-macosx-10.6-intel.egg/matplotlib/widgets.py", line 1077, in __init__
    self.new_axes(ax)
  File "/Library/Frameworks/Python.framework/Versions/3.3/lib/python3.3/site-packages/matplotlib-1.3.x-py3.3-macosx-10.6-intel.egg/matplotlib/widgets.py", line 1104, in new_axes
    if not self.useblit:
AttributeError: 'SpanSelector' object has no attribute 'useblit'

This sets the instance useblit to what was given at instance initialization and then disables it if the new canvas setting does not support blit in the new_axis function. I believe this was the intention in commit dd325759

@mdboom
Copy link
Member

mdboom commented May 3, 2013

👍

@pelson
Copy link
Member

pelson commented May 7, 2013

Ah, I've just merged #1982 which I think was an alternative fix. @efiring & @cimarronm - is there a crossover here which we need to resolve? Otherwise, I think this PR can be closed.

Cheers,

@efiring
Copy link
Member

efiring commented May 7, 2013

@pelson, @cimarronm: Sorry, I didn't even think to scan the existing PRs and issues before generating a PR, so I completely missed this. I considered exactly the solution used in this PR, but decided on the alternative in #1982 because it seems simpler to just set the useblit on initialization and be done with it. Are there any circumstances under which this would be incorrect? Is it possible for a SpanSelector to be initialized with one canvas (via its ax argument) and then to have its new_axes() method called with a canvas from a different backend, with a different value of supports_blit? I couldn't imagine it; but if I'm wrong, then @cimarronm's solution is correct and mine is not.

@mdboom
Copy link
Member

mdboom commented May 10, 2013

@cimarronm, @pelson, @efiring: I'm fine with @efiring's simpler solution for the same reason he states: I'm having trouble imagining a case where it matters. However, @cimarronm, if you have a case where this is superior, feel free to reopen and ping us.

Thanks for the contribution, and keep em coming!

@mdboom mdboom closed this May 10, 2013
@cimarronm
Copy link
Contributor Author

@efiring, @mdboom, @pelson: I agree. @efiring's patch should work just fine as the backend shouldn't change so I am fine with it.

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.

None yet

4 participants