'Execute lines in IPython console and eventually set focus
to the Editor.'

def execute_in_external_console(self, lines, focus_to_editor):

    console = self.ipyconsole
    console.visibility_changed(True)
    console.raise_()
    console.execute_code(lines)
    if focus_to_editor:
        self.editor.visibility_changed(True)
