Beispiel #1
0
def mcus():
    """MCU list."""
    ls = []
    for h in hwpack_names():
        for b in board_names(h):
            ls += [mcu(b, h)]
    ls = sorted(list(set(ls)))
    return ls
Beispiel #2
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)
Beispiel #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)
Beispiel #4
0
    def test_boards(self):
        d = tmpdir(suffix='_test')
        os.environ['ARDUINO_HOME'] = d
        boards_txt = d / 'hardware' / 'arduino' / 'boards.txt'

        boards_txt.parent.makedirs()

        boards_txt.write_text('')
        eq_(board_names(), [])
        check_keys(boards().keys(), [])

        # invalid board
        boards_txt.write_text('''
brd.x3=foo
        ''')
        eq_(board_names(), [])

        boards_txt.write_text('''
brd.name=foo
brd.build=foo
brd.x3=foo
        ''')
        eq_(board_names(), ['brd'])
        check_keys(boards().keys(), ['brd'])

        # invalid
        install_board('ardu', dict(x1='hi'))
        eq_(board_names(), ['brd'])

        install_board('ardu', dict(name='hi', build=1))
        eq_(set(board_names()), set(['brd', 'ardu']))

        install_board('ardu', dict(x1='hi'))
        eq_(set(board_names()), set(['brd', 'ardu']))

        remove_board('brd')
        eq_(board_names(), ['ardu'])