Esempio n. 1
0
def setup_modes(editor, view):
    """
    Create a simple dictionary to hold instances of the available modes.

    *PREMATURE OPTIMIZATION ALERT* This may become more complex in future so
    splitting things out here to contain the mess. ;-)
    """
    modes = {
        'python': PythonMode(editor, view),
        'adafruit': AdafruitMode(editor, view),
        'microbit': MicrobitMode(editor, view),
        'debugger': DebugMode(editor, view),
    }
    # Check if pgzero is available (without importing it)
    if any([m for m in pkgutil.iter_modules() if 'pgzero' in m]):
        modes['pygamezero'] = PyGameZeroMode(editor, view)
    return modes
Esempio n. 2
0
def setup_modes(editor, view):
    """
    Create a simple dictionary to hold instances of the available modes.

    *PREMATURE OPTIMIZATION ALERT* This may become more complex in future so
    splitting things out here to contain the mess. ;-)
    """
    modes = {
        "python": PythonMode(editor, view),
        "circuitpython": CircuitPythonMode(editor, view),
        "microbit": MicrobitMode(editor, view),
        "esp": ESPMode(editor, view),
        "web": WebMode(editor, view),
        "debugger": DebugMode(editor, view),
    }

    # Check if pgzero is available (without importing it)
    if any([m for m in pkgutil.iter_modules() if "pgzero" in m]):
        modes["pygamezero"] = PyGameZeroMode(editor, view)

    # return available modes
    return modes