def create_announcement_label(announcement): label = Label() org_start, org_end = label.add_text("#000000", (0,0), "Roboto-Thin.ttf", 200, "Carnegie Mellon Robotics Club") rect_start, rect_end = label.add_rectangle("#aaaaaa", (org_end[0] + 20, 0), (20, org_end[1])) type_start, type_end = label.add_text("#000000", (rect_end[0] + 20, 0), "Roboto-Regular.ttf", 200, "Official Club Announcement") header_start, header_end = label.add_text_split("#0000AA", (int(type_end[0]/2), rect_end[1] + 80), "Roboto-Regular.ttf", 400, announcement.header, center_x=True, words_per_line=3) body_start, body_end = label.add_text_split("#000000", (int(type_end[0]/2), header_end[1] + 80), "Roboto-Thin.ttf", 200, announcement.body, center_x=True, words_per_line=5) return label.create()
def create_project_label(project): label = Label() org_start, org_end = label.add_text("#000000", (0,0), "Roboto-Thin.ttf", 200, "Carnegie Mellon Robotics Club") rect_start, rect_end = label.add_rectangle("#aaaaaa", (org_end[0] + 20, 0), (20, org_end[1])) type_start, type_end = label.add_text("#000000", (rect_end[0] + 20, 0), "Roboto-Regular.ttf", 200, "Official Club Project") name_start, name_end = label.add_text("#0000AA", (type_end[0]/2, rect_end[1] + 80), "Roboto-Regular.ttf", 400, project.name, True) project_url = "{}{}".format(str(Site.objects.get_current()), reverse('projects:detail-name', args=(slugify(project.name),))) url_start, url_end = label.add_text("#000000", (type_end[0]/2, name_end[1] + 80), "Roboto-Thin.ttf", 200, project_url, True) return label.create()
def create_robouser_label(user): label = Label() org_start, org_end = label.add_text("#000000", (0,0), "Roboto-Thin.ttf", 200, "Carnegie Mellon Robotics Club") rect_start, rect_end = label.add_rectangle("#aaaaaa", (org_end[0] + 20, 0), (20, org_end[1])) type_start, type_end = label.add_text("#000000", (rect_end[0] + 20, 0), "Roboto-Regular.ttf", 200, "Personal Project") name_start, name_end = label.add_text("#0000AA", (type_end[0]/2, rect_end[1] + 80), "Roboto-Regular.ttf", 400, user.get_full_name(), True) email_start, email_end = label.add_text("#000000", (type_end[0]/2, name_end[1] + 80), "Roboto-Thin.ttf", 200, user.email, True) date_now = datetime.now() formatted_now = formats.date_format(date_now, "DATE_FORMAT") date_start, date_end = label.add_text("#000000", (type_end[0]/2, email_end[1] + 80), "Roboto-Thin.ttf", 200, formatted_now, True) return label.create()