Esempio n. 1
0
def profile_menu(login):
    print('logged as: ' + login)
    menu_commands = [
        'Show my gallery', 'Generate new art', 'Rate paintings',
        'Save your changes & logout'
    ]
    index_ = 0
    i = 0
    logged_in = True
    while logged_in:
        print_magic_menu(menu_commands, index_, 'logged as: ' + login)
        index_, choice = get_input(index_, menu_commands)
        if index_ == 0 and choice == 1:
            if os.path.isfile("profiles/" + login + '.json'):
                picture = data_manager.import_from_file(login)
                pictures.display_gallery(picture)
                input("Press Enter to continue...")
            else:
                print('Your gallery is empty')
                input("Press Enter to continue...")

        if index_ == 1 and choice == 1:
            picture = pictures.generate_picture()
            pictures.display_picture(picture)
            choose_picture(login, picture)
        if index_ == 2 and choice == 1:
            picture = rating_pictures()
            gallery_ = grade_picture(picture)
            data_manager.export_to_file(login, gallery_)
        if index_ == 3 and choice == 1:
            logged_in = False
Esempio n. 2
0
 def test_autumn(self):
     with self.application.app_context():
         image_link = generate_picture('autumn', self.images_links)
         assert image_link is not None
Esempio n. 3
0
def choose_picture(login, picture):
    edit = True
    while edit:
        options = [
            "I want more harmony!", "Give me some chaos!",
            "I need something complately else", "Change coloristics",
            "Turn on sector changing mode", "Turn off sector changing mode",
            "Masterpiece - save!"
        ]
        print_menu(options)
        print("How do you like this picture?\n")
        decision = getch()

        if decision == "1":

            picture = pictures.change_picture(picture, harmony=1)
            pictures.display_picture(picture)

        elif decision == "2":
            percent_of_change = 0.6
            picture = pictures.change_picture(picture, percent_of_change)
            pictures.display_picture(picture)

        elif decision == "3":
            picture = pictures.generate_picture()
            pictures.display_picture(picture)

        elif decision == "4":
            percent_of_change = manipulate_color_menu()
            picture = pictures.change_picture(picture, percent_of_change)
            pictures.display_picture(picture)

        elif decision == "5":
            try:
                sector = int(
                    input(
                        " 1  2  3\n 4  5  6\n 7  8  9\n Choose number of sector you want to change: "
                    ))
            except ValueError:
                print("You entered wrong data")
            temp = picture
            picture, data_list = pictures.choose_sector(temp, sector)
            pictures.display_picture(
                pictures.replace_changed_sector(temp, picture, data_list))

        elif decision == "6":
            try:
                picture = pictures.replace_changed_sector(
                    temp, picture, data_list)
                print("Sector changing mode turned off")
                pictures.display_picture(picture)
            except UnboundLocalError:
                print("You are not in sector changing mode yet ;)")

        elif decision == "7":
            gallery_ = pictures.make_gallery(picture, login)
            data_manager.export_to_file(login, gallery_)
            edit = False
            print("Your picture is saved in gallery")

        elif decision == "q":
            sys.exit()
Esempio n. 4
0
 def test_wrong_weather(self):
     with self.application.app_context():
         assert generate_picture('wrong_weather_type',
                                 self.images_links) is None