Skip to content

Loading…

Set context for shortcuts in ConsoleWidget #763

Merged
merged 1 commit into from

4 participants

@punchagan

The default value of Qt.WindowShortcut causes a problem when IPython is embedded as a widget in other applications.

Setting the shortcut context to Qt.WidgetWithChildrenShortcut

@minrk
IPython member

I don't think this commit does what you think it does. It just deletes almost all of console_widget.py

@punchagan

I'm sorry. I was trying the new editor of GitHub and seems like one of my browser plugins + the editor created some problems.

I pushed the correct changes, now. Thanks!

@jdmarch

Works for me, OSX and Windows 7.

@epatters

These shortcuts should never have been added to ConsoleWidget in the first place, as shortcuts for printing and saving are an application-level matter. At some point, they should be moved out of ConsoleWidget and into QtConsoleApp.

I don't have time to refactor this now, though, so I'm going to merge this. Thanks for the fix, @punchagan.

@epatters epatters merged commit ac6d8ef into ipython:master
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 6, 2011
  1. @punchagan
Showing with 4 additions and 1 deletion.
  1. +4 −1 IPython/frontend/qt/console/console_widget.py
View
5 IPython/frontend/qt/console/console_widget.py
@@ -233,19 +233,22 @@ def __init__(self, parent=None, **kw):
# Qt ctrl = cmd on OSX, so the match gets a false positive on OSX.
printkey = "Ctrl+Shift+P"
action.setShortcut(printkey)
+ action.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut)
action.triggered.connect(self.print_)
self.addAction(action)
self._print_action = action
action = QtGui.QAction('Save as HTML/XML', None)
action.setShortcut(QtGui.QKeySequence.Save)
+ action.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut)
action.triggered.connect(self.export_html)
self.addAction(action)
self._export_action = action
-
+
action = QtGui.QAction('Select All', None)
action.setEnabled(True)
action.setShortcut(QtGui.QKeySequence.SelectAll)
+ action.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut)
action.triggered.connect(self.select_all)
self.addAction(action)
self._select_all_action = action
Something went wrong with that request. Please try again.