# generates the teacher's badges from badgeGen3 import badgeGen inputCSV = "Teachers.csv" print "Starting..." badges = badgeGen("badgesTeachers.pdf", "TE") badges.setIndivLoc("badgesTeachers") badges.fromCSV(inputCSV,[2,3],[4],6,"Team ", [0]) badges.save() print "Done."
# Special script for PiE 2012 Registration Forms Spreadsheet from PIRNCode import gen4 from badgeGen3 import badgeGen import os, csv csvFile = "PiE 2012 Registration Forms Spreadsheet - Student Info.csv" outDir = "badgesStudentsTest" assignedCodes = "_assignedCodes.csv" badges = badgeGen(csvFile[:-4]+".pdf","ST") csvDat = csv.reader(open(csvFile,"rb")) newCodes = csv.writer(open(assignedCodes, "wb")) no = ["n","N","no","No","NO"] yes = ["y","Y","yes","Yes","YES"] for row in csvDat: try: if len(row) > 8 and row[8].strip() in no and not row[0] == "School": badges.setIndivLoc(os.path.join(outDir,row[0])) code = row[6] if not row[6].strip(): code = "ST12" + row[1] + "%02d" % int(row[2]) + gen4() newCodes.writerow([row[3],row[4],code]) badges.addBadge(" ".join(row[3:5]),"Team " + row[2], code) except: print "Error: " print row badges.save() del newCodes
# generates the staff's badges from badgeGen3 import badgeGen inputCSV = "Staff.csv" print "Starting..." badges = badgeGen("badgesStaff.pdf","PI") badges.setIndivLoc("badgesStaff") badges.fromCSV(inputCSV,[0,1],[2],6) badges.save() print "Done."
# Generates the mentor's badges from badgeGen3 import badgeGen inputCSV = "Mentors.csv" print "Starting..." badges = badgeGen("badgesMentors.pdf","MT") badges.setIndivLoc("badgesMentors") badges.fromCSV(inputCSV,[0,1],None,3) badges.save() print "Done."
# Generate a new sheet of barcodes for all schools. from PIRNCode import gen4 from badgeGen3 import badgeGen import os, csv csvFile = "Teachers.csv" fileOutName = "_Extras.pdf" binderName = "ExtraStudentBadges.pdf" print "Starting..." schools = csv.reader(open(csvFile,"rb")) binder = badgeGen(binderName, "ST") for row in schools: if not row[0].strip() or not row[6][:2] == "TE": continue school = row[0] abbrev = row[1] teamNum = row[4] fileOut = badgeGen(os.path.join("badgesStudents",school,fileOutName), "ST") for i in range(6): code = "ST12" + abbrev + "%02d" % int(teamNum) + gen4() fileOut.addBadge(None, "Team " + teamNum, code) binder.addBadge(None, "Team " + teamNum, code) fileOut.save() binder.save() del csvFile print "Done."
# Generates the student's badges from badgeGen3 import badgeGen inputCSV = "Students.csv" print "Starting..." badges = badgeGen("badgesStudents.pdf","ST") badges.setIndivLoc("badgesStudents") badges.fromCSV(inputCSV, [2,3], [4], 6, "Team ", [0]) badges.save() print "Done."