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

Commit 9dfd953

Browse filesBrowse files
committed
More osx tweaks
1 parent 677f430 commit 9dfd953
Copy full SHA for 9dfd953

File tree

Expand file treeCollapse file tree

3 files changed

+17
-11
lines changed
Filter options
Expand file treeCollapse file tree

3 files changed

+17
-11
lines changed

‎lib/matplotlib/backends/backend_gtk.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_gtk.py
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ class FigureCanvasGTK (gtk.DrawingArea, FigureCanvasBase):
189189
65455 : '/',
190190
65439 : 'dec',
191191
65421 : 'enter',
192+
65511 : 'super',
193+
65512 : 'super',
194+
65406 : 'alt',
195+
65289 : 'tab',
192196
}
193197

194198
# Setting this as a static constant prevents
@@ -326,7 +330,7 @@ def _get_key(self, event):
326330
key = chr(event.keyval)
327331
else:
328332
key = None
329-
333+
330334
for key_mask, prefix in (
331335
[gdk.MOD4_MASK, 'super'],
332336
[gdk.MOD1_MASK, 'alt'],
@@ -336,7 +340,6 @@ def _get_key(self, event):
336340

337341
return key
338342

339-
340343
def configure_event(self, widget, event):
341344
if _debug: print('FigureCanvasGTK.%s' % fn_name())
342345
if widget.window is None:

‎lib/matplotlib/backends/backend_qt4.py

Copy file name to clipboardExpand all lines: lib/matplotlib/backends/backend_qt4.py
+10-7Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
156156
(QtCore.Qt.ControlModifier, 'ctrl', QtCore.Qt.Key_Control)
157157
]
158158

159+
_ctrl_modifier = QtCore.Qt.ControlModifier
160+
159161
if sys.platform == 'darwin':
160162
# in OSX, the control and super (aka cmd/apple) keys are switched, so
161163
# switch them back.
@@ -169,15 +171,17 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
169171
(QtCore.Qt.AltModifier, 'alt', QtCore.Qt.Key_Alt),
170172
(QtCore.Qt.MetaModifier, 'ctrl', QtCore.Qt.Key_Meta),
171173
]
172-
174+
175+
_ctrl_modifier = QtCore.Qt.MetaModifier
176+
173177
# map Qt button codes to MouseEvent's ones:
174178
buttond = {QtCore.Qt.LeftButton : 1,
175179
QtCore.Qt.MidButton : 2,
176180
QtCore.Qt.RightButton : 3,
177181
# QtCore.Qt.XButton1 : None,
178182
# QtCore.Qt.XButton2 : None,
179183
}
180-
184+
181185
def __init__( self, figure ):
182186
if DEBUG: print('FigureCanvasQt: ', figure)
183187
_create_qApp()
@@ -299,16 +303,15 @@ def _get_key( self, event ):
299303

300304
if event.key() < 256:
301305
key = unicode(event.text())
302-
303306
# if the control key is being pressed, we don't get the correct
304307
# characters, so interpret them directly from the event.key().
305308
# Unfortunately, this means that we cannot handle key's case
306-
# since event.key() is not case sensitve, whereas event.text() is,
309+
# since event.key() is not case sensitive, whereas event.text() is,
307310
# Finally, since it is not possible to get the CapsLock state
308311
# we cannot accurately compute the case of a pressed key when
309312
# ctrl+shift+p is pressed.
310-
if int(event.modifiers()) & QtCore.Qt.ControlModifier:
311-
# we always get an uppercase charater
313+
if int(event.modifiers()) & self._ctrl_modifier:
314+
# we always get an uppercase character
312315
key = chr(event.key())
313316
# if shift is not being pressed, lowercase it (as mentioned,
314317
# this does not take into account the CapsLock state)
@@ -322,7 +325,7 @@ def _get_key( self, event ):
322325
# prepend the ctrl, alt, super keys if appropriate (sorted in that order)
323326
for modifier, prefix, Qt_key in self._modifier_keys:
324327
if event.key() != Qt_key and int(event.modifiers()) & modifier == modifier:
325-
key = '{}+{}'.format(prefix, key)
328+
key = u'{}+{}'.format(prefix, key)
326329

327330
return key
328331

‎lib/matplotlib/rcsetup.py

Copy file name to clipboardExpand all lines: lib/matplotlib/rcsetup.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -574,15 +574,15 @@ def __call__(self, s):
574574
'agg.path.chunksize' : [0, validate_int], # 0 to disable chunking;
575575
# recommend about 20000 to
576576
# enable. Experimental.
577-
# key-mappings
577+
# key-mappings (multi-character mappings should be a list/tuple)
578578
'keymap.fullscreen' : [('f', 'ctrl+f'), validate_stringlist],
579579
'keymap.home' : [['h', 'r', 'home'], validate_stringlist],
580580
'keymap.back' : [['left', 'c', 'backspace'], validate_stringlist],
581581
'keymap.forward' : [['right', 'v'], validate_stringlist],
582582
'keymap.pan' : ['p', validate_stringlist],
583583
'keymap.zoom' : ['o', validate_stringlist],
584584
'keymap.save' : [('s', 'ctrl+s'), validate_stringlist],
585-
'keymap.quit' : ['ctrl+w', validate_stringlist],
585+
'keymap.quit' : [('ctrl+w', ), validate_stringlist],
586586
'keymap.grid' : ['g', validate_stringlist],
587587
'keymap.yscale' : ['l', validate_stringlist],
588588
'keymap.xscale' : [['k', 'L'], validate_stringlist],

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.