Esempio n. 1
0
 def initialize(self,argv=None):
     JupyterConsoleApp.initialize(self,argv)
     kernel_manager = self.kernel_manager_class(
                             connection_file=self._new_connection_file(),
                             parent=self,
                             autorestart=True,
     )
     # start the kernel
     kwargs = {}
     self.comms = {}
     # FIXME: remove special treatment of IPython kernels
     if self.kernel_manager.ipykernel:
         kwargs['extra_arguments'] = self.kernel_argv
     # kernel_manager.start_kernel(**kwargs)
     kernel_manager.start_kernel()
     # kernel_manager.client_factory = self.kernel_client_class
     self.kernel_client = kernel_manager.client()
     self.kernel_client.start_channels(shell=True, iopub=True)
     # print(dir(self.kernel_client.shell_channel))
     self.comm_manager = CommManager(parent=self.kernel_client, kernel_client=self.kernel_client)
     # self.blocking_client = self.kernel_client.blocking_client()
     # self.blocking_client.start_channels(shell=True, iopub=True)
     # self.comm_manager = self.kernel_client.comm_manager
     # print(self.kernel_client)
     # kernel_client.start_channels(shell=True, iopub=True)
     # self._init_asyncio_patch()
     super().initialize(argv)
     # self.comm_manager = self.kernel_client.comm_manager
     # self.comm_manager.register_target('neos_comm', self.comm_open)
     comm = self.comm_manager.new_comm("neos_comm")
     self.nep_start(comm)
Esempio n. 2
0
    def initialize(self, argv=None):
        self.init_qt_app()
        super(ChatConsoleApp, self).initialize(argv)
        if self._dispatching:
            return
        # handle renames related to JupyterQtConsole, accepting  as outdated config
        for old_name, new_name in [
            ('IPythonQtConsoleApp', 'ChatConsole'),
            ('IPythonWidget', 'PlainTabMain'),
            ('RichIPythonWidget', 'RichTabMain'),
            ('JupyterQtConsole', 'ChatConsole'),
            ('RichJupyterWidget', 'RichTabMain'),
            ('JupyterWidget', 'PlainTabMain')
        ]:
            cfg = self._deprecate_config(self.config, old_name, new_name)
            if cfg:
                self.update_config(cfg)

        if not self.existing:
            if not self.local_kernel:
                self.storage = JSONStorage(chconsole_data_dir(), self.default_file)
                self.chooser = FileChooser(self.storage, self.storage_key, get_home_dir(), self.default_file,
                                           parent=None, caption='Choose Existing Connection File', file_filter='*.json',
                                           default_ext='json')
                if self.chooser.choose_file() and os.path.exists(self.chooser.file):
                    connection_data = JSONStorage(self.chooser.dir, self.chooser.name)
                    self.existing = self.chooser.file

        JupyterConsoleApp.initialize(self, argv)

        self.init_qt_elements()
        self.init_signal()
Esempio n. 3
0
 def init_shell(self):
     JupyterConsoleApp.initialize(self)
     # relay sigint to kernel
     signal.signal(signal.SIGINT, self.handle_sigint)
     self.shell = ZMQTerminalInteractiveShell.instance(parent=self,
                     manager=self.kernel_manager,
                     client=self.kernel_client,
     )
     self.shell.own_kernel = not self.existing
Esempio n. 4
0
 def init_shell(self):
     JupyterConsoleApp.initialize(self)
     # relay sigint to kernel
     signal.signal(signal.SIGINT, self.handle_sigint)
     self.shell = ZMQTerminalInteractiveShell.instance(parent=self,
                     display_banner=False, profile_dir=self.profile_dir,
                     ipython_dir=self.ipython_dir,
                     manager=self.kernel_manager,
                     client=self.kernel_client,
     )
Esempio n. 5
0
    def init_shell(self):
        """
        Initializes the interactive shell and set signal handlers.
        """
        JupyterConsoleApp.initialize(self)

        signal.signal(signal.SIGINT, self._handle_sigint)
        self.shell = JaffleAppShell.instance(parent=self,
                                             manager=self.kernel_manager,
                                             client=self.kernel_client,
                                             app_name=self.app.name,
                                             app_data=self.app)
Esempio n. 6
0
 def init_shell(self):
     JupyterConsoleApp.initialize(self)
     # relay sigint to kernel
     signal.signal(signal.SIGINT, self.handle_sigint)
     self.shell = ZMQTerminalInteractiveShell.instance(
         parent=self,
         display_banner=False,
         profile_dir=self.profile_dir,
         ipython_dir=self.ipython_dir,
         manager=self.kernel_manager,
         client=self.kernel_client,
     )
Esempio n. 7
0
 def initialize(self, argv=None):
     self.init_qt_app()
     super(JupyterQtConsoleApp, self).initialize(argv)
     # handle deprecated renames
     for old_name, new_name in [
         ('IPythonQtConsoleApp', 'JupyterQtConsole'),
         ('IPythonWidget', 'JupyterWidget'),
         ('RichIPythonWidget', 'RichJupyterWidget'),
     ]:
         cfg = self._deprecate_config(self.config, old_name, new_name)
         if cfg:
             self.update_config(cfg)
     JupyterConsoleApp.initialize(self, argv)
     self.init_qt_elements()
     self.init_signal()
Esempio n. 8
0
 def initialize(self, argv=None):
     self.init_qt_app()
     super(JupyterQtConsoleApp, self).initialize(argv)
     # handle deprecated renames
     for old_name, new_name in [
         ('IPythonQtConsoleApp', 'JupyterQtConsole'),
         ('IPythonWidget', 'JupyterWidget'),
         ('RichIPythonWidget', 'RichJupyterWidget'),
     ]:
         cfg = self._deprecate_config(self.config, old_name, new_name)
         if cfg:
             self.update_config(cfg)
     JupyterConsoleApp.initialize(self,argv)
     self.init_qt_elements()
     self.init_signal()
Esempio n. 9
0
 def initialize(self, argv=None):
     self.init_qt_app()
     super(JupyterQtConsoleApp, self).initialize(argv)
     if 'IPythonQtConsoleApp' in self.config:
         self.log.warn("Use JupyterQtConsoleApp in config, not IPythonQtConsoleApp. Outdated config:\n%s",
             '\n'.join('IPythonQtConsoleApp.{key} = {value!r}'.format(key=key, value=value)
                 for key, value in self.config.IPythonQtConsoleApp.items()
             )
         )
         cfg = self.config.copy()
         cfg.JupyterQtConsoleApp.merge(cfg.IPythonQtConsoleApp)
         self.update_config(cfg)
     JupyterConsoleApp.initialize(self,argv)
     self.init_qt_elements()
     self.init_signal()
Esempio n. 10
0
 def initialize(self, argv=None):
     self.init_qt_app()
     super(JupyterQtConsoleApp, self).initialize(argv)
     if 'IPythonQtConsoleApp' in self.config:
         self.log.warn(
             "Use JupyterQtConsoleApp in config, not IPythonQtConsoleApp. Outdated config:\n%s",
             '\n'.join(
                 'IPythonQtConsoleApp.{key} = {value!r}'.format(key=key,
                                                                value=value)
                 for key, value in self.config.IPythonQtConsoleApp.items()))
         cfg = self.config.copy()
         cfg.JupyterQtConsoleApp.merge(cfg.IPythonQtConsoleApp)
         self.update_config(cfg)
     JupyterConsoleApp.initialize(self, argv)
     self.init_qt_elements()
     self.init_signal()
Esempio n. 11
0
 def initialize(self, argv=None):
     self.init_qt_app()
     super(JupyterQtConsoleApp, self).initialize(argv)
     if self._dispatching:
         return
     # handle deprecated renames
     for old_name, new_name in [
         ("IPythonQtConsoleApp", "JupyterQtConsole"),
         ("IPythonWidget", "JupyterWidget"),
         ("RichIPythonWidget", "RichJupyterWidget"),
     ]:
         cfg = self._deprecate_config(self.config, old_name, new_name)
         if cfg:
             self.update_config(cfg)
     JupyterConsoleApp.initialize(self, argv)
     self.init_qt_elements()
     self.init_signal()
Esempio n. 12
0
    def init_shell(self):
        """
        Initializes the interactive shell and set signal handlers.
        """
        # Initializes kernel client and ZeroMQ channels.
        JupyterConsoleApp.initialize(self)

        signal.signal(signal.SIGINT, self.handle_sigint)
        self.shell = JaffleInteractiveShell.instance(
            parent=self,
            manager=self.kernel_manager,
            client=self.kernel_client,
        )
        self.shell.own_kernel = not self.existing

        _ask_exit_org = self.shell.ask_exit

        def ask_exit():
            print('Detaching {}'.format(self.session_id))
            _ask_exit_org()

        self.shell.ask_exit = ask_exit
Esempio n. 13
0
 def initialize(self, argv=None):
     # Fixes launching issues with Big Sur
     # https://bugreports.qt.io/browse/QTBUG-87014, fixed in qt 5.15.2
     if sys.platform == 'darwin' and LooseVersion(
             QT_VERSION) < LooseVersion('5.15.2'):
         os.environ['QT_MAC_WANTS_LAYER'] = '1'
     self._init_asyncio_patch()
     self.init_qt_app()
     super().initialize(argv)
     if self._dispatching:
         return
     # handle deprecated renames
     for old_name, new_name in [
         ('IPythonQtConsoleApp', 'JupyterQtConsole'),
         ('IPythonWidget', 'JupyterWidget'),
         ('RichIPythonWidget', 'RichJupyterWidget'),
     ]:
         cfg = self._deprecate_config(self.config, old_name, new_name)
         if cfg:
             self.update_config(cfg)
     JupyterConsoleApp.initialize(self, argv)
     self.init_qt_elements()
     self.init_signal()
Esempio n. 14
0
 def initialize(self, target, argv):
     self.target = target
     super(JupyterVimApp, self).initialize(argv)
     JupyterConsoleApp.initialize(self, argv)
Esempio n. 15
0
 def initialize(self, target, argv):
     self.target = target
     super(JupyterVimApp, self).initialize(argv)
     JupyterConsoleApp.initialize(self, argv)
Esempio n. 16
0
 def initialize(self, argv=None):
     self.init_qt_app()
     super(JupyterQtConsoleApp, self).initialize(argv)
     JupyterConsoleApp.initialize(self,argv)
     self.init_qt_elements()
     self.init_signal()
 def initialize(self, argv=None):
     # self.kernel_name = 'jupyter-infinite'
     super(ProxyingClient, self).initialize(argv)
     JupyterConsoleApp.initialize(self)
Esempio n. 18
0
 def initialize(self, argv=None):
     self.init_qt_app()
     super(JupyterQtConsoleApp, self).initialize(argv)
     JupyterConsoleApp.initialize(self, argv)
     self.init_qt_elements()
     self.init_signal()