コード例 #1
0
ファイル: draft_terminal.py プロジェクト: peper0/sdupy
def default_manager(kernel):
    connection_file = find_connection_file(kernel.connection_file)
    manager = QtKernelManager(connection_file=connection_file)
    manager.load_connection_file()
    manager.start_channels()
    atexit.register(manager.cleanup_connection_file)
    return manager
コード例 #2
0
ファイル: terminal.py プロジェクト: eteq/glue
 def _init_kernel_manager(self):
     connection_file = find_connection_file(self.app.connection_file)
     manager = QtKernelManager(connection_file=connection_file)
     manager.load_connection_file()
     manager.start_channels()
     atexit.register(manager.cleanup_connection_file)
     self.kernel_manager = manager
コード例 #3
0
ファイル: example.py プロジェクト: rseed42/templates
def default_manager(kernel):
    connection_file = find_connection_file(kernel.connection_file)
    manager = QtKernelManager(connection_file=connection_file)
    manager.load_connection_file()
    manager.start_channels()
    atexit.register(manager.cleanup_connection_file)
    return manager
コード例 #4
0
 def _init_kernel_manager(self):
     km = QtKernelManager(connection_file=self._connection_file,
                          config=self.config)
     km.load_connection_file()
     km.start_channels(hb=self._heartbeat)
     self.kernel_manager = km
     atexit.register(self.kernel_manager.cleanup_connection_file)
コード例 #5
0
ファイル: embedIPython.py プロジェクト: ChannelFinder/hla
 def _init_kernel_manager(self):
     """"""
     
     km = QtKernelManager(connection_file=self._connection_file,
                          config=self.config)
     km.load_connection_file()
     km.start_channels(hb=self._heartbeat)
     self.kernel_manager = km
     atexit.register(self.kernel_manager.cleanup_connection_file)
コード例 #6
0
ファイル: terminal.py プロジェクト: eteq/glue
def default_manager(kernel):
    """ Return a configured QtKernelManager

    :param kernel: An IPKernelApp instance
    """
    connection_file = find_connection_file(kernel.connection_file)
    manager = QtKernelManager(connection_file=connection_file)
    manager.load_connection_file()
    manager.start_channels()
    atexit.register(manager.cleanup_connection_file)
    return manager
コード例 #7
0
    def connect_kernel(self, connection_file, heartbeat=False):
        """
        connection_file: str - is the connection file name, for example
        'kernel-16098.json'.
        heartbeat: bool - workaround, needed for right click/save as
                          ... errors ... i don't know how to
                          fix this issue. Anyone knows? Anyway it
                          needs more testing
            example1 (standalone):

                    app = QtGui.QApplication([])
                    widget = IPythonConsoleQtWidget()
                    widget.set_default_style(colors='linux')


                    widget.connect_kernel(
                        connection_file='some connection file name')

                    app.exec_()

            example2 (IPythonLocalKernelApp):

                    app = QtGui.QApplication([])

                    kernelapp = IPythonLocalKernelApp.instance()
                    kernelapp.initialize()

                    widget = IPythonConsoleQtWidget()

                    # Green text, black background ;)
                    widget.set_default_style(colors='linux')

                    widget.connect_kernel(
                        connection_file='kernelapp.get_connection_file())

                    app.exec_()

        """
        km = QtKernelManager(
            connection_file=find_connection_file(connection_file),
            config=self.config)
        km.load_connection_file()
        km.start_channels(hb=heartbeat)
        self.kernel_manager = km
        atexit.register(self.kernel_manager.cleanup_connection_file)
コード例 #8
0
        def get_widget(self, droplist_completion=True):
            if IPython.__version__ < '0.13':
                completion = droplist_completion
            else:
                completion = 'droplist' if droplist_completion else 'plain'
            widget = RichIPythonWidget(gui_completion=completion)

            cf = find_connection_file(self.kernel_app.connection_file)
            km = QtKernelManager(connection_file=cf, config=widget.config)
            km.load_connection_file()
            km.start_channels()
            widget.kernel_manager = km
            atexit.register(km.cleanup_connection_file)

            sys.stdout = self._stdout
            sys.stderr = self._stderr
            sys.displayhook = self._dishook

            return widget
コード例 #9
0
 def new_frontend_slave(self, current_widget):
     """Create and return a new frontend attached to an existing kernel.
     
     Parameters
     ----------
     current_widget : IPythonWidget
         The IPythonWidget whose kernel this frontend is to share
     """
     kernel_manager = QtKernelManager(
         connection_file=current_widget.kernel_manager.connection_file,
         config=self.config,
     )
     kernel_manager.load_connection_file()
     kernel_manager.start_channels()
     widget = self.widget_factory(config=self.config, local_kernel=False)
     widget._existing = True
     widget._may_close = False
     widget._confirm_exit = False
     widget.kernel_manager = kernel_manager
     return widget
コード例 #10
0
ファイル: qtconsoleapp.py プロジェクト: stefanv/ipython
 def new_frontend_slave(self, current_widget):
     """Create and return a new frontend attached to an existing kernel.
     
     Parameters
     ----------
     current_widget : IPythonWidget
         The IPythonWidget whose kernel this frontend is to share
     """
     kernel_manager = QtKernelManager(
                             connection_file=current_widget.kernel_manager.connection_file,
                             config = self.config,
     )
     kernel_manager.load_connection_file()
     kernel_manager.start_channels()
     widget = self.widget_factory(config=self.config,
                             local_kernel=False)
     widget._existing = True
     widget._may_close = False
     widget._confirm_exit = False
     widget.kernel_manager = kernel_manager
     return widget
コード例 #11
0
ファイル: qtconsole.py プロジェクト: royedwards/3rdPartyAudio
    def connect_kernel(self, connection_file, heartbeat=False):
        """
        connection_file: str - is the connection file name, for example 'kernel-16098.json'
        heartbeat: bool - workaround, needed for right click/save as ... errors ... i don't know how to 
                          fix this issue. Anyone knows? Anyway it needs more testing
            example1 (standalone):

                    app = QtGui.QApplication([])
                    widget = IPythonConsoleQtWidget()
                    widget.set_default_style(colors='linux')


                    widget.connect_kernel(connection_file='some connection file name')

                    app.exec_()

            example2 (IPythonLocalKernelApp):

                    app = QtGui.QApplication([])

                    kernelapp = IPythonLocalKernelApp.instance()
                    kernelapp.initialize()

                    widget = IPythonConsoleQtWidget()

                    # Green text, black background ;)
                    widget.set_default_style(colors='linux')

                    widget.connect_kernel(connection_file='kernelapp.get_connection_file())

                    app.exec_()

        """
        km = QtKernelManager(
            connection_file=find_connection_file(connection_file),
            config=self.config)
        km.load_connection_file()
        km.start_channels(hb=heartbeat)
        self.kernel_manager = km
        atexit.register(self.kernel_manager.cleanup_connection_file)
コード例 #12
0
ファイル: QIPythonWidget.py プロジェクト: satishgoda/PyInterp
 def connect_kernel(self, conn, heartbeat=False):
     km = QtKernelManager(connection_file=find_connection_file(conn))
     km.load_connection_file()
     km.start_channels(hb=heartbeat)
     self.kernel_manager = km
     atexit.register(self.kernel_manager.cleanup_connection_file)