示例#1
0
def main():
    db_initialize()

    # basic menu I think, I'm not sure if I should've put validation here or elsewhere.
    menu_selection = ''
    while menu_selection.lower() != 'q':
        menu_selection = ui.display_menu()

        if menu_selection == '1':
            # selection 1 goes to the UI to get info from the user
            # then puts those together to add the artist, taking the response
            # and sending it to be displayed.
            artist_name = ui.get_artist_name()
            artist_email = ui.get_artist_email()
            response = add_artist((artist_name, artist_email))
            ui.message(response)
        elif menu_selection == '2':
            # adding artwork does much the same, requests info and then attemps to add
            # if it's successful, the response gives an ok.
            artwork_data = ui.get_artwork_info()
            response = add_artwork(artwork_data)
            ui.message(response)
        elif menu_selection == '3':
            data = select_artists()
            ui.display_artists(data)
        elif menu_selection == '4':
            artist_id = ui.get_artist_id()
            data = select_artworks(artist_id)
            ui.display_artworks(data)
        # elif menu_selection == '5':

    ui.quit()
示例#2
0
 def quit(self):
     ui.quit()
示例#3
0
 def _on_destroy(self,*args):
   if ui.is_running():
     ui.quit()
示例#4
0
 def _on_exit(self,u):
   ui.quit()