Skip to content
This repository

Set context for shortcuts in ConsoleWidget #763

Merged
merged 1 commit into from over 2 years ago

4 participants

Puneeth Chaganti Min RK Jonathan March Evan Patterson
Puneeth Chaganti

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

Min RK
Owner

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

Puneeth Chaganti

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!

Jonathan March
Collaborator

Works for me, OSX and Windows 7.

Evan Patterson
Collaborator

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.

Evan Patterson epatters merged commit ac6d8ef into from September 07, 2011
Evan Patterson epatters closed this September 07, 2011
Brian E. Granger ellisonbg referenced this pull request from a commit January 10, 2012
Commit has since been removed from the repository and is no longer available.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Sep 06, 2011
Puneeth Chaganti Set context for shortcuts in ConsoleWidget. 83b149d
This page is out of date. Refresh to see the latest.
5  IPython/frontend/qt/console/console_widget.py
@@ -233,19 +233,22 @@ def __init__(self, parent=None, **kw):
233 233
             # Qt ctrl = cmd on OSX, so the match gets a false positive on OSX.
234 234
             printkey = "Ctrl+Shift+P"
235 235
         action.setShortcut(printkey)
  236
+        action.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut)
236 237
         action.triggered.connect(self.print_)
237 238
         self.addAction(action)
238 239
         self._print_action = action
239 240
 
240 241
         action = QtGui.QAction('Save as HTML/XML', None)
241 242
         action.setShortcut(QtGui.QKeySequence.Save)
  243
+        action.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut)
242 244
         action.triggered.connect(self.export_html)
243 245
         self.addAction(action)
244 246
         self._export_action = action
245  
-        
  247
+
246 248
         action = QtGui.QAction('Select All', None)
247 249
         action.setEnabled(True)
248 250
         action.setShortcut(QtGui.QKeySequence.SelectAll)
  251
+        action.setShortcutContext(QtCore.Qt.WidgetWithChildrenShortcut)
249 252
         action.triggered.connect(self.select_all)
250 253
         self.addAction(action)
251 254
         self._select_all_action = action
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.