当前位置: 首页>>代码示例>>Python>>正文


Python kernelmanager.QtKernelManager类代码示例

本文整理汇总了Python中IPython.frontend.qt.kernelmanager.QtKernelManager的典型用法代码示例。如果您正苦于以下问题:Python QtKernelManager类的具体用法?Python QtKernelManager怎么用?Python QtKernelManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了QtKernelManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: default_manager

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
开发者ID:rseed42,项目名称:templates,代码行数:7,代码来源:example.py

示例2: _init_kernel_manager

 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
开发者ID:eteq,项目名称:glue,代码行数:7,代码来源:terminal.py

示例3: _init_kernel_manager

 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)
开发者ID:ChannelFinder,项目名称:hla,代码行数:9,代码来源:embedIPython.py

示例4: default_manager

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
开发者ID:eteq,项目名称:glue,代码行数:11,代码来源:terminal.py

示例5: MainWin

class MainWin(QMainWindow):
  def __init__(self):
    QMainWindow.__init__(self)
    self.resize(1000,1000)

    self.kernel = QtKernelManager()
    self.kernel.start_kernel()
    self.kernel.start_channels()

    self.console = IPythonWidget()
    self.console.kernel_manager = self.kernel
    self.setCentralWidget(self.console)
开发者ID:DoctorMalboro,项目名称:prymatex,代码行数:12,代码来源:console.py

示例6: init_kernel_manager

    def init_kernel_manager(self):
        # Don't let Qt or ZMQ swallow KeyboardInterupts.
        signal.signal(signal.SIGINT, signal.SIG_DFL)
        sec = self.profile_dir.security_dir
        try:
            cf = filefind(self.connection_file, ['.', sec])
        except IOError:
            # file might not exist
            if self.connection_file == os.path.basename(self.connection_file):
                # just shortname, put it in security dir
                cf = os.path.join(sec, self.connection_file)
            else:
                cf = self.connection_file

        # Create a KernelManager and start a kernel.
        self.kernel_manager = QtKernelManager(
                                ip=self.ip,
                                shell_port=self.shell_port,
                                iopub_port=self.iopub_port,
                                stdin_port=self.stdin_port,
                                hb_port=self.hb_port,
                                connection_file=cf,
                                config=self.config,
        )
        # start the kernel
        if not self.existing:
            kwargs = dict(ipython=not self.pure)
            kwargs['extra_arguments'] = self.kernel_argv
            self.kernel_manager.start_kernel(**kwargs)
        elif self.sshserver:
            # ssh, write new connection file
            self.kernel_manager.write_connection_file()
        self.kernel_manager.start_channels()
开发者ID:stefanv,项目名称:ipython,代码行数:33,代码来源:qtconsoleapp.py

示例7: connect_kernel

    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)
开发者ID:SharpLu,项目名称:Sympathy-for-data-benchmark,代码行数:45,代码来源:console.py

示例8: get_widget

        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
开发者ID:amchagas,项目名称:spykeviewer,代码行数:19,代码来源:ipython_connection.py

示例9: IPythonConsole

class IPythonConsole(QDockWidget):
    def __init__(self, parent=None):
        QDockWidget.__init__(self, parent)
        self.setObjectName("IPython Console")
        self.setWindowTitle(QCoreApplication.translate("IPython Console", "IPython Console"))
        self.setAllowedAreas(Qt.BottomDockWidgetArea)

        self.container = QWidget()
        self.layout = QVBoxLayout(self.container)

        self.kernel_manager = QtKernelManager()
        self.kernel_manager.start_kernel()
        self.kernel_manager.start_channels()

        self.console = IPythonWidget(local_kernel=LOCALHOST)
        self.console.kernel_manager = self.kernel_manager
        print dir(self.console)

        self.layout.addWidget(self.console)
        self.setWidget(self.container)
开发者ID:GunioRobot,项目名称:Fiat-Lux,代码行数:20,代码来源:console.py

示例10: console

class console(QWidget):

	"""A QWidget that serves as a debug window"""

	def __init__(self, parent=None):

		QDialog.__init__(self, parent)

		self.main_window = parent
		self.kernel_manager = QtKernelManager()
		self.kernel_manager.start_kernel()
		self.kernel_manager.start_channels()
		self.console = IPythonWidget(local_kernel=LOCALHOST)
		self.console.kernel_manager = self.kernel_manager
		self.verticalLayout = QVBoxLayout(self)
		self.verticalLayout.setContentsMargins(0,0,0,0)
		self.setLayout(self.verticalLayout)
		self.verticalLayout.addWidget(self.console)

	def setReadOnly(self, state):

		"""
		Dummy function

		Arguments:
		state -- dummy argument
		"""

		pass

	def clear(self):

		"""Clears the console"""

		self.console.reset()

	def show_prompt(self):

		"""Shows a new prompt"""

		self.console._show_interpreter_prompt()
开发者ID:Evertox,项目名称:OpenSesame,代码行数:41,代码来源:pyterm_ipython.py

示例11: new_frontend_slave

 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
开发者ID:stefanv,项目名称:ipython,代码行数:21,代码来源:qtconsoleapp.py

示例12: new_frontend_master

 def new_frontend_master(self):
     """ Create and return new frontend attached to new kernel, launched on localhost.
     """
     ip = self.ip if self.ip in LOCAL_IPS else LOCALHOST
     kernel_manager = QtKernelManager(
                             ip=ip,
                             connection_file=self._new_connection_file(),
                             config=self.config,
     )
     # start the kernel
     kwargs = dict(ipython=not self.pure)
     kwargs['extra_arguments'] = self.kernel_argv
     kernel_manager.start_kernel(**kwargs)
     kernel_manager.start_channels()
     widget = self.widget_factory(config=self.config,
                                local_kernel=True)
     widget.kernel_manager = kernel_manager
     widget._existing = False
     widget._may_close = True
     widget._confirm_exit = self.confirm_exit
     return widget
开发者ID:stefanv,项目名称:ipython,代码行数:21,代码来源:qtconsoleapp.py

示例13: init_kernel_manager

def init_kernel_manager():
    # Don't let Qt or ZMQ swallow KeyboardInterupts.
    signal.signal(signal.SIGINT, signal.SIG_DFL)

    ip = '127.0.0.1'

    # Create a KernelManager and start a kernel.
    kernel_manager = QtKernelManager(
                            shell_address=(ip, 0),
                            sub_address=(ip, 0),
                            stdin_address=(ip, 0),
                            hb_address=(ip, 0)
                            #,
                            #config=self.config
    )
    # start the kernel
    kwargs = dict(ip='127.0.0.1', ipython=True)
    #kwargs['extra_arguments'] = self.kernel_argv
    kernel_manager.start_kernel(**kwargs)
    kernel_manager.start_channels()
    return kernel_manager
开发者ID:martyngigg,项目名称:embedded_ipython,代码行数:21,代码来源:mantidplot.py

示例14: setupKernelManager

 def setupKernelManager(self):
     kernelManager = None
     try:
         from IPython.frontend.qt.kernelmanager import QtKernelManager
         kernelManager = QtKernelManager()
         kernelManager.start_kernel()
         kernelManager.start_channels()
         if hasattr(kernelManager, "connection_file"):
             ipconnection = kernelManager.connection_file
         else:
             shell_port = kernelManager.shell_address[1]
             iopub_port = kernelManager.sub_address[1]
             stdin_port = kernelManager.stdin_address[1]
             hb_port = kernelManager.hb_address[1]
             ipconnection = "--shell={0} --iopub={1} --stdin={2} --hb={3}".format(shell_port, iopub_port, stdin_port, hb_port)
         self.supportManager.updateEnvironment({ 
                 "PMX_IPYTHON_CONNECTION": ipconnection
         })
     except ImportError as e:
         self.logger.warn("Warning: %s" % e)
         kernelManager = None
     return kernelManager
开发者ID:diegomvh,项目名称:prymatex,代码行数:22,代码来源:app.py

示例15: __init__

	def __init__(self, parent=None):

		QDialog.__init__(self, parent)

		self.main_window = parent
		self.kernel_manager = QtKernelManager()
		self.kernel_manager.start_kernel()
		self.kernel_manager.start_channels()
		self.console = IPythonWidget(local_kernel=LOCALHOST)
		self.console.kernel_manager = self.kernel_manager
		self.verticalLayout = QVBoxLayout(self)
		self.verticalLayout.setContentsMargins(0,0,0,0)
		self.setLayout(self.verticalLayout)
		self.verticalLayout.addWidget(self.console)
开发者ID:Evertox,项目名称:OpenSesame,代码行数:14,代码来源:pyterm_ipython.py


注:本文中的IPython.frontend.qt.kernelmanager.QtKernelManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。