Exemple #1
0
def make_model():
    name = text_input("Model name: ")

    print "Choose a category:"
    _, category = choose_one_from_list(CATEGORIES)

    description = text_input("Description: ", True)

    print "Add color options:"
    colors = choose_many_from_list(COLORS)
    colors = [x for _, x in colors]

    print "Add size options:"
    # This includes size selection, and additional info for each size
    sizes = choose_many_from_list(SIZES)
    sizes = {x: {} for _, x in sizes}

    for size, details in sizes.iteritems():
        print "\nMODEL:\t{}\tSIZE:\t{}".format(name, size)
        details["weight"] = positive_int_input("Enter weight (Kg): ")
        details["price"] = positive_int_input("Enter cost (US $): ")

    return Model(name, category, description, colors, sizes)
def make_model(models, CATEGORIES, COLORS, SIZES):
    name = text_input("Model name: ")

    print("Choose a category:   ")
    _, category = choose_one_from_list(CATEGORIES)

    description = text_input("Description: ")

    print("Add color options:")
    colors = choose_many_from_list(COLORS)

    print("Add size options:")
    # This includes size selection, and additional info for each size
    size_lst = choose_many_from_list(SIZES)
    sizes = {x: {} for x in size_lst}

    for size in size_lst:
        print("\nMODEL:\t{}\tSIZE:\t{}".format(name, size))
        sizes[size]['weight'] = positive_float_input("Enter weight (Kg): ")
        sizes[size]['price'] = positive_float_input("Enter cost (US $): ")

    print
    models[name] = Model(name, category, description, colors, sizes)
def make_model(models, CATEGORIES, COLORS, SIZES):
    name = text_input("Model name: ")

    print ("Choose a category:   ")
    _, category = choose_one_from_list(CATEGORIES)

    description = text_input("Description: ")

    print ("Add color options:")
    colors = choose_many_from_list(COLORS)

    print ("Add size options:")
    # This includes size selection, and additional info for each size
    size_lst = choose_many_from_list(SIZES)
    sizes = {x: {} for x in size_lst}

    for size in size_lst:
        print ("\nMODEL:\t{}\tSIZE:\t{}".format(name, size))
        sizes[size]['weight'] = positive_float_input("Enter weight (Kg): ")
        sizes[size]['price'] = positive_float_input("Enter cost (US $): ")
    
    print
    models[name]=Model(name, category, description, colors, sizes)