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
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
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)
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)
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
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)
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
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
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
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)
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)