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
More osx tweaks
  • Loading branch information
pelson committed Jun 24, 2012
commit 9dfd95318bd15434ab91f8c64c0b355d4163053a
7 changes: 5 additions & 2 deletions 7 lib/matplotlib/backends/backend_gtk.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,10 @@ class FigureCanvasGTK (gtk.DrawingArea, FigureCanvasBase):
65455 : '/',
65439 : 'dec',
65421 : 'enter',
65511 : 'super',
65512 : 'super',
65406 : 'alt',
65289 : 'tab',
}

# Setting this as a static constant prevents
Expand Down Expand Up @@ -326,7 +330,7 @@ def _get_key(self, event):
key = chr(event.keyval)
else:
key = None

for key_mask, prefix in (
[gdk.MOD4_MASK, 'super'],
[gdk.MOD1_MASK, 'alt'],
Expand All @@ -336,7 +340,6 @@ def _get_key(self, event):

return key


def configure_event(self, widget, event):
if _debug: print('FigureCanvasGTK.%s' % fn_name())
if widget.window is None:
Expand Down
17 changes: 10 additions & 7 deletions 17 lib/matplotlib/backends/backend_qt4.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
(QtCore.Qt.ControlModifier, 'ctrl', QtCore.Qt.Key_Control)
]

_ctrl_modifier = QtCore.Qt.ControlModifier

if sys.platform == 'darwin':
# in OSX, the control and super (aka cmd/apple) keys are switched, so
# switch them back.
Expand All @@ -169,15 +171,17 @@ class FigureCanvasQT( QtGui.QWidget, FigureCanvasBase ):
(QtCore.Qt.AltModifier, 'alt', QtCore.Qt.Key_Alt),
(QtCore.Qt.MetaModifier, 'ctrl', QtCore.Qt.Key_Meta),
]


_ctrl_modifier = QtCore.Qt.MetaModifier

# map Qt button codes to MouseEvent's ones:
buttond = {QtCore.Qt.LeftButton : 1,
QtCore.Qt.MidButton : 2,
QtCore.Qt.RightButton : 3,
# QtCore.Qt.XButton1 : None,
# QtCore.Qt.XButton2 : None,
}

def __init__( self, figure ):
if DEBUG: print('FigureCanvasQt: ', figure)
_create_qApp()
Expand Down Expand Up @@ -299,16 +303,15 @@ def _get_key( self, event ):

if event.key() < 256:
key = unicode(event.text())

# if the control key is being pressed, we don't get the correct
# characters, so interpret them directly from the event.key().
# Unfortunately, this means that we cannot handle key's case
# since event.key() is not case sensitve, whereas event.text() is,
# since event.key() is not case sensitive, whereas event.text() is,
# Finally, since it is not possible to get the CapsLock state
# we cannot accurately compute the case of a pressed key when
# ctrl+shift+p is pressed.
if int(event.modifiers()) & QtCore.Qt.ControlModifier:
# we always get an uppercase charater
if int(event.modifiers()) & self._ctrl_modifier:
# we always get an uppercase character
key = chr(event.key())
# if shift is not being pressed, lowercase it (as mentioned,
# this does not take into account the CapsLock state)
Expand All @@ -322,7 +325,7 @@ def _get_key( self, event ):
# prepend the ctrl, alt, super keys if appropriate (sorted in that order)
for modifier, prefix, Qt_key in self._modifier_keys:
if event.key() != Qt_key and int(event.modifiers()) & modifier == modifier:
key = '{}+{}'.format(prefix, key)
key = u'{}+{}'.format(prefix, key)

return key

Expand Down
4 changes: 2 additions & 2 deletions 4 lib/matplotlib/rcsetup.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,15 +574,15 @@ def __call__(self, s):
'agg.path.chunksize' : [0, validate_int], # 0 to disable chunking;
# recommend about 20000 to
# enable. Experimental.
# key-mappings
# key-mappings (multi-character mappings should be a list/tuple)
'keymap.fullscreen' : [('f', 'ctrl+f'), validate_stringlist],
'keymap.home' : [['h', 'r', 'home'], validate_stringlist],
'keymap.back' : [['left', 'c', 'backspace'], validate_stringlist],
'keymap.forward' : [['right', 'v'], validate_stringlist],
'keymap.pan' : ['p', validate_stringlist],
'keymap.zoom' : ['o', validate_stringlist],
'keymap.save' : [('s', 'ctrl+s'), validate_stringlist],
'keymap.quit' : ['ctrl+w', validate_stringlist],
'keymap.quit' : [('ctrl+w', ), validate_stringlist],
'keymap.grid' : ['g', validate_stringlist],
'keymap.yscale' : ['l', validate_stringlist],
'keymap.xscale' : [['k', 'L'], validate_stringlist],
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.