当前位置: 首页>>代码示例>>Python>>正文


Python sequencer.getSequencer函数代码示例

本文整理汇总了Python中reportlab.lib.sequencer.getSequencer函数的典型用法代码示例。如果您正苦于以下问题:Python getSequencer函数的具体用法?Python getSequencer怎么用?Python getSequencer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getSequencer函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_rl_config_reset

 def test_rl_config_reset(self):
     from reportlab import rl_config
     from reportlab.pdfbase import pdfmetrics, _fontdata
     tfd = pdfmetrics._typefaces
     fbn = _fontdata.fontsByName
     tfd[' a ']=1
     fbn[' b ']=1
     ntfd = len(tfd)
     nfbn = len(fbn)
     from reportlab.lib import sequencer
     seq = sequencer.getSequencer()
     seq._dingo = 1
     rl_config._reset()
     assert not hasattr(seq,'_dingo')
     assert ' a ' not in tfd and len(tfd)<ntfd
     assert ' a ' not in fbn and len(fbn)<nfbn
开发者ID:ingob,项目名称:mwlib.ext,代码行数:16,代码来源:test_hello.py

示例2: _textual

 def _textual(self, node, x=0, y=0):
     text = node.text and node.text.encode('utf-8') or ''
     rc = utils._process_text(self, text)
     for n in node:
         if n.tag == 'seq':
             from reportlab.lib.sequencer import getSequencer
             seq = getSequencer()
             rc += str(seq.next(n.get('id')))
         if n.tag == 'pageCount':
             if x or y:
                 self.canvas.translate(x,y)
             self.canvas.doForm('pageCount%s' % (self.canvas._storyCount,))
             if x or y:
                 self.canvas.translate(-x,-y)
         if n.tag == 'pageNumber':
             rc += str(self.canvas.getPageNumber())
         rc += utils._process_text(self, n.tail)
     return rc.replace('\n','')
开发者ID:LiberTang0,项目名称:prooaddons,代码行数:18,代码来源:trml2pdf.py

示例3: _textual

    def _textual(self, node, x=0, y=0):
        text = node.text and node.text.encode("utf-8") or ""
        rc = utils._process_text(self, text)
        for n in node:
            if n.tag == "seq":
                from reportlab.lib.sequencer import getSequencer

                seq = getSequencer()
                rc += str(seq.next(n.get("id")))
            if n.tag == "pageCount":
                if x or y:
                    self.canvas.translate(x, y)
                self.canvas.doForm("pageCount%s" % (self.canvas._storyCount,))
                if x or y:
                    self.canvas.translate(-x, -y)
            if n.tag == "pageNumber":
                rc += str(self.canvas.getPageNumber())
            rc += utils._process_text(self, n.tail)
        return rc.replace("\n", "")
开发者ID:guzzi235,项目名称:saas3,代码行数:19,代码来源:trml2pdf.py

示例4: restartList

def restartList():
    getSequencer().reset('list1')
开发者ID:sengupta,项目名称:scilab_cloud,代码行数:2,代码来源:rl_doc_utils.py

示例5: quickfix

#print quickfix("$testing$ testing $one$ ^two^ $three(^four^)$")



H1 = styleSheet['Heading1']
H2 = styleSheet['Heading2']
H3 = styleSheet['Heading3']
H4 = styleSheet['Heading4']
B = styleSheet['BodyText']
BU = styleSheet['Bullet']
Comment = styleSheet['Comment']
Centred = styleSheet['Centred']
Caption = styleSheet['Caption']

#set up numbering
seq = getSequencer()
seq.setFormat('Chapter','1')
seq.setFormat('Section','1')
seq.setFormat('Appendix','A')
seq.setFormat('Figure', '1')
seq.chain('Chapter','Section')
seq.chain('Chapter','Figure')

lessonnamestyle = H2
discussiontextstyle = B
exampletextstyle = styleSheet['Code']
# size for every example
examplefunctionxinches = 5.5
examplefunctionyinches = 3
examplefunctiondisplaysizes = (examplefunctionxinches*inch, examplefunctionyinches*inch)
开发者ID:sengupta,项目名称:scilab_cloud,代码行数:30,代码来源:rl_doc_utils.py

示例6: picklist_to_pdf

def picklist_to_pdf(invoice, outf):
    normal_style = ParagraphStyle("normal", fontName="Helvetica")
    piece_condition_style = ParagraphStyle("piececondition", normal_style, fontSize=normal_style.fontSize - 2,
                                           leading=normal_style.leading - 2)
    piece_details_style = ParagraphStyle("pieceseller", piece_condition_style)

    def invoice_header(canvas, doc):
        draw_invoice_header(canvas, doc, invoice, "Pick-List for:")

    doc = SimpleDocTemplate(outf, pagesize=LETTER,
                            leftMargin=0.75 * inch, rightMargin=0.75 * inch,
                            topMargin=1.75 * inch, bottomMargin=0.75 * inch,
                            onFirstPage=invoice_header, onLaterPages=invoice_header)

    story = []

    body_data = [
        ["Loc.", "Code", u"\u2714", "Description", "Amount", u"\u2714"],
        [Paragraph('<para align="right">Confirm Bidder ID on each sheet</para>', normal_style), "", "", "", "", u"[ ]"],
    ]

    num_items = 0
    for item in invoice.invoiceitem_set.order_by("piece__location", "piece__artist__artistid", "piece__pieceid"):
        num_items += 1
        piece = item.piece
        paragraphs = [
            Paragraph("<i>" + escape(piece.name) + u"</i> \u2014 by " + escape(piece.artistname()), normal_style)]
        details_body_parts = [escape(piece.media)]
        if piece.condition:
            details_body_parts.append(escape(piece.condition))
        if piece.other_artist:
            details_body_parts.append(escape("sold by " + piece.artist.artistname()))
        paragraphs.append(Paragraph(u" \u2014 ".join(details_body_parts), piece_details_style))
        body_data.append([piece.location, piece.code, u"[ ]", paragraphs,
                          Paragraph("<para align=\"right\"><b>" + escape(str(item.price)) + "</b></para>",
                                    normal_style),
                          u"[ ]"])

    body_data.append([Paragraph('<para align="right">Confirm <b>%s</b> items, <b>%s</b> '
                                'bid-sheets, then initial</para>' % (num_items, num_items),
                                normal_style), "", "", "", "", "__"])

    body_table_style = [
        ("FONTSIZE", (0, 0), (-1, 0), normal_style.fontSize - 4),
        ("FONT", (0, 0), (-1, 0), "Helvetica-Bold"),
        ("LEADING", (0, 0), (-1, 0), normal_style.leading - 4),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
        ("ALIGN", (4, 0), (4, -1), "RIGHT"),
        ("SPAN", (0, 1), (4, 1)),
        ("SPAN", (0, num_items + 2), (4, num_items + 2)),
        ("LINEBELOW", (0, 0), (-1, -1), 0.1, colors.black),
        #("GRID", (0,0), (-1,-1), 0.1, colors.black),
    ]

    body_table = Table(body_data, colWidths=[0.5 * inch, 0.75 * inch, 0.25 * inch, 4.25 * inch, 1 * inch, 0.25 * inch],
                       style=body_table_style,
                       repeatRows=1)
    story.append(body_table)
    story.append(Spacer(0.25 * inch, 0.25 * inch))

    signature_block = KeepTogether([
        Paragraph(escape("I, %s, or a duly authorized agent, acknowledge receiving the above "
                         "%d items." % (invoice.payer.name(), num_items)), normal_style),
        Spacer(0.25 * inch, 0.25 * inch),
        Paragraph("Signature _______________________________________________", normal_style),
        Spacer(0.25 * inch, 0.25 * inch),
        Paragraph("Agent Name _______________________________________________", normal_style),
    ])
    story.append(signature_block)


    # TODO - Figure out a better way of handling this horrible hack.
    # "Paragraph" does not use the sequencer inside the Document, but instead the global sequencer :(
    getSequencer().reset("pageno", 0)

    doc.build(story, onFirstPage=invoice_header, onLaterPages=invoice_header)
开发者ID:chmarr,项目名称:artshow-jockey,代码行数:76,代码来源:pdfreports.py

示例7: invoice_to_pdf

def invoice_to_pdf(invoice, outf):
    normal_style = ParagraphStyle("normal", fontName="Helvetica")
    piece_condition_style = ParagraphStyle("piececondition", normal_style, fontSize=normal_style.fontSize - 2,
                                           leading=normal_style.leading - 2)
    piece_details_style = ParagraphStyle("pieceseller", piece_condition_style)

    def invoice_header(canvas, doc):
        draw_invoice_header(canvas, doc, invoice, "Invoice for:")

    doc = SimpleDocTemplate(outf, pagesize=LETTER,
                            leftMargin=0.75 * inch, rightMargin=0.75 * inch,
                            topMargin=1.75 * inch, bottomMargin=0.75 * inch,
                            onFirstPage=invoice_header, onLaterPages=invoice_header)

    story = []

    body_data = [["Code", "Description", "Amount (" + settings.ARTSHOW_MONEY_CURRENCY + ")"]]

    num_items = 0
    for item in invoice.invoiceitem_set.order_by("piece__artist__artistid", "piece__pieceid"):
        num_items += 1
        piece = item.piece
        paragraphs = [
            Paragraph("<i>" + escape(piece.name) + u"</i> \u2014 by " + escape(piece.artistname()), normal_style)]
        details_body_parts = [escape(piece.media)]
        if piece.condition:
            details_body_parts.append(escape(piece.condition))
        if piece.other_artist:
            details_body_parts.append(escape("sold by " + piece.artist.artistname()))
        paragraphs.append(Paragraph(u" \u2014 ".join(details_body_parts), piece_details_style))
        body_data.append([item.piece.code, paragraphs, format_money(item.price)])

    if invoice.tax_paid:
        subtotal_row = len(body_data)
        body_data.append(["", "Subtotal", format_money(invoice.item_total())])
        body_data.append(["", settings.ARTSHOW_TAX_DESCRIPTION, format_money(invoice.tax_paid)])
    else:
        subtotal_row = None

    total_row = len(body_data)
    body_data.append(["", str(num_items) + u" items \u2014 Total Due", format_money(invoice.item_and_tax_total())])

    body_data.append(["", "", ""])

    for payment in invoice.invoicepayment_set.all():
        body_data.append(["", payment.get_payment_method_display(), format_money(payment.amount)])

    body_data.append(["", "Total Paid", unicode(invoice.total_paid())])

    body_table_style = [
        ("FONTSIZE", (0, 0), (-1, 0), normal_style.fontSize - 4),
        ("FONT", (0, 0), (-1, 0), "Helvetica-Bold"),
        ("LEADING", (0, 0), (-1, 0), normal_style.leading - 4),
        ("VALIGN", (0, 0), (-1, -1), "TOP"),
        ("ALIGN", (2, 0), (2, -1), "RIGHT"),
        ("ALIGN", (1, total_row), (1, -1), "RIGHT"),
        ("FONT", (2, total_row), (2, total_row), "Helvetica-Bold"),
        ("FONT", (2, -1), (2, -1), "Helvetica-Bold"),
        ("LINEBELOW", (0, 0), (-1, -1), 0.1, colors.black),
        ("LINEABOVE", (0, total_row), (-1, total_row), 0.75, colors.black),
        ("LINEABOVE", (0, -1), (-1, -1), 0.75, colors.black),
    ]

    if subtotal_row is not None:
        body_table_style.append(("ALIGN", (1, subtotal_row), (1, subtotal_row + 1), "RIGHT"))
        body_table_style.append(("LINEABOVE", (0, subtotal_row), (-1, subtotal_row), 0.75, colors.black))

    body_table = Table(body_data, colWidths=[0.75 * inch, 5.0 * inch, 1.25 * inch], style=body_table_style,
                       repeatRows=1)
    story.append(body_table)

    # TODO - Figure out a better way of handling this horrible hack.
    # "Paragraph" does not use the sequencer inside the Document, but instead the global sequencer :(
    getSequencer().reset("pageno", 0)

    doc.build(story, onFirstPage=invoice_header, onLaterPages=invoice_header)
开发者ID:chmarr,项目名称:artshow-jockey,代码行数:76,代码来源:pdfreports.py


注:本文中的reportlab.lib.sequencer.getSequencer函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。