| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
|
Do you want to take a crack at making this work for the other backends? |
Sorry, something went wrong.
| self.callbacks.process(s, mouseevent) | ||
|
|
||
| def button_press_event(self, x, y, button, dblclick=False, guiEvent=None): | ||
| def button_press_event(self, x, y, button, dblclick=False, modifiers=None, guiEvent=None): |
There was a problem hiding this comment.
Please put new kwargs last.
Sorry, something went wrong.
|
I'll take a look. |
Sorry, something went wrong.
| y = self.figure.bbox.height - event.pos().y() | ||
| button = self.buttond.get(event.button()) | ||
| modifiers = "+".join([name for name, mod_key, qt_key in MODIFIER_KEYS | ||
| if (int(event.modifiers()) & mod_key) == mod_key]) |
There was a problem hiding this comment.
Maybe make modifiers a set instead of a string like "ctrl+alt"? Also, I think this could be simplified to
name for name, mod_key, _ in MODIFIER_KEYS if event.modifiers() & mod_key
Sorry, something went wrong.
There was a problem hiding this comment.
Since 2.1 is dropping 2.6 support, you write that in a set comprehension style.
Sorry, something went wrong.
There was a problem hiding this comment.
We have already dropped 2.6 support (but test it on the 1.5.x because we are nice).
Sorry, something went wrong.
|
You'll want to update the docs as well, both to mention the existence of .modifiers (so that people know it exists!), and probably also to modify the docs for for .key to explain its limitations and why .modifiers is better in most cases. [FYI for context @mdboom @tacaswell: @jerryz123's an undergrad working with @stefanv and me on viscm-stuff, and this came out of that.] |
Sorry, something went wrong.
|
Could someone take a look at this? I've added support for tk, gtk, qt, and wx. |
Sorry, something went wrong.
|
@tacaswell Do you know who is familiar enough with the mac backend to give Jerry a hand? |
Sorry, something went wrong.
|
@mdboom probably. The mac backend just had some (major!) changes land. It On Mon, Apr 4, 2016 at 10:43 PM Stefan van der Walt <
|
Sorry, something went wrong.
|
The mac backend appears to use modifiers to alter the button clicked. A Ctrl+Click registers as a right button click, while an Alt+Click registers as a middle button click. Should this be changed? |
Sorry, something went wrong.
|
I am leaning towards yes on changing the behavior of the mac backend. The single-button external mice seem to have died and I think on all of the fancy trackpads are now multi touch (so 2 and 3 finger taps/clicks are the right/middle mouse events). |
Sorry, something went wrong.
|
@jerryz123 Are you still interested in working on this? |
Sorry, something went wrong.
|
@tacaswell Sorry for the delay. I have adjusted the mac behavior so that modifier keys are preserved on mouse clicks. What would be the correct way to get test coverage over modifier key behavior? |
Sorry, something went wrong.
|
We have some test of the qt5 backend which feed synthetic events through. We don't have good tests for the other backends other than manually testing by devs. |
Sorry, something went wrong.
|
And the delay is as much on our side! |
Sorry, something went wrong.
|
This seems useful if @jerryz123 or someone else had time to rebase and get it working again... |
Sorry, something went wrong.
|
Superseded by #23473. Thanks for initiating the work on this! |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Problem:
Currently, modifier keys in MouseEvents are only recognized if the FigureCanvas received a KeyEvent with the MouseEvent. However, in situations where the FigureCanvas does not receive keyboard focus, no KeyEvent is received, and thus the modifier-key is lost.
Solution
Modifier-key info should be carried in the MouseEvent created by a button_press_event. Add a modifiers field to mouse_events to track modifier-key status. I have updated the qt5 backend to account for this, but this can easily be extended to other backends.