def readFile(self): #Read delegates. if "custom_file" in cb.delegates_file: delegates = utils.csv_reader(cb.delegates_file[0], cb.delegates_file[1]) if "eventbright_file" in cb.delegates_file: delegates = utils.evb_reader(cb.delegates_file[0], cb.delegates_file[2], cb.delegates_file[1]) if "internet_file" in cb.delegates_file: ##TODO: implement reading directly from eventbright delegates = None assert isgenerator(delegates) #our data acquaition logic failed if this isn't the case config.update({'delegates': delegates}) #units if cb.units == "inches": config.update({'units': inch}) else: config.update({'units': mm}) #badge media specs tmp = {} tmp.update({'label_width' : cb.label_width}) tmp.update({'label_height' : cb.label_height}) tmp.update({'label_horiz_margin' : cb.hm}) tmp.update({'label_vert_margin' : cb.vm}) tmp.update({'page_horiz_margin' : cb.LM}) tmp.update({'page_horiz_gap' : cb.XM}) tmp.update({'page_vert_margin' : cb.TM}) tmp.update({'page_vert_gap' : cb.YM}) tmp.update({'page_height' : cb.page_height}) tmp.update({'page_width' : cb.page_width}) config.update({"media_specs":tmp}) #locations within the badge for image placement config.update({"location": dict(cb.location)}) #image files config.update({'image': dict(cb.image)}) #fonts config.update({'font': dict(cb.font)}) #paragraph styles and fonts config.update({'paragraph_style': dict(cb.paragraph_style)}) #text field formats config.update({'text_field': dict(cb.text_field)}) #comman images (that is, common to all badges) config.update({"common_images": dict(cb.common_images)}) #basic badge layouts (note: this a list, not a dict) config.update({"badge_layout": cb.badge_layout}) #tweaks for individual special ticket types config.update({"special_ticket": dict(cb.special_ticket)}) #labels preprinted config.update({"preprinted": cb.labels_preprintd}) config.update({"common_images": cb.common_images}) config.update({"double_badges": cb.double_badges}) return config
self.email = email self.twitter = twitter self.type = typ ##TODO: make a rule about collissions e.g., when adding different logos for multiple tutorial sessions ##TODO: for testing, print example of each badge type specified w/ fake information # # Build a list of tickets held by each email address # tickets = defaultdict(lambda : []) fields = (3, 2, 4, 19, 6) #delegates = evb_reader("Attendees-3952423806.csv", fields, "utf-8") #delegates = evb_reader("Attendees-20130225.0247.csv", fields, "utf-8") #delegates = blanks(6) delegates = csv_reader("test_attendees.1730.csv", "utf-8") for line in delegates: ticket = Ticket(*line) tickets[ticket.email].append(ticket) ##TODO: move to a config file ##TODO: specify fonts in config file; and/or include sensible defaluts in package '''Note: There's apparently a bug in PDFDocument::pdfdoc. If we specify the same font more than once, we get a "ValueError: redefining named object" when performing the build operation on our document. This behavior is reproducable by specifying ttFile1, ttFile2, and ttFile3 to be the same, and repaired when specifying them separately. Fix: gather all specified fonts and register them as a separate operation, after first de-duplicating them.