Пример #1
0
def remove_board(board_id):
    """remove board.

    :param board_id: board id (e.g. 'diecimila')
    :rtype: None

    """

    log.debug('remove %s', board_id)
    lines = boards_txt().lines()
    lines = filter(lambda x: not x.strip().startswith(board_id + '.'), lines)
    boards_txt().write_lines(lines)
Пример #2
0
def install_board(board_id, board_options, hwpack='arduino', replace_existing=False):
    """install board in boards.txt.

    :param board_id: string identifier
    :param board_options: dict like
    :param replace_existing: bool
    :rtype: None

    """
    doaction = 0
    if board_id in boards(hwpack).keys():
        log.debug('board already exists: %s', board_id)
        if replace_existing:
            log.debug('remove board: %s' , board_id)
            remove_board(board_id)
            doaction = 1
    else:
        doaction = 1

    if doaction:
        lines = bunch2properties(board_id, board_options)
        boards_txt().write_lines([''] + lines, append=1)
Пример #3
0
def remove_boards_gui(hwpack=""):
    """remove boards by GUI."""
    if not hwpack:
        if len(hwpack_names()) > 1:
            hwpack = psidialogs.choice(hwpack_names(), "select hardware package to select board from!", title="select")
        else:
            hwpack = hwpack_names()[0]
    print("%s selected" % hwpack)

    if hwpack:
        sel = psidialogs.multi_choice(
            board_names(hwpack), "select boards to remove from %s!" % boards_txt(hwpack), title="remove boards"
        )
        print("%s selected" % sel)

        if sel:
            for x in sel:
                remove_board(x)
                print("%s was removed" % x)
Пример #4
0
def remove_boards_gui(hwpack=''):
    """remove boards by GUI."""
    if not hwpack:
        if len(hwpack_names()) > 1:
            hwpack = psidialogs.choice(
                hwpack_names(),
                'select hardware package to select board from!',
                title='select')
        else:
            hwpack = hwpack_names()[0]
    print('%s selected' % hwpack)

    if hwpack:
        sel = psidialogs.multi_choice(board_names(hwpack),
                                      'select boards to remove from %s!' %
                                      boards_txt(hwpack),
                                      title='remove boards')
        print('%s selected' % sel)

        if sel:
            for x in sel:
                remove_board(x)
                print('%s was removed' % x)