|
1 | 1 | import functools |
2 | 2 | import logging |
3 | 3 | import os |
4 | | -from pathlib import Path |
5 | 4 | import sys |
| 5 | +from pathlib import Path |
6 | 6 |
|
7 | 7 | import matplotlib as mpl |
8 | 8 | from matplotlib import _api, backend_tools, cbook |
9 | 9 | from matplotlib._pylab_helpers import Gcf |
10 | 10 | from matplotlib.backend_bases import ( |
11 | 11 | _Backend, FigureCanvasBase, FigureManagerBase, NavigationToolbar2, |
12 | 12 | StatusbarBase, TimerBase, ToolContainerBase, cursors) |
13 | | -from matplotlib.figure import Figure |
14 | | -from matplotlib.widgets import SubplotTool |
15 | 13 |
|
16 | 14 | try: |
17 | 15 | import gi |
@@ -213,17 +211,21 @@ def size_allocate(self, widget, allocation): |
213 | 211 | self.draw_idle() |
214 | 212 |
|
215 | 213 | def _get_key(self, event): |
| 214 | + unikey = chr(Gdk.keyval_to_unicode(event.keyval)) |
216 | 215 | key = cbook._unikey_or_keysym_to_mplkey( |
217 | | - chr(Gdk.keyval_to_unicode(event.keyval)), |
| 216 | + unikey, |
218 | 217 | Gdk.keyval_name(event.keyval)) |
219 | 218 | modifiers = [ |
220 | | - (Gdk.ModifierType.MOD4_MASK, 'super'), |
221 | | - (Gdk.ModifierType.MOD1_MASK, 'alt'), |
222 | | - (Gdk.ModifierType.CONTROL_MASK, 'ctrl'), |
223 | | - ] |
| 219 | + (Gdk.ModifierType.CONTROL_MASK, 'ctrl'), |
| 220 | + (Gdk.ModifierType.MOD1_MASK, 'alt'), |
| 221 | + (Gdk.ModifierType.SHIFT_MASK, 'shift'), |
| 222 | + (Gdk.ModifierType.MOD4_MASK, 'super'), |
| 223 | + ] |
224 | 224 | for key_mask, prefix in modifiers: |
225 | 225 | if event.state & key_mask: |
226 | | - key = '{0}+{1}'.format(prefix, key) |
| 226 | + if not (prefix == 'shift' and unikey.isprintable()): |
| 227 | + key = '{0}+{1}'.format(prefix, key) |
| 228 | + break |
227 | 229 | return key |
228 | 230 |
|
229 | 231 | def configure_event(self, widget, event): |
|
0 commit comments