def show_all_available(): artworks = Artwork.select().where(Artwork.sold == False) if artworks: for artwork in artworks: ui.display(format_artwork(artwork)) else: ui.display('No artwork found')
def main(): while True: rules = [] rules = get_rules_from_file() user_is_smart = False print(rules) while user_is_smart == False: user_choose = menu() if user_choose == '1': content = make_content_from_file("random_like_init.txt") elif user_choose == '2': content = make_content_from_file("glider.txt") elif user_choose == '3': content = make_content_from_file("stable_configurations.txt") elif user_choose == '4': content = make_content_from_file("glider_gun.txt") elif user_choose == '5': filename = input("Insert path here:") content = make_content_from_file(filename) else: print('Think again!') continue user_is_smart = True display(content) input('Press enter to start!') run = True while run: try: display(content) time.sleep(.1) content = step(content, rules) clear() except KeyboardInterrupt: break
def get_by_id(): id = ui.get_positive_integer("Enter artwork by id: ") try: artwork = Artwork.get(Artwork.id == id) ui.display(format_artwork(artwork)) return artwork except Exception: ui.display("Artwork does not exist")
def update_by_id(): show_all() artist = get_by_id() name, email = get_name_and_email() artist.name = name artist.email = email artist.save() ui.display("Success") ui.display(format_artist(artist))
def update_by_id(): show_all() artwork = get_by_id() artwork.name = get_artwork_name() artwork.price = get_artwork_price() artwork.sold = get_artwork_sold_status() artwork.save() ui.display("Success") ui.display(format_artwork(artwork))
def show_all_available_by_artist(): artist_control.show_all() artist = artist_control.get_by_id() artworks = Artwork.select().where(Artwork.sold == False, Artwork.artist == artist) if artworks: for artwork in artworks: ui.display(format_artwork(artwork)) else: ui.display('No artwork found')
def main(): key = setup.setup_api() city, state, country = ui.get_search_information() data = api_request.send_api_request(city, state, country, key) list = tools.seperate_needed_data(data) ui.display(list)
def search(): # Calls the get city from the ui module and prompts the user to enter the city city = ui.get_city() """ The city variable is passed to the restaurant, events, and weather module to get the data from the server via API """ restaurants = rest.get_restaurants( city) #Returns the restaurant in a particular city events = city_event.get_events(city) # Returns the events at the city current_weather = weather.get_current_weather( city) # Returns the weather condition and temp # The display function from the ui module takes in the restaurant data, events, and weather as arguments and displays the information ui.display(restaurants, events, current_weather) # figure out if user wants to save choice = input('Do you want to bookmark the results? y or n') choice = choice.lower() # Makes the choice case insensitive if choice == 'y': db.save(restaurants, events, weather)
def create(): try: name, email = get_name_and_email() artist = Artist.create(name=name, email=email) ui.display('Success') ui.display(format_artist(artist)) except IntegrityError: ui.display('Artist already exists')
def create(): try: artist_control.show_all() artist = artist_control.get_by_id() name = get_artwork_name() price = get_artwork_price() sold = False artwork = Artwork.create( artist=artist, name=name, price=price, sold=sold) ui.display('Success') ui.display(format_artwork(artwork)) except IntegrityError: ui.display('Artwork already exists')
def get_by_id(): id = ui.get_positive_integer("Enter artist id: ") artist = Artist.get(Artist.id == id) ui.display(format_artist(artist)) return artist
def show_all(): artists = Artist.select() for artist in artists: ui.display(format_artist(artist))
def show_all(): artworks = Artwork.select() for artwork in artworks: ui.display(format_artwork(artwork))
def show(): """ show all saved city data""" all_data = db.get_all() # Gets all the bookmarked data from the database ui.display(all_data) # Displays all the records from the database.
def show(): """ show all saved city data""" all_data = db.get_all() ui.display(all_data)