Show More
@@ -98,6 +98,9 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
98 | clear_on_kernel_restart = Bool(True, config=True, |
|
98 | clear_on_kernel_restart = Bool(True, config=True, | |
99 | help="Whether to clear the console when the kernel is restarted") |
|
99 | help="Whether to clear the console when the kernel is restarted") | |
100 |
|
100 | |||
|
101 | confirm_restart = Bool(True, config=True, | |||
|
102 | help="Whether to ask for user confirmation when restarting kernel") | |||
|
103 | ||||
101 | # Emitted when a user visible 'execute_request' has been submitted to the |
|
104 | # Emitted when a user visible 'execute_request' has been submitted to the | |
102 | # kernel from the FrontendWidget. Contains the code to be executed. |
|
105 | # kernel from the FrontendWidget. Contains the code to be executed. | |
103 | executing = QtCore.Signal(object) |
|
106 | executing = QtCore.Signal(object) | |
@@ -615,10 +618,16 b' class FrontendWidget(HistoryConsoleWidget, BaseFrontendMixin):' | |||||
615 | # Prompt the user to restart the kernel. Un-pause the heartbeat if |
|
618 | # Prompt the user to restart the kernel. Un-pause the heartbeat if | |
616 | # they decline. (If they accept, the heartbeat will be un-paused |
|
619 | # they decline. (If they accept, the heartbeat will be un-paused | |
617 | # automatically when the kernel is restarted.) |
|
620 | # automatically when the kernel is restarted.) | |
618 | buttons = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No |
|
621 | if self.confirm_restart: | |
619 | result = QtGui.QMessageBox.question(self, 'Restart kernel?', |
|
622 | buttons = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No | |
620 | message, buttons) |
|
623 | result = QtGui.QMessageBox.question(self, 'Restart kernel?', | |
621 | if result == QtGui.QMessageBox.Yes: |
|
624 | message, buttons) | |
|
625 | do_restart = result == QtGui.QMessageBox.Yes | |||
|
626 | else: | |||
|
627 | # confirm_restart is False, so we don't need to ask user | |||
|
628 | # anything, just do the restart | |||
|
629 | do_restart = True | |||
|
630 | if do_restart: | |||
622 | try: |
|
631 | try: | |
623 | self.kernel_manager.restart_kernel(now=now) |
|
632 | self.kernel_manager.restart_kernel(now=now) | |
624 | except RuntimeError: |
|
633 | except RuntimeError: |
General Comments 0
You need to be logged in to leave comments.
Login now