Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Simple GUI interface enhancements #851

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 12 commits into from
Jul 1, 2012
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Added better 'super' key support.
  • Loading branch information
pelson authored and pelson committed Jun 24, 2012
commit 677f430b8011b6e3f3777a70784dbdc65a5aa446
4 changes: 3 additions & 1 deletion 4 lib/matplotlib/backends/backend_gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,9 @@ def _get_key(self, event):
else:
key = None

for key_mask, prefix in ([gdk.MOD1_MASK, 'alt'],
for key_mask, prefix in (
[gdk.MOD4_MASK, 'super'],
[gdk.MOD1_MASK, 'alt'],
[gdk.CONTROL_MASK, 'ctrl'],):
if event.state & key_mask:
key = '{}+{}'.format(prefix, key)
Expand Down
10 changes: 9 additions & 1 deletion 10 lib/matplotlib/backends/backend_gtk3.py
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,15 @@ def _get_key(self, event):
else:
key = None

# TODO: Handle ctrl, alt, super modifiers. gtk backend has implemented.
modifiers = [
(Gdk.ModifierType.MOD4_MASK, 'super'),
(Gdk.ModifierType.MOD1_MASK, 'alt'),
(Gdk.ModifierType.CONTROL_MASK, 'ctrl'),
]
for key_mask, prefix in modifiers:
if event.state & key_mask:
key = '{}+{}'.format(prefix, key)

return key

def configure_event(self, widget, event):
Expand Down
14 changes: 11 additions & 3 deletions 14 lib/matplotlib/backends/backend_tkagg.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class FigureCanvasTkAgg(FigureCanvasAgg):
keyvald = {65507 : 'control',
65505 : 'shift',
65513 : 'alt',
65515 : 'super',
65508 : 'control',
65506 : 'shift',
65514 : 'alt',
Expand Down Expand Up @@ -184,7 +185,8 @@ class FigureCanvasTkAgg(FigureCanvasAgg):
131074: 'shift',
131076: 'shift',
}
"""_keycode_lookup is used for badly mapped keys on apple keyboards."""
"""_keycode_lookup is used for badly mapped (i.e. no event.key_sym set)
keys on apple keyboards."""

def __init__(self, figure, master=None, resize_callback=None):
FigureCanvasAgg.__init__(self, figure)
Expand Down Expand Up @@ -434,9 +436,15 @@ def _get_key(self, event):
# In general, the modifier key is excluded from the modifier flag,
# however this is not the case on "darwin", so double check that
# we aren't adding repeat modifier flags to a modifier key.
modifiers = (3, 'alt', 'alt'), (2, 'ctrl', 'control'),
modifiers = [(6, 'super', 'super'),
(3, 'alt', 'alt'),
(2, 'ctrl', 'control'),
]
if sys.platform == 'darwin':
modifiers = (3, 'super', 'super'), (4, 'alt', 'alt'), (2, 'ctrl', 'control'),
modifiers = [(3, 'super', 'super'),
(4, 'alt', 'alt'),
(2, 'ctrl', 'control'),
]

if key is not None:
# note, shift is not added to the keys as this is already accounted for
Expand Down
4 changes: 3 additions & 1 deletion 4 lib/matplotlib/backends/backend_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -1251,7 +1251,9 @@ def _get_key(self, evt):
else:
key = None

for meth, prefix in ([evt.AltDown, 'alt'], [evt.ControlDown, 'ctrl'], ):
for meth, prefix in (
[evt.AltDown, 'alt'],
[evt.ControlDown, 'ctrl'], ):
if meth():
key = '{}+{}'.format(prefix, key)

Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.