Ejemplo n.º 1
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()
Ejemplo n.º 2
0
    def __init__(self):
        super(AppMain, self).__init__()

        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 Connection File or Enter New File Name',
                                   file_filter='*.json',
                                   default_ext='json')

        self.text_area = QtGui.QPlainTextEdit()
        self.text_area.setReadOnly(True)
        self.setCentralWidget(self.text_area)

        self.setGeometry(300, 300, 700, 200)
        self.setWindowTitle('IPython Kernel Launched')