(event, *, exclude=None)
| 420 | |
| 421 | @staticmethod |
| 422 | def _mpl_modifiers(event, *, exclude=None): |
| 423 | # Add modifier keys to the key string. Bit values are inferred from |
| 424 | # the implementation of tkinter.Event.__repr__ (1, 2, 4, 8, ... = |
| 425 | # Shift, Lock, Control, Mod1, ..., Mod5, Button1, ..., Button5) |
| 426 | # In general, the modifier key is excluded from the modifier flag, |
| 427 | # however this is not the case on "darwin", so double check that |
| 428 | # we aren't adding repeat modifier flags to a modifier key. |
| 429 | modifiers = [ |
| 430 | ("ctrl", 1 << 2, "control"), |
| 431 | ("alt", 1 << 17, "alt"), |
| 432 | ("shift", 1 << 0, "shift"), |
| 433 | ] if sys.platform == "win32" else [ |
| 434 | ("ctrl", 1 << 2, "control"), |
| 435 | ("alt", 1 << 4, "alt"), |
| 436 | ("shift", 1 << 0, "shift"), |
| 437 | ("cmd", 1 << 3, "cmd"), |
| 438 | ] if sys.platform == "darwin" else [ |
| 439 | ("ctrl", 1 << 2, "control"), |
| 440 | ("alt", 1 << 3, "alt"), |
| 441 | ("shift", 1 << 0, "shift"), |
| 442 | ("super", 1 << 6, "super"), |
| 443 | ] |
| 444 | return [name for name, mask, key in modifiers |
| 445 | if event.state & mask and exclude != key] |
| 446 | |
| 447 | def _get_key(self, event): |
| 448 | unikey = event.char |
no outgoing calls
no test coverage detected