本文整理汇总了Python中IPython.frontend.qt.kernelmanager.QtKernelManager.load_connection_file方法的典型用法代码示例。如果您正苦于以下问题:Python QtKernelManager.load_connection_file方法的具体用法?Python QtKernelManager.load_connection_file怎么用?Python QtKernelManager.load_connection_file使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IPython.frontend.qt.kernelmanager.QtKernelManager
的用法示例。
在下文中一共展示了QtKernelManager.load_connection_file方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _init_kernel_manager
# 需要导入模块: from IPython.frontend.qt.kernelmanager import QtKernelManager [as 别名]
# 或者: from IPython.frontend.qt.kernelmanager.QtKernelManager import load_connection_file [as 别名]
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
示例2: default_manager
# 需要导入模块: from IPython.frontend.qt.kernelmanager import QtKernelManager [as 别名]
# 或者: from IPython.frontend.qt.kernelmanager.QtKernelManager import load_connection_file [as 别名]
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
示例3: _init_kernel_manager
# 需要导入模块: from IPython.frontend.qt.kernelmanager import QtKernelManager [as 别名]
# 或者: from IPython.frontend.qt.kernelmanager.QtKernelManager import load_connection_file [as 别名]
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)
示例4: default_manager
# 需要导入模块: from IPython.frontend.qt.kernelmanager import QtKernelManager [as 别名]
# 或者: from IPython.frontend.qt.kernelmanager.QtKernelManager import load_connection_file [as 别名]
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
示例5: connect_kernel
# 需要导入模块: from IPython.frontend.qt.kernelmanager import QtKernelManager [as 别名]
# 或者: from IPython.frontend.qt.kernelmanager.QtKernelManager import load_connection_file [as 别名]
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)
示例6: get_widget
# 需要导入模块: from IPython.frontend.qt.kernelmanager import QtKernelManager [as 别名]
# 或者: from IPython.frontend.qt.kernelmanager.QtKernelManager import load_connection_file [as 别名]
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
示例7: new_frontend_slave
# 需要导入模块: from IPython.frontend.qt.kernelmanager import QtKernelManager [as 别名]
# 或者: from IPython.frontend.qt.kernelmanager.QtKernelManager import load_connection_file [as 别名]
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
示例8: connect_kernel
# 需要导入模块: from IPython.frontend.qt.kernelmanager import QtKernelManager [as 别名]
# 或者: from IPython.frontend.qt.kernelmanager.QtKernelManager import load_connection_file [as 别名]
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)