##// END OF EJS Templates
Cmd-C will no longer interrupt the kernel in Mac OS (only Ctrl-C will do this).
epatters -
Show More
@@ -197,11 +197,8 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
197 197 self.paste(QtGui.QClipboard.Selection)
198 198 return True
199 199
200 # Override shortucts for all filtered widgets. Note that on Mac OS it is
201 # always unnecessary to override shortcuts, hence the check below (users
202 # should just use the Control key instead of the Command key).
200 # Override shortcuts for all filtered widgets.
203 201 elif etype == QtCore.QEvent.ShortcutOverride and \
204 sys.platform != 'darwin' and \
205 202 self._control_key_down(event.modifiers()) and \
206 203 event.key() in self._shortcuts:
207 204 event.accept()
@@ -646,19 +643,23 b' class ConsoleWidget(Configurable, QtGui.QWidget):'
646 643 self._control.setTextCursor(cursor)
647 644 self._text_completing_pos = current_pos
648 645
649 def _control_key_down(self, modifiers):
646 def _control_key_down(self, modifiers, include_command=True):
650 647 """ Given a KeyboardModifiers flags object, return whether the Control
651 key is down (on Mac OS, treat the Command key as a synonym for
652 Control).
653 """
654 down = bool(modifiers & QtCore.Qt.ControlModifier)
648 key is down.
655 649
656 # Note: on Mac OS, ControlModifier corresponds to the Command key while
657 # MetaModifier corresponds to the Control key.
650 Parameters:
651 -----------
652 include_command : bool, optional (default True)
653 Whether to treat the Command key as a (mutually exclusive) synonym
654 for Control when in Mac OS.
655 """
656 # Note that on Mac OS, ControlModifier corresponds to the Command key
657 # while MetaModifier corresponds to the Control key.
658 658 if sys.platform == 'darwin':
659 down = down ^ bool(modifiers & QtCore.Qt.MetaModifier)
660
661 return down
659 down = include_command and (modifiers & QtCore.Qt.ControlModifier)
660 return bool(down) ^ bool(modifiers & QtCore.Qt.MetaModifier)
661 else:
662 return bool(modifiers & QtCore.Qt.ControlModifier)
662 663
663 664 def _create_control(self):
664 665 """ Creates and connects the underlying text widget.
@@ -196,7 +196,7 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):'
196 196 """ Reimplemented to allow execution interruption.
197 197 """
198 198 key = event.key()
199 if self._control_key_down(event.modifiers()):
199 if self._control_key_down(event.modifiers(), include_command=False):
200 200 if key == QtCore.Qt.Key_C and self._executing:
201 201 self.interrupt_kernel()
202 202 return True
General Comments 0
You need to be logged in to leave comments. Login now