Ejemplo n.º 1
0
    def test(self):

        from ipykernel.connect import connect_qtconsole
        from ipykernel.kernelapp import IPKernelApp

        kernelApp = IPKernelApp.instance()
        args = ['python', '--pylab=qt', '--log-level=20']
        kernelApp.initialize(args)
        connect_qtconsole()
Ejemplo n.º 2
0
 def test(self):
     
     from ipykernel.connect import connect_qtconsole
     from ipykernel.kernelapp import IPKernelApp
     
     kernelApp = IPKernelApp.instance()
     args = ['python', '--pylab=qt', '--log-level=20']
     kernelApp.initialize(args)
     connect_qtconsole()
Ejemplo n.º 3
0
 def new_qt_console(self, event=None):
     '''
     Start a new qtconsole connected to our kernel.
     
     Called from qt_gui.runWithIpythonKernel.
     '''
     trace = 'ipython' in g.app.debug
     console = None
     if not self.namespace.get('_leo'):
         self.namespace['_leo'] = LeoNameSpace()
     if trace:
         self.put_log('new_qt_console: connecting...')
         self.put_log(self.kernelApp.connection_file, raw=True)
     try:
         # #213: leo --ipython fails to connect with python3.5 and jupyter
         #
         # The connection file has the form kernel-nnn.json.
         # Using the defaults lets connect_qtconsole find the .json file.
         console = connect_qtconsole()
         # ipykernel.connect.connect_qtconsole
         if trace: g.trace(console)
         if console:
             self.consoles.append(console)
         else:
             self.put_warning('new_qt_console: no console!')
     except OSError as e:
         # Print statements do not work here.
         self.put_warning('new_qt_console: failed to connect to console')
         self.put_warning(e, raw=True)
     except Exception as e:
         self.put_warning('new_qt_console: unexpected exception')
         self.put_warning(e)
     return console
Ejemplo n.º 4
0
 def new_qt_console(self, event=None):
     '''
     Start a new qtconsole connected to our kernel.
     
     Called from qt_gui.runWithIpythonKernel.
     '''
     trace = 'ipython' in g.app.debug
     console = None
     if not self.namespace.get('_leo'):
         self.namespace['_leo'] = LeoNameSpace()
     if trace:
         self.put_log('new_qt_console: connecting...')
         self.put_log(self.kernelApp.connection_file, raw=True)
     try:
         # Fix #213: leo --ipython fails to connect with python3.5 and jupyter
         # https://github.com/leo-editor/leo-editor/issues/213
         # The connection file has the form kernel-nnn.json.
         # Using the defaults lets connect_qtconsole find the .json file.
         console = connect_qtconsole()
             # ipykernel.connect.connect_qtconsole
         if trace: g.trace(console)
         if console:
             self.consoles.append(console)
         else:
             self.put_warning('new_qt_console: no console!')
     except OSError as e:
         # Print statements do not work here.
         self.put_warning('new_qt_console: failed to connect to console')
         self.put_warning(e, raw=True)
     except Exception as e:
         self.put_warning('new_qt_console: unexpected exception')
         self.put_warning(e)
     return console
Ejemplo n.º 5
0
 def new_qt_console(self, event=None):
     '''Start a new qtconsole connected to our kernel.'''
     trace = False or g.app.debug
     # For now, always trace when using Python 2.
     console = None
     if not self.namespace.get('_leo'):
         self.namespace['_leo'] = LeoNameSpace()
     try:
         if trace:
             self.put_log('new_qt_console: connecting...')
             self.put_log(self.kernelApp.connection_file, raw=True)
         # Fix #213: leo --ipython fails to connect with python3.5 and jupyter
         # https://github.com/leo-editor/leo-editor/issues/213
         # The connection file has the form kernel-nnn.json.
         # Using the defaults lets connect_qtconsole find the .json file.
         console = connect_qtconsole()
         if console:
             self.consoles.append(console)
         else:
             self.put_warning('new_qt_console: no console!')
     except OSError as e:
         # Print statements do not work here.
         self.put_warning('new_qt_console: failed to connect to console')
         self.put_warning(e, raw=True)
     except Exception as e:
         self.put_warning('new_qt_console: unexpected exception')
         self.put_warning(e)
     return console
Ejemplo n.º 6
0
 def new_qt_console(self):
     """ Start a new qtconsole connected to our kernel. """
     console = connect_qtconsole(self.ipkernel.connection_file,
                                 argv=['--no-confirm-exit'])
     self.consoles.append(console)
     return console