How to use the qtconsole.inprocess.QtInProcessKernelManager function in qtconsole

To help you get started, we’ve selected a few qtconsole examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Fluorescence-Tools / chisurf / chisurf / widgets / widgets.py View on Github external
def __init__(
            self,
            history_widget: QtWidgets.QPlainTextEdit = None,
            *args,
            **kwargs
    ):
        """

        :param args:
        :param kwargs:
        """
        super().__init__(*args, **kwargs)
        self.history_widget = history_widget

        self.kernel_manager = kernel_manager = qtconsole.inprocess.QtInProcessKernelManager()
        kernel_manager.start_kernel()
        self.kernel_client = kernel_client = kernel_manager.client()
        kernel_client.start_channels()

        def stop():
            kernel_client.stop_channels()
            kernel_manager.shutdown_kernel()
            IPython.lib.guisupport.get_app_qt4().exit()

        self.exit_requested.connect(stop)
        self.width = kwargs.get(
            'width',
            chisurf.settings.gui['console']['width']
        )
        self._macro = ""
        self.recording = False
github taurus-org / taurus / lib / taurus / qt / qtgui / console / taurusconsole.py View on Github external
def getKernelManager():
        """
        Returns a QtInProcessKernelManager, already initialized.

        :return: `qtconsole.inprocess.QtInProcessKernelManager`
        """
        kernel_manager = QtInProcessKernelManager()
        kernel_manager.start_kernel(show_banner=False)
        kernel_manager.kernel.gui = 'qt4'
        return kernel_manager
github Fluorescence-Tools / chisurf / mfm / widgets / widgets.py View on Github external
def __init__(
            self,
            history_widget: QtWidgets.QPlainTextEdit = None,
            *args,
            **kwargs
    ):
        """

        :param args:
        :param kwargs:
        """
        super().__init__(*args, **kwargs)
        self.history_widget = history_widget

        self.kernel_manager = kernel_manager = QtInProcessKernelManager()
        kernel_manager.start_kernel()
        self.kernel_client = kernel_client = kernel_manager.client()
        kernel_client.start_channels()

        def stop():
            kernel_client.stop_channels()
            kernel_manager.shutdown_kernel()
            guisupport.get_app_qt4().exit()

        self.exit_requested.connect(stop)
        self.width = kwargs.get(
            'width',
            mfm.settings.gui['console']['width']
        )
        self._macro = ""
        self.recording = False
github neuropy / neuropy / neuropy / main.py View on Github external
def main():
    """Start kernel manager and client, create window, run app event loop,
    auto execute some code in user namespace. A minimalist example is shown in
    qt_ip_test.py.

    NOTE: Make sure that the Qt v2 API is being used by IPython by running `export
    QT_API=pyqt` at the command line before running neuropy, or by adding it to `.bashrc`"""
    app = guisupport.get_app_qt4()

    if INPROCESS:
        from qtconsole.inprocess import QtInProcessKernelManager
        km = QtInProcessKernelManager()
    else:
        from qtconsole.manager import QtKernelManager
        km = QtKernelManager()
    km.start_kernel()
    km.kernel.gui = 'qt4'
    kc = km.client()
    kc.start_channels()

    nw = NeuropyWindow()
    ipw = nw.ipw
    config_ipw(ipw)
    ipw.kernel_manager = km
    ipw.kernel_client = kc
    ipw.exit_requested.connect(nw.stop)
    nw.show()
github mmolero / pcloudpy / pcloudpy / gui / shell / IPythonConsole.py View on Github external
def __init__(self, **kwarg):
        super(RichIPythonWidget, self).__init__()
        self.app = app = guisupport.get_app_qt4()
        self.kernel_manager = QtInProcessKernelManager()
        self.kernel_manager.start_kernel()
        self.kernel = self.kernel_manager.kernel
        self.kernel.gui = 'qt4'
        self.kernel.shell.push(kwarg)
        self.kernel_client = self.kernel_manager.client()
        self.kernel_client.start_channels()
github UAVCAN / gui_tool / uavcan_gui_tool / widgets / console.py View on Github external
def _get_kernel_manager(self):
        if self._kernel_manager is None:
            if not JUPYTER_AVAILABLE:
                raise RuntimeError('Jupyter is not available on this system')

            # Initializing the kernel
            self._kernel_manager = QtInProcessKernelManager()
            self._kernel_manager.start_kernel()
            self._kernel_manager.kernel.gui = 'qt'

            # Initializing context
            self._kernel_manager.kernel.shell.push({x.name : x.object for x in self._get_context()})

        return self._kernel_manager
github ronpandolfi / Xi-cam / xicam / plugins / zipythonconsole.py View on Github external
def __init__(self, *args, **kwargs):
        with open('xicam/gui/style.stylesheet', 'r') as f:
            style = f.read()
        style = (qdarkstyle.load_stylesheet() + style)

        kernel_manager = QtInProcessKernelManager()
        kernel_manager.start_kernel()
        kernel = kernel_manager.kernel
        kernel.gui = 'qt4'
        kernel.shell.push(dict(plugins.plugins))

        kernel_client = kernel_manager.client()
        kernel_client.start_channels()

        def stop():
            kernel_client.stop_channels()
            kernel_manager.shutdown_kernel()


        control = RichJupyterWidget()
        control.kernel_manager = kernel_manager
        control.kernel_client = kernel_client
github glue-viz / glue / glue / app / qt / terminal.py View on Github external
def start_in_process_kernel():

    global kernel_manager, kernel_client

    kernel_manager = QtInProcessKernelManager()
    kernel_manager.start_kernel()

    kernel_client = kernel_manager.client()
    kernel_client.start_channels()
github Ulm-IQO / qudi / gui / manager / managergui.py View on Github external
def startIPython(self):
        """ Create an IPython kernel manager and kernel.
            Add modules to its namespace.
        """
        # make sure we only log errors and above from ipython
        logging.getLogger('ipykernel').setLevel(logging.WARNING)
        self.log.debug('IPy activation in thread {0}'.format(
            QtCore.QThread.currentThreadId()))
        self.kernel_manager = QtInProcessKernelManager()
        self.kernel_manager.start_kernel()
        self.kernel = self.kernel_manager.kernel
        self.namespace = self.kernel.shell.user_ns
        self.namespace.update({
            'np': np,
            'config': self._manager.tree['defined'],
            'manager': self._manager
        })
        if _has_pyqtgraph:
            self.namespace['pg'] = pg
        self.updateIPythonModuleList()
        self.kernel.gui = 'qt4'
        self.log.info('IPython has kernel {0}'.format(
            self.kernel_manager.has_kernel))
        self.log.info('IPython kernel alive {0}'.format(
            self.kernel_manager.is_alive()))