Skip to content

Commit

Permalink
Fixed import statements based on new structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
philsc committed May 19, 2013
1 parent 064b1b6 commit 5ca781c
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 31 deletions.
32 changes: 16 additions & 16 deletions data_2013.py
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
#!/usr/bin/env python2

from scantron import Field
from scantron import ScantronField

data = [
Field('auton_high', 'Auton High', int),
Field('auton_mid', 'Auton Mid', int),
Field('auton_low', 'Auton Low', int),
Field('high', 'High', int),
Field('mid', 'Mid', int),
Field('low', 'Low', int),
Field('pyramid', 'Pyramid', int),
Field('missed', 'Missed', int),
Field('fouls', 'Fouls', int),
Field('tech_fouls', 'Tech fouls', int),
Field('defense', 'Defense', bool),
Field('pickup', 'Pickup', bool),
Field('noshow', 'Noshow', bool),
Field('brokedown', 'Brokedown', bool),
Field('dq', 'DQ', bool),
ScantronField('auton_high', 'Auton High', int),
ScantronField('auton_mid', 'Auton Mid', int),
ScantronField('auton_low', 'Auton Low', int),
ScantronField('high', 'High', int),
ScantronField('mid', 'Mid', int),
ScantronField('low', 'Low', int),
ScantronField('pyramid', 'Pyramid', int),
ScantronField('missed', 'Missed', int),
ScantronField('fouls', 'Fouls', int),
ScantronField('tech_fouls', 'Tech fouls', int),
ScantronField('defense', 'Defense', bool),
ScantronField('pickup', 'Pickup', bool),
ScantronField('noshow', 'Noshow', bool),
ScantronField('brokedown', 'Brokedown', bool),
ScantronField('dq', 'DQ', bool),
]
4 changes: 2 additions & 2 deletions generate_pdf.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import os
import sys
from argparse import ArgumentParser
from scantron import *
from scantron import ScantronGenerator, inch

# Make this file easier to use by adding nice arguments
parser = ArgumentParser(description='Generate scantron PDFs.')
Expand Down Expand Up @@ -47,7 +47,7 @@
quit(1)

# If everything went well, proceed to generate the PDF
st = Scantron(args.output, spacing=0.3*inch)
st = ScantronGenerator(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, collate=args.collate)
st.save()
26 changes: 13 additions & 13 deletions testcase.py
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
#!/usr/bin/env python2

from scantron import *
from scantron import ScantronGenerator, ScantronField, inch
import PythonMagick
from pyPdf import PdfFileReader
from PIL import Image

data = [
Field('foo', 'Foo foo foo', int),
Field('bar', 'Bar bar bar', int),
Field('baz', 'Baz baz baz', int),
Field('laber', 'Laber laber', bool),
test_data = [
ScantronField('foo', 'Foo foo foo', int),
ScantronField('bar', 'Bar bar bar', int),
ScantronField('baz', 'Baz baz baz', int),
ScantronField('laber', 'Laber laber', bool),
]

# Generate PDF
st = Scantron('test.pdf')
st.set_box_sizes(box_size=0.2*inch, box_spacing=0.3*inch)
st.populate(data, matches=1, collate='no')
st.save()
# Generate scantron PDF
pdf = ScantronGenerator('test.pdf')
pdf.set_box_sizes(box_size=0.2*inch, box_spacing=0.3*inch)
pdf.populate(test_data, matches=1, collate='no')
pdf.save()

# Convert PDF to a series of pictures
pages = []

pdf = PdfFileReader(file('test.pdf', 'rb'))
num_pages = pdf.getNumPages()

for page in range(pdf.getNumPages()):
#page += 1
for page in range(num_pages):
name = 'test_image_%d.png' % page

im = PythonMagick.Image()
Expand Down

0 comments on commit 5ca781c

Please sign in to comment.