environment/lib/python2.7/site-packages/IPython/frontend/qt/console/frontend_widget.py
def restart_kernel(self, message, now=False):
        """ Attempts to restart the running kernel.
        """
        # FIXME: now should be configurable via a checkbox in the dialog.  Right
        # now at least the heartbeat path sets it to True and the manual restart
        # to False.  But those should just be the pre-selected states of a
        # checkbox that the user could override if so desired.  But I don't know
        # enough Qt to go implementing the checkbox now.

        if self.custom_restart:
            self.custom_restart_requested.emit()

        elif self.kernel_manager.has_kernel:
            # Pause the heart beat channel to prevent further warnings.
            self.kernel_manager.hb_channel.pause()

            # Prompt the user to restart the kernel. Un-pause the heartbeat if
            # they decline. (If they accept, the heartbeat will be un-paused
            # automatically when the kernel is restarted.)
            if self.confirm_restart:
                buttons = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
                result = QtGui.QMessageBox.question(self, 'Restart kernel?',
                                                    message, buttons)
                do_restart = result == QtGui.QMessageBox.Yes
            else:
                # confirm_restart is False, so we don't need to ask user
                # anything, just do the restart
                do_restart = True
            if do_restart:
                try:
                    self.kernel_manager.restart_kernel(now=now)
                except RuntimeError:
                    self._append_plain_text('Kernel started externally. '
                                            'Cannot restart.\n',
                                            before_prompt=True
                                            )
                else:
                    self.reset()
            else:
                self.kernel_manager.hb_channel.unpause()

        else:
            self._append_plain_text('Kernel process is either remote or '
                                    'unspecified. Cannot restart.\n',
                                    before_prompt=True
                                    )
def restart_kernel(self, message, now=False):
        # FIXME: now should be configurable via a checkbox in the dialog.  Right
        # now at least the heartbeat path sets it to True and the manual restart
        # to False.  But those should just be the pre-selected states of a
        # checkbox that the user could override if so desired.  But I don't know
        # enough Qt to go implementing the checkbox now.

        if self.custom_restart:
            self.custom_restart_requested.emit()

        elif self.kernel_manager.has_kernel:
            # Pause the heart beat channel to prevent further warnings.
            self.kernel_manager.hb_channel.pause()

            # Prompt the user to restart the kernel. Un-pause the heartbeat if
            # they decline. (If they accept, the heartbeat will be un-paused
            # automatically when the kernel is restarted.)
            if self.confirm_restart:
                buttons = QtGui.QMessageBox.Yes | QtGui.QMessageBox.No
                result = QtGui.QMessageBox.question(self, 'Restart kernel?',
                                                    message, buttons)
                do_restart = result == QtGui.QMessageBox.Yes
            else:
                # confirm_restart is False, so we don't need to ask user
                # anything, just do the restart
                do_restart = True
            if do_restart:
                try:
                    self.kernel_manager.restart_kernel(now=now)
                except RuntimeError:
                    self._append_plain_text('Kernel started externally. '
                                            'Cannot restart.\n',
                                            before_prompt=True
                                            )
                else:
                    self.reset()
            else:
                self.kernel_manager.hb_channel.unpause()

        else:
            self._append_plain_text('Kernel process is either remote or '
                                    'unspecified. Cannot restart.\n',
                                    before_prompt=True
                                    )
def restart_kernel ( self , message , now = False ) : # FIXME: now should be configurable via a checkbox in the dialog.  Right # now at least the heartbeat path sets it to True and the manual restart # to False.  But those should just be the pre-selected states of a # checkbox that the user could override if so desired.  But I don't know # enough Qt to go implementing the checkbox now. if self . custom_restart : self . custom_restart_requested . emit ( ) elif self . kernel_manager . has_kernel : # Pause the heart beat channel to prevent further warnings. self . kernel_manager . hb_channel . pause ( ) # Prompt the user to restart the kernel. Un-pause the heartbeat if # they decline. (If they accept, the heartbeat will be un-paused # automatically when the kernel is restarted.) if self . confirm_restart : buttons = QtGui . QMessageBox . Yes | QtGui . QMessageBox . No result = QtGui . QMessageBox . question ( self , 'Restart kernel?' , message , buttons ) do_restart = result == QtGui . QMessageBox . Yes else : # confirm_restart is False, so we don't need to ask user # anything, just do the restart do_restart = True if do_restart : try : self . kernel_manager . restart_kernel ( now = now ) except RuntimeError : self . _append_plain_text ( 'Kernel started externally. ' 'Cannot restart.\n' , before_prompt = True ) else : self . reset ( ) else : self . kernel_manager . hb_channel . unpause ( ) else : self . _append_plain_text ( 'Kernel process is either remote or ' 'unspecified. Cannot restart.\n' , before_prompt = True )
Attempts to restart the running kernel.
Attempts to restart the running kernel .