Пример #1
0
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()
Пример #2
0
def create_officer_label(officer):
  label = Label()
  name_start, name_end = label.add_text('#000000', (0,0), "Roboto-Thin.ttf", 200, officer.user.user.get_full_name())
  position_start, position_end = label.add_text('#000000', (int(name_end[0]/2), name_end[1]), "Roboto-Thin.ttf", 100, officer.position, center_x=True)
  image_start, image_end = label.add_image((int(name_end[0]/2) - 500, position_end[1] + 50), (1000, 1000), officer.image.path)

  memo_start, memo_end = label.add_text_split('#000000', (int(name_end[0]/2), image_end[1] + 50), "Roboto-Thin.ttf", 50, officer.memo, center_x=True, words_per_line=5)

  studies = "{} {}".format(officer.user.major, officer.user.grad_year)
  studies_start, studies_end = label.add_text('#000000', (name_end[0]/2, memo_end[1] + 50), "Roboto-Thin.ttf", 80, studies, center_x=True)

  return label.create()
Пример #3
0
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()
Пример #4
0
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()