當前位置: 首頁>>代碼示例>>Python>>正文


Python Image._setup_inner方法代碼示例

本文整理匯總了Python中reportlab.platypus.flowables.Image._setup_inner方法的典型用法代碼示例。如果您正苦於以下問題:Python Image._setup_inner方法的具體用法?Python Image._setup_inner怎麽用?Python Image._setup_inner使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在reportlab.platypus.flowables.Image的用法示例。


在下文中一共展示了Image._setup_inner方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from reportlab.platypus.flowables import Image [as 別名]
# 或者: from reportlab.platypus.flowables.Image import _setup_inner [as 別名]
    def __init__(self, title, enterprise, interval, logo):
        self.title = title
        self.enterprise = enterprise
        self.interval = interval
        self.logo = logo
        self.width, self.height = A4
        self.buf = StringIO()
        self.canvas = Canvas(self.buf, pagesize=A4)

        self.page_title = ''
        self.page_rows = []
        self.page_frags = 0
        self.page_num = 1

        # Build story.
        self.canvas.saveState()
        self.canvas.setStrokeColor(colors.RED)
        self.canvas.setLineWidth(2)
        self.canvas.roundRect(self.margin, self.edenwall_height + self.margin, self.width, self.height, 20, stroke=1, fill=0)

        self.canvas.setFillColor(colors.GREEN2)
        self.canvas.setStrokeColor(colors.GREEN1)
        self.canvas.roundRect(- self.margin, - self.margin, self.width - self.margin, self.edenwall_height + self.margin,
                              20, stroke=1, fill=1)
        # TODO do not hardcode this values.
        img = Image('/var/lib/ufwi_rpcd/edenwall.png', 1209 / (300/(self.edenwall_height-self.margin/2)), self.edenwall_height-self.margin/2)
        img.drawOn(self.canvas, self.margin, self.margin/4)

        self.canvas.restoreState()

        if self.logo:
            img = Image(StringIO(self.logo))
            img._setup_inner()
            img.drawOn(self.canvas, (self.width - self.margin)/2 - img.drawWidth/2, 2*self.height/3)

        offset = 40

        self.canvas.setFillColor(black)
        self.canvas.setFont("Helvetica-Bold", self.big_title_height)
        self.canvas.drawCentredString((self.width-self.margin)/2, self.height/3, title)
        self.canvas.setFont("Helvetica-Bold", self.frag_title_height)
        self.canvas.drawString(offset, self.height - offset, enterprise)
開發者ID:maximerobin,項目名稱:Ufwi,代碼行數:44,代碼來源:report.py


注:本文中的reportlab.platypus.flowables.Image._setup_inner方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。