Ejemplo n.º 1
0
def main():
    """ The IPython kernel main entry point.
    """
    parser = make_argument_parser()
    parser.add_argument(
        "--pylab",
        type=str,
        metavar="GUI",
        nargs="?",
        const="auto",
        help="Pre-load matplotlib and numpy for interactive use. If GUI is not \
given, the GUI backend is matplotlib's, otherwise use one of: \
['tk', 'gtk', 'qt', 'wx', 'inline'].",
    )
    parser.add_argument(
        "--colors",
        type=str,
        dest="colors",
        help="Set the color scheme (NoColor, Linux, and LightBG).",
        metavar="ZMQInteractiveShell.colors",
    )
    namespace = parser.parse_args()

    kernel_class = Kernel

    kernel_classes = {
        "qt": QtKernel,
        "qt4": QtKernel,
        "inline": Kernel,
        "wx": WxKernel,
        "tk": TkKernel,
        "gtk": GTKKernel,
    }
    if namespace.pylab:
        if namespace.pylab == "auto":
            gui, backend = pylabtools.find_gui_and_backend()
        else:
            gui, backend = pylabtools.find_gui_and_backend(namespace.pylab)
        kernel_class = kernel_classes.get(gui)
        if kernel_class is None:
            raise ValueError("GUI is not supported: %r" % gui)
        pylabtools.activate_matplotlib(backend)
    if namespace.colors:
        ZMQInteractiveShell.colors = namespace.colors

    kernel = make_kernel(namespace, kernel_class, OutStream)

    if namespace.pylab:
        pylabtools.import_pylab(kernel.shell.user_ns, backend, shell=kernel.shell)

    start_kernel(namespace, kernel)
Ejemplo n.º 2
0
def main():
    """ The IPython kernel main entry point.
    """
    parser = make_argument_parser()
    parser.add_argument('--pylab', type=str, metavar='GUI', nargs='?',
                        const='auto', help = \
"Pre-load matplotlib and numpy for interactive use. If GUI is not \
given, the GUI backend is matplotlib's, otherwise use one of: \
['tk', 'gtk', 'qt', 'wx', 'osx', 'inline']."                                            )
    parser.add_argument(
        '--colors',
        type=str,
        dest='colors',
        help="Set the color scheme (NoColor, Linux, and LightBG).",
        metavar='ZMQInteractiveShell.colors')
    namespace = parser.parse_args()

    kernel_class = Kernel

    kernel_classes = {
        'qt': QtKernel,
        'qt4': QtKernel,
        'inline': Kernel,
        'osx': TkKernel,
        'wx': WxKernel,
        'tk': TkKernel,
        'gtk': GTKKernel,
    }
    if namespace.pylab:
        if namespace.pylab == 'auto':
            gui, backend = pylabtools.find_gui_and_backend()
        else:
            gui, backend = pylabtools.find_gui_and_backend(namespace.pylab)
        kernel_class = kernel_classes.get(gui)
        if kernel_class is None:
            raise ValueError('GUI is not supported: %r' % gui)
        pylabtools.activate_matplotlib(backend)
    if namespace.colors:
        ZMQInteractiveShell.colors = namespace.colors

    kernel = make_kernel(namespace, kernel_class, OutStream)

    if namespace.pylab:
        pylabtools.import_pylab(kernel.shell.user_ns,
                                backend,
                                shell=kernel.shell)

    start_kernel(namespace, kernel)
Ejemplo n.º 3
0
def main():
    """ The IPython kernel main entry point.
    """
    parser = make_argument_parser()
    parser.add_argument('--pylab', type=str, metavar='GUI', nargs='?', 
                        const='auto', help = \
"Pre-load matplotlib and numpy for interactive use. If GUI is not \
given, the GUI backend is matplotlib's, otherwise use one of: \
['tk', 'gtk', 'qt', 'wx', 'osx', 'inline'].")
    parser.add_argument('--colors',
        type=str, dest='colors',
        help="Set the color scheme (NoColor, Linux, and LightBG).",
        metavar='ZMQInteractiveShell.colors')
    namespace = parser.parse_args()

    kernel_class = Kernel

    kernel_classes = {
        'qt' : QtKernel,
        'qt4': QtKernel,
        'inline': Kernel,
        'osx': TkKernel,
        'wx' : WxKernel,
        'tk' : TkKernel,
        'gtk': GTKKernel,
    }
    if namespace.pylab:
        if namespace.pylab == 'auto':
            gui, backend = pylabtools.find_gui_and_backend()
        else:
            gui, backend = pylabtools.find_gui_and_backend(namespace.pylab)
        kernel_class = kernel_classes.get(gui)
        if kernel_class is None:
            raise ValueError('GUI is not supported: %r' % gui)
        pylabtools.activate_matplotlib(backend)
    if namespace.colors:
        ZMQInteractiveShell.colors=namespace.colors

    kernel = make_kernel(namespace, kernel_class, OutStream)

    if namespace.pylab:
        pylabtools.import_pylab(kernel.shell.user_ns, backend,
                                shell=kernel.shell)

    start_kernel(namespace, kernel)