From 4905c349f6bbdca0f765a9894d28c55d838ed3c7 Mon Sep 17 00:00:00 2001 From: Philipp Schrader Date: Sun, 5 May 2013 12:02:02 -0700 Subject: [PATCH] Adding collate option to the generate_pdf.py script. --- generate_pdf.py | 7 ++++++- scantron.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/generate_pdf.py b/generate_pdf.py index 2edd3e2..cd4288f 100755 --- a/generate_pdf.py +++ b/generate_pdf.py @@ -23,6 +23,11 @@ help='File where the field data is stored. ' + 'This must be a python script with an array called "data" ' + 'of Field entries.') +parser.add_argument( + '--collate', + choices=['on', 'off'], + default='on', + help='Turns collatating on or off. Default is on.') args = parser.parse_args() @@ -44,5 +49,5 @@ # If everything went well, proceed to generate the PDF st = Scantron(args.output, spacing=0.3*inch) st.set_box_sizes(box_size=0.2*inch, box_spacing=0.3*inch) -st.populate(data, matches=args.num_matches) +st.populate(data, matches=args.num_matches, collate=args.collate) st.save() diff --git a/scantron.py b/scantron.py index ecbed28..6155875 100755 --- a/scantron.py +++ b/scantron.py @@ -140,7 +140,7 @@ def add_sheet(self, data, match=1, position=1): self.draw_boolean(field.label) - def populate(self, data, matches=1): + def populate(self, data, matches=1, collate='on'): for match in range(1, matches + 1): for position in range(1, 7): self.add_sheet(data, match, position)