def __change_group(): res = 0 __show_groups() while not res: group_id = raw_input(strings.input_id) res = __validate_int(group_id) if res: if not __groups_lab.get_groups().has_key(int(group_id)): print strings.wrong_input res = 0 else: group = __groups_lab.get_groups().get(int(group_id)) gui.clean() while 1: gui.print_group_change_menu() choices_menu = raw_input(strings.choice_hint) try: choices_menu = int(choices_menu) if choices_menu == 1: gui.clean() group.set_name(raw_input(strings.input_name)) gui.successful_message() continue elif choices_menu == 2: gui.clean() break else: print(strings.wrong_input) except ValueError: print(strings.wrong_input)
def __change_film(): res = 0 __show_films() while not res: film_id = raw_input(strings.input_id) res = __validate_int(film_id) if res: if not __films_lab.get_films().has_key(int(film_id)): print strings.wrong_input res = 0 else: film = __films_lab.get_films().get(int(film_id)) gui.clean() while 1: gui.print_producer_change_menu() choices_menu = raw_input(strings.choice_hint) try: choices_menu = int(choices_menu) if choices_menu == 1: gui.clean() film.set_name(raw_input(strings.input_name)) gui.successful_message() continue elif choices_menu == 2: gui.clean() film.set_location(raw_input( strings.input_location)) gui.successful_message() continue elif choices_menu == 3: gui.clean() film.set_date(raw_input(strings.input_date)) gui.successful_message() continue elif choices_menu == 4: gui.clean() break else: print(strings.wrong_input) except ValueError: print(strings.wrong_input)
def __change_producer(): res = 0 __show_producers() while not res: producer_id = raw_input(strings.input_id) res = __validate_int(producer_id) if res: if not __producers_lab.get_producers().has_key(int(producer_id)): print strings.wrong_input res = 0 else: producer = __producers_lab.get_producers().get( int(producer_id)) gui.clean() while 1: gui.print_producer_change_menu() choices_menu = raw_input(strings.choice_hint) try: choices_menu = int(choices_menu) if choices_menu == 1: gui.clean() producer.set_name(raw_input(strings.input_name)) gui.successful_message() continue elif choices_menu == 2: gui.clean() producer.set_age(raw_input(strings.input_age)) gui.successful_message() continue elif choices_menu == 3: gui.clean() producer.set_sex(raw_input(strings.input_sex)) gui.successful_message() continue elif choices_menu == 4: gui.clean() break else: print(strings.wrong_input) except ValueError: print(strings.wrong_input)
def __menu(): gui.print_menu() while 1: choices = raw_input(strings.choice_hint) try: choices = int(choices) if choices == 1: gui.clean() __add_producer() gui.successful_message() __menu() break elif choices == 2: gui.clean() if __producers_lab.size() > 0: __add_film() gui.successful_message() else: gui.error_message(strings.error_add_new_film) __menu() break elif choices == 3: gui.clean() if __producers_lab.size() > 0: __show_producers() gui.successful_message() else: gui.error_message(strings.not_found_data) __menu() break elif choices == 4: gui.clean() if __films_lab.size() > 0: __show_films() gui.successful_message() else: gui.error_message(strings.not_found_data) __menu() break elif choices == 5: gui.clean() __search() gui.successful_message() __menu() break elif choices == 6: gui.clean() if __producers_lab.size() > 0: __change_producer() else: gui.error_message(strings.not_found_data) __menu() break elif choices == 7: gui.clean() if __films_lab.size() > 0: __change_film() gui.successful_message() else: gui.error_message(strings.not_found_data) __menu() break elif choices == 8: gui.clean() if __producers_lab.size() > 0: __show_producers() if __del_producer(): gui.clean() __show_producers() print strings.producer_film_del_message gui.successful_message() else: gui.error_message(strings.error_user_not_found) else: gui.error_message(strings.not_found_data) __menu() break elif choices == 9: gui.clean() if __films_lab.size() > 0: __show_films() if __del_film(): gui.clean() __show_films() gui.successful_message() else: gui.error_message(strings.error_film_not_found) else: gui.error_message(strings.not_found_data) __menu() break elif choices == 0: file.save_producers(__producers_lab.get_producers()) file.save_films(__films_lab.get_films()) break else: print(strings.wrong_input) except ValueError: print(strings.wrong_input)
def __menu(): gui.print_menu() while 1: choices = raw_input(strings.choice_hint) try: choices = int(choices) if choices == 1: gui.clean() __add_producer() gui.successful_message() __menu() break elif choices == 2: gui.clean() if __groups_lab.size() > 0: __add_student() gui.successful_message() else: gui.error_message(strings.error_add_new_student) __menu() break elif choices == 3: gui.clean() if __groups_lab.size() > 0: __show_groups() gui.successful_message() else: gui.error_message(strings.not_found_data) __menu() break elif choices == 4: gui.clean() if __students_lab.size() > 0: __show_students() gui.successful_message() else: gui.error_message(strings.not_found_data) __menu() break elif choices == 5: gui.clean() __search() gui.successful_message() __menu() break elif choices == 6: gui.clean() if __groups_lab.size() > 0: __change_group() else: gui.error_message(strings.not_found_data) __menu() break elif choices == 7: gui.clean() if __students_lab.size() > 0: __change_student() gui.successful_message() else: gui.error_message(strings.not_found_data) __menu() break elif choices == 8: gui.clean() if __groups_lab.size() > 0: __show_groups() if __del_group(): gui.clean() __show_groups() print strings.group_student_del_message gui.successful_message() else: gui.error_message(strings.error_group_not_found) else: gui.error_message(strings.not_found_data) __menu() break elif choices == 9: gui.clean() if __students_lab.size() > 0: __show_students() if __del_student(): gui.clean() __show_students() gui.successful_message() else: gui.error_message(strings.error_student_not_found) else: gui.error_message(strings.not_found_data) __menu() break elif choices == 0: __groups_lab.save_groups() __students_lab.save_students() break else: print(strings.wrong_input) except ValueError: print(strings.wrong_input)