def edit_item(self, movie_type, unique, name, genre, director, year, index): """Edits a selected item""" self.colorfalsecheck = True self.yearfalsecheck = True try: if test.check_valid_year(int(year)) == True: if movie_type == "DVD": self.lista_DVD[index] = DVD(unique, name, genre, director, year) if movie_type == "Blueray": self.lista_BR[index] = BR(unique, name, genre, director, year) if movie_type == "VHS": if test.check_color_yes_no(str(unique)) == True: self.lista_VHS[index] = VHS(unique, name, genre, director, year) else: self.colorfalsecheck = False else: self.yearfalsecheck = False except ValueError: self.yearfalsecheck = False
def create_item(self, movie_type, unique, name, genre, director, year): """Creates an item from the item.py and adds them to a list""" self.colorfalsecheck = True self.yearfalsecheck = True try: if test.check_valid_year(int(year)) == True: if movie_type == "DVD": self.dvd = DVD(unique, name, genre, director, year) self.lista_DVD.append(self.dvd) if movie_type == "Blueray": self.br = BR(unique, name, genre, director, year) self.lista_BR.append(self.br) if movie_type == "VHS": if test.check_color_yes_no(str(unique)) == True: self.vhs = VHS(unique, name, genre, director, year) self.lista_VHS.append(self.vhs) else: self.colorfalsecheck = False else: self.yearfalsecheck = False except ValueError: self.yearfalsecheck = False