def delete(self): print(Style.create_title('Delete %s' % self.table_name)) item = self.make_paginated_menu() if item: user_action = False while not user_action == 'delete': user_action = input( 'Type \'%s\' to remove this item or %s to cancel: ' % (Colour.red('delete'), Colour.green('c'))) if user_action == 'c': return self.save_remove(item) Menu.wait_for_input()
def pagination(self): result = False while not result: self.display_pagination() user_input = Input.get(self.display_pagination_instructions()) if user_input == 'b': break if self.should_change_page(user_input): self.change_page(user_input) print('\n') continue if user_input not in [str(x) for x in range(1, len(self.arr) + 1)]: Input.get("\n%s\nPress any key to continue.\n" % Colour.red("The row number entered was not found.")) continue result = self.arr[int(user_input) - 1] return result
def red_card(self): if UNICODE_SUPPORT: return str(self.value) + Colour.red(self.suit) else: return str(self.value) + self.suit
def display_errors(self, message): print(Style.create_title(message)) for (key, value) in self.model.get_errors().items(): print("%s: %s" % (key.capitalize(), Colour.red(value)))