def print_mail_verbosely(mail): SCREEN_WIDTH = 82 headers = ['From', 'To', 'Date'] headers = ['{:<24}'.format(header) for header in headers] sender_full_name = mail.sender.name + ' ' + mail.sender.surname receiver_full_name = mail.receiver.name + ' ' + mail.receiver.surname table = [] table.append([sender_full_name, receiver_full_name, str(mail.date)]) ui.print_table(table, headers) message = [] lines_number = ceil(len(mail.message) / SCREEN_WIDTH) for i in range(lines_number): line_begin = i * SCREEN_WIDTH line_end = (i + 1) * SCREEN_WIDTH line = mail.message[line_begin:line_end] message.append([line]) headers = ['Title: ' + mail.topic] table = [] table.append(message) ui.print_table(message, headers)
def print_students_list(codecool): title_list = ['id', 'Name', 'Surname'] table = [] for student in codecool.students_list: table.append([student.id_, student.name, student.surname]) ui.print_table(table, title_list)
def print_mentors_list(codecool): title_list = ['id', 'Name', 'Surname'] table = [] for mentor in codecool.mentors_list: table.append([mentor.id, mentor.name, mentor.surname]) ui.print_table(table, title_list)
def print_student_attendances(student): table = [] id_ = 0 for attendance in student.attendance_list: table.append([ str(id_), str(attendance.date.date()), str(attendance.attendance_state) ]) id_ += 1 headers = ['id', 'date', 'grade'] ui.print_table(table, headers)
def print_mail_list(mail_list): headers = ['id', 'From', 'To', 'Date', 'Title'] table = [] for i in range(len(mail_list)): mail = mail_list[i] sender_full_name = mail.sender.name + ' ' + mail.sender.surname receiver_full_name = mail.receiver.name + ' ' + mail.receiver.surname if mail.state == 'unread': state = '[new]' else: state = '' idx = str(i) + state table.append([ idx, sender_full_name, receiver_full_name, str(mail.date), str(mail.topic) ]) ui.print_table(table, headers)