Skip to content

let Qt4 backend ignore extra mouse buttons (fixes exceptions) #894

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

Merged
merged 2 commits into from
May 24, 2012

Conversation

hmeine
Copy link
Contributor

@hmeine hmeine commented May 23, 2012

My mouse has more than three buttons, so I noticed by accident that the current qt4 backend does not cope with mouse events on the canvas for these buttons (but throws exceptions). Apart from fixing the exception, I introduced the use of Qt constants for readability, and added the two missing constants for the extra buttons in case someone wants to pick this up later and introduce support for these buttons.

This was discussed in pull request #890 and now rebased onto the v1.1.x branch as requested. (Note that during the rebase, the fix of the double-click handler got removed, because that one’s not present in 1.1.x yet.)

button = self.buttond.get(event.button())
if button is not None: # only three buttons supported by MouseEvent
FigureCanvasBase.button_press_event( self, x, y, button )
if DEBUG: print('button pressed:', event.button())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to double check, is the print statement going to break older python versions in the 1.1.x branch?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why should it? Python 2.x will see a statement that outputs a tuple. (Sorry for the noise, the change came from master by accident.)

@mdboom
Copy link
Member

mdboom commented May 23, 2012

Thanks for the rebase. This looks good to go, and works for me.

@pelson
Copy link
Member

pelson commented May 24, 2012

+1

mdboom added a commit that referenced this pull request May 24, 2012
let Qt4 backend ignore extra mouse buttons (fixes exceptions)
@mdboom mdboom merged commit 892c715 into matplotlib:v1.1.x May 24, 2012
@hmeine hmeine deleted the qt4_ignore_extra_mouse_buttons branch April 2, 2014 08:02
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