Show More
@@ -241,6 +241,14 class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin): | |||
|
241 | 241 | break |
|
242 | 242 | return menu |
|
243 | 243 | |
|
244 | def request_interrupt_kernel(self): | |
|
245 | if self._executing: | |
|
246 | self.interrupt_kernel() | |
|
247 | ||
|
248 | def request_restart_kernel(self): | |
|
249 | message = 'Are you sure you want to restart the kernel?' | |
|
250 | self.restart_kernel(message, now=False) | |
|
251 | ||
|
244 | 252 | def _event_filter_console_keypress(self, event): |
|
245 | 253 | """ Reimplemented for execution interruption and smart backspace. |
|
246 | 254 | """ |
@@ -248,12 +256,11 class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin): | |||
|
248 | 256 | if self._control_key_down(event.modifiers(), include_command=False): |
|
249 | 257 | |
|
250 | 258 | if key == QtCore.Qt.Key_C and self._executing: |
|
251 | self.interrupt_kernel() | |
|
259 | self.request_interrupt_kernel() | |
|
252 | 260 | return True |
|
253 | 261 | |
|
254 | 262 | elif key == QtCore.Qt.Key_Period: |
|
255 | message = 'Are you sure you want to restart the kernel?' | |
|
256 | self.restart_kernel(message, now=False) | |
|
263 | self.request_restart_kernel() | |
|
257 | 264 | return True |
|
258 | 265 | |
|
259 | 266 | elif not event.modifiers() & QtCore.Qt.AltModifier: |
@@ -373,6 +373,13 class MainWindow(QtGui.QMainWindow): | |||
|
373 | 373 | ) |
|
374 | 374 | self.edit_menu.addAction(self.copy_action) |
|
375 | 375 | |
|
376 | self.copy_raw_action = QtGui.QAction("Copy (&Raw Text)", | |
|
377 | self, | |
|
378 | shortcut="Ctrl+Shift+C", | |
|
379 | triggered=self.copy_raw_active_frontend | |
|
380 | ) | |
|
381 | self.edit_menu.addAction(self.copy_raw_action) | |
|
382 | ||
|
376 | 383 | self.cut_action = QtGui.QAction("&Cut", |
|
377 | 384 | self, |
|
378 | 385 | shortcut=QtGui.QKeySequence.Cut, |
@@ -483,6 +490,20 class MainWindow(QtGui.QMainWindow): | |||
|
483 | 490 | ) |
|
484 | 491 | self.help_menu.addAction(self.quickref_active_frontend_action) |
|
485 | 492 | |
|
493 | self.interrupt_kernel_action = QtGui.QAction("Interrupt current Kernel", | |
|
494 | self, | |
|
495 | triggered=self.interrupt_kernel_active_frontend | |
|
496 | ) | |
|
497 | self.kernel_menu.addAction(self.interrupt_kernel_action) | |
|
498 | ||
|
499 | self.restart_kernel_action = QtGui.QAction("Restart current Kernel", | |
|
500 | self, | |
|
501 | triggered=self.restart_kernel_active_frontend | |
|
502 | ) | |
|
503 | self.kernel_menu.addAction(self.restart_kernel_action) | |
|
504 | self.kernel_menu.addSeparator() | |
|
505 | ||
|
506 | #for now this is just a copy and paste, but we should get this dynamically | |
|
486 | 507 | magiclist=["%alias", "%autocall", "%automagic", "%bookmark", "%cd", "%clear", |
|
487 | 508 | "%colors", "%debug", "%dhist", "%dirs", "%doctest_mode", "%ed", "%edit", "%env", "%gui", |
|
488 | 509 | "%guiref", "%hist", "%history", "%install_default_config", "%install_profiles", |
@@ -507,12 +528,21 class MainWindow(QtGui.QMainWindow): | |||
|
507 | 528 | ) |
|
508 | 529 | self.all_magic_menu.addAction(xaction) |
|
509 | 530 | |
|
531 | def restart_kernel_active_frontend(self): | |
|
532 | self.active_frontend.request_restart_kernel() | |
|
533 | ||
|
534 | def interrupt_kernel_active_frontend(self): | |
|
535 | self.active_frontend.request_interrupt_kernel() | |
|
536 | ||
|
510 | 537 | def cut_active_frontend(self): |
|
511 | 538 | self.active_frontend.cut_action.trigger() |
|
512 | 539 | |
|
513 | 540 | def copy_active_frontend(self): |
|
514 | 541 | self.active_frontend.copy_action.trigger() |
|
515 | 542 | |
|
543 | def copy_raw_active_frontend(self): | |
|
544 | self.active_frontend._copy_raw_action.trigger() | |
|
545 | ||
|
516 | 546 | def paste_active_frontend(self): |
|
517 | 547 | self.active_frontend.paste_action.trigger() |
|
518 | 548 |
General Comments 0
You need to be logged in to leave comments.
Login now