示例#1
1
def chart_page(ctx, dots, color=(0,0,0,1)):
    fb = ReportlabFB(ctx, inch)
    fb.base_color = color

    x = inch * 0.75
    y = HEIGHT - (inch * (fb.u_height + 0.75))
    for i in range(len(dots)):
        fb.draw(x, y + (fb.v * i * (2 * inch)), dots[i])

    ctx.showPage()
示例#2
1
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle
from reportlab.lib.enums import TA_LEFT

from reportlab.pdfbase import pdfmetrics
from reportlab.pdfbase.ttfonts import TTFont

pdfmetrics.registerFont(TTFont("DejaVuSans", "/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf"))

styles = getSampleStyleSheet()
# print styles.list()
styleN = styles["Normal"]
styleI = ParagraphStyle(name="", parent=styles["Italic"], alignment=2)
styleT = ParagraphStyle(name="Title", parent=styles["Title"], fontName="DejaVuSans", alignment=TA_LEFT)


fb7 = ReportlabFB(None, inch)
fb7.u_height = 1.1
fb7.u_width = 5.75
fb7.num_frets = 20.0


# mode Patterns
from segovia_scales import scales

sharp = u"\u266F"
flat = u"\u266D"

doc = SimpleDocTemplate("segovia_scales.pdf", pagesize=letter, bottomMargin=0.25 * inch, topMargin=0.75 * inch)
story = []
count = 0
for title, patterns in scales:
示例#3
1
pdfmetrics.registerFont(TTFont('DejaVuSans', '/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf'))

styles = getSampleStyleSheet()
#print styles.list()
styleN = styles['Normal']
styleI = ParagraphStyle(name='',
    parent=styles['Italic'],
    alignment=2)
styleT = ParagraphStyle(name='Title',
    parent=styles['Title'], 
    fontName='DejaVuSans', alignment=TA_LEFT)
            


fb7 = ReportlabFB(None, inch)
fb7.u_height = 1.1
fb7.u_width = 5.75
fb7.num_frets = 14.0
fb7.numbered_frets = [3,5,7,9,12,]



import learn_notes as ln
days = zip(ln.strings + ln.strings, ln.notes, ln.frets + ln.frets)

doc = SimpleDocTemplate("12_days.pdf",  pagesize=letter, bottomMargin = 0.25*inch, topMargin = 0.75*inch)
story = []
count = 0
for i, day in enumerate(days):
    strings, notes, frets = day
示例#4
0
from reportlab.lib.styles import getSampleStyleSheet, ParagraphStyle

styles = getSampleStyleSheet()
#print styles.list()
styleN = styles['Normal']
styleI = ParagraphStyle(name='',
    parent=styles['Italic'],
    alignment=2)
styleT = ParagraphStyle(name='Title',
    parent=styles['Title'], 
    fontName='Helvetica')
            


fb5 = ReportlabFB(None, inch)
fb5.u_height = 1.25
fb5.u_width = 5.75

fb7 = ReportlabFB(None, inch)
fb7.u_height = 1.1
fb7.u_width = 5.75

#Arpeggio Patterns

doc = SimpleDocTemplate("arpeggios.pdf", bottomMargin = 0.25*inch)
story = []

story.append(Paragraph('Major Arpeggio Patterns',styleT))
md = enumerate(major_dots)
for t,d in md:
示例#5
0
        leftMargin,
        doc.bottomMargin,
        frameWidth,
        frameHeight,
        topPadding=0,
        bottomPadding=0,
        rightPadding=0,
        leftPadding=0,
    )
    frames.append(column)

template = PageTemplate(frames=frames)
doc.addPageTemplates(template)


fbfc = ReportlabFB(None, inch)
fbfc.u_height = 1
fbfc.u_width = (frameWidth / inch) * 0.98
fbfc.do_fret_markers = True
fbfc.numbered_frets = []
g = 0
fbfc.base_color = (g, g, g, 1)


def add_string(l, s):
    return [(x[0], s + " String", x[1], x[2]) for x in l]


sharp = u"\u266F"
flat = u"\u266D"
示例#6
0
#!/usr/bin/env python

from reportlab_fb import ReportlabFB

from reportlab.pdfgen import canvas
from reportlab.lib.pagesizes import letter
from reportlab.lib.units import inch
WIDTH, HEIGHT = letter

c = canvas.Canvas('example_0_reportlab.pdf',pagesize=letter)

fb = ReportlabFB(c, inch)

dots = [
    (1,3,'1',0),
    (2,3,'2',0),
    (3,3,'3',0),
    (4,3,'4',0),
    (5,7,'g',0),
    (4,4,'R',0),
    (5,3,'X',1)
    ]

x = inch * 0.75
y = HEIGHT - (inch * (fb.u_height + 0.75))
fb.draw(x, y, dots)

c.showPage()
c.save()