Example #1
0

"""
Prva pozicia lodiek
    loop: pre kazdu lodku
"""
for i in range(canvasConfig.numOfBoats):
    # Pozicia y pri konkretnych lodkach zavisi od indexu lode (su pod sebou)
    yPosition = (canvasConfig.height - 50) / canvasConfig.numOfBoats * (i + 1)

    # prida do zoznamu lodi konkretne objekty lodi, ktorym urci zaciatocne suradnice
    boats.append(
        Boat(
            # tretia suradnica pre vlajku (ostatne nam netreba, lebo sa daju vypocitat z polohy)
            generateRandomFlag(20, yPosition),
            # lokacia lode
            [20, yPosition],
            # Zaciatocna rychlost
            0))

# aplikuje ich na canvas
for boat in boats:
    canvasService.createBoat(boat)
    canvasService.updateCanvas()
"""
Tu zacina zavod
"""
while getMaximumXValue(boats) < canvasConfig.finalLineXLocation - 20:

    # na zaciatku kazdeho dalsieho loopu vycisti canvas
    canvasService.deleteAll()
Example #2
0
def get_boat_list():
    boats = []
    for boat in Boat.select().join(Member):
        boats.append(boat)
    return boats
Example #3
0
def get_boats_for_member(member):
    boats = []
    for boat in Boat.select().where(Boat.owner == member):
        boats.append(boat)
    return boats
Example #4
0
def add_boat(owner, type, boat_length):
    boat = Boat.create(owner=owner, type=type, boat_length=boat_length)
    return boat