コード例 #1
0
ファイル: cardgen.py プロジェクト: Malikil/controlcard
 def controlPage(self) -> None:
     # ==================== Card Back ========================
     # Draw on the canvas
     f = Frame(INCH / 2, INCH / 2, self.width - INCH, self.height - INCH)
     tlist = f.split(self.controlTable, self.canvas)
     while len(tlist) > 0:
         f.addFromList(tlist, self.canvas)
         self.canvas.showPage()
         # Not exactly sure why a new fram is needed here ¯\_(ツ)_/¯
         f = Frame(INCH / 2, INCH / 2, self.width - INCH,
                   self.height - INCH)
コード例 #2
0
ファイル: report.py プロジェクト: peicheng/vosae-app
 def split(self, flowable, canv):
     splitted = Frame.split(self, flowable, canv)
     try:
         return [splitted[0]]
     except:
         return splitted
コード例 #3
0
def toc_page(c, saved_list):
    """ Creates table of contents page. 

    saved_list -- list of tuples (strings), (title, fig)
    c -- canvas
    """
    watermark(c)

    styles = getSampleStyleSheet()
    info = []
    # styles["ToC_info"] = ParagraphStyle("Normal",
    #     parent=styles["Normal"],
    #     fontSize=12,
    #     fontName="Times-Roman")

    INFO_TXT = "This report was generated by SATAlytics on {}. The software tool SATAlytics summarizes, analyzes and visualizes chemical analysis data.".format(
        time.strftime("%B %d, %Y"))

    # display title of page
    c.setFont("Helvetica-Bold", 20, leading=None)
    c.drawCentredString(325, 750, "Table of Contents")

    # display table of contents
    ## if using drawString():
    c.setFont("Helvetica-Oblique", 16, leading=None)
    # c.setLineWidth(1)
    # c.setDash(1, 2) #dots
    y = 700
    saved_text = []
    for i in range(len(saved_list)):
        # # if using paragraphs:
        saved_text.append(
            Paragraph("<i>" + saved_list[i][0] + "</i>", styles["Heading2"]))
        saved_text.append(
            Paragraph("<para align=\"RIGHT\">{}".format(i + 3),
                      styles["Heading2"]))

    fr = Frame(65,
               150,
               515,
               550,
               leftPadding=0,
               bottomPadding=0,
               rightPadding=0,
               topPadding=0,
               id=None,
               showBoundary=0)
    side_bar(c)
    footer(c)
    c.setFont("Helvetica-Bold", 20, leading=None)  # otherwise green printing
    for para in saved_text:
        while fr.add(para, c) == 0:
            fr.split(para, c)
            # new page
            c.showPage()
            watermark(c)

            # display title of page
            c.setFont("Helvetica-Bold", 20, leading=None)
            c.drawCentredString(325, 750, "Table of Contents")

            # display table of contents
            c.setFont("Helvetica-Oblique", 16, leading=None)

            fr = Frame(65,
                       150,
                       515,
                       550,
                       leftPadding=0,
                       bottomPadding=0,
                       rightPadding=0,
                       topPadding=0,
                       id=None,
                       showBoundary=0)

    # draw line
    c.setLineWidth(1)
    c.setStrokeColorRGB(0, 0, 0)
    c.line(65, 60, 565, 60)

    info.append(Paragraph(INFO_TXT, styles["Normal"]))
    f = Frame(65,
              50,
              515,
              50,
              leftPadding=0,
              bottomPadding=0,
              rightPadding=0,
              topPadding=0,
              id=None,
              showBoundary=0)
    f.addFromList(info, c)
    ## use text object for that

    side_bar(c)
    footer(c)
コード例 #4
0
ファイル: report.py プロジェクト: tcpr1/vosae-app
 def split(self, flowable, canv):
     splitted = Frame.split(self, flowable, canv)
     try:
         return [splitted[0]]
     except:
         return splitted