def schedule(lab_label="Testing", section_data=list(), outfile=sys.stdout, bounding_box=Rectangle(Point(0,0), Point(inches(8.5), inches(4)))): # schedules are on half-sheets s = Scene(bounding_box) # draw the scheduling grid s = schedule_grid(lab_label, s, bounding_box) # add sections to schedule s = add_sections(section_data, s, bounding_box) # render the result s.render(outfile)
def summary(lab_data, bounding_box=Rectangle(Point(0,0), Point(inches(8.5), inches(11)))): bounding_box = bounding_box.translate((8, -36)) s = Scene(bounding_box) # draw reduced-size schedules (2.5 x 2.5) placements = list() gap = inches(0.25) w = inches(2.5) x_off = gap + w y_off = x_off for j in range(3): for i in range(3): p1 = Point(bounding_box.min_x + i * x_off, bounding_box.max_y - (j+1) * y_off) p2 = Point(bounding_box.min_x + (i+1) * x_off, bounding_box.max_y - j * y_off) placements.append(Rectangle(p1, p2)) # place each available course into its own mini layout for (course_key, bb) in zip(lab_data, placements): course_num, room_num = course_key section_data = lab_data[course_key] s = schedule_grid("Physics %d | %d" % (course_num, room_num), s, bb, 8) s = add_sections(section_data, s, bb, 8) # label the summary t = time.localtime(time.time()) mon = t.tm_mon yr = t.tm_year if mon in [12, 1, 2, 3, 4]: session = "Spring" elif mon in [8, 9, 10, 11]: session = "Fall" else: session = "Summer" label = "%s %d" % (session, yr) s.add(Text(Point(inches(8.5)/2.0, inches(11) - inches(0.50)), label, True, "Helvetica", 36)) with open("summary.ps", "w") as outfile: s.render(outfile)