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


Python units.cm方法代码示例

本文整理汇总了Python中reportlab.lib.units.cm方法的典型用法代码示例。如果您正苦于以下问题:Python units.cm方法的具体用法?Python units.cm怎么用?Python units.cm使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reportlab.lib.units的用法示例。


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

示例1: __init__

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def __init__(self, cwd, output, version=''):
        self.cwd = cwd
        self.tag = os.path.basename(os.path.normpath(self.cwd))
        self.version = version
        self.story = []
        stylesheet = getSampleStyleSheet()
        self.title_style = stylesheet['Title']
        self.heading_style = stylesheet['Heading2']
        self.heading2_style = stylesheet['Heading3']
        self.normal_style = stylesheet['Normal']
        self.body_style = stylesheet['BodyText']
        self.current_section = 0
        self.doc = doc = SimpleDocTemplate(output,
            pagesize=A4,
            leftMargin=2.2*cm, rightMargin=2.2*cm,
            topMargin=1.5*cm,bottomMargin=2.5*cm)
        self.plot_width = self.doc.width * 0.85
        self.plot_scale = 0.4 
开发者ID:giesselmann,项目名称:nanopype,代码行数:20,代码来源:report.py

示例2: inserir_informacoes_endereco

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def inserir_informacoes_endereco(self):
        self.ender_info = True
        txt = ObjectValue(attribute_name='fornecedor.endereco_padrao.format_endereco',
                          display_format='Endereço: %s', top=1.1 * cm, left=0.3 * cm, width=19.4 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT, 'fontSize': 10, 'leading': 10}
        self.elements.append(txt)

        txt = ObjectValue(attribute_name='fornecedor.endereco_padrao.municipio',
                          display_format='Cidade: %s', top=1.6 * cm, left=0.3 * cm, width=8 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT, 'fontSize': 10, 'leading': 10}
        self.elements.append(txt)

        txt = ObjectValue(attribute_name='fornecedor.endereco_padrao.uf',
                          display_format='UF: %s', top=1.6 * cm, left=8.1 * cm, width=4 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT, 'fontSize': 10, 'leading': 10}
        self.elements.append(txt)

        txt = ObjectValue(attribute_name='fornecedor.endereco_padrao.cep', display_format='CEP: %s',
                          top=1.6 * cm, left=13 * cm, width=19.4 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT, 'fontSize': 10, 'leading': 10}
        self.elements.append(txt) 
开发者ID:thiagopena,项目名称:djangoSIGE,代码行数:23,代码来源:report_compras.py

示例3: __init__

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def __init__(self, *args, **kargs):
        super(VendaReport, self).__init__(*args, **kargs)
        self.title = 'Relatorio de venda'

        self.page_size = A4
        self.margin_left = 0.8 * cm
        self.margin_top = 0.8 * cm
        self.margin_right = 0.8 * cm
        self.margin_bottom = 0.8 * cm

        self.topo_pagina = TopoPagina()
        self.dados_cliente = DadosCliente()
        self.banda_produtos = BandaProdutos()
        self.dados_produtos = DadosProdutos()
        self.totais_venda = TotaisVenda()
        self.banda_pagamento = BandaPagamento()
        self.dados_pagamento = DadosPagamento()
        self.observacoes = Observacoes()
        self.banda_foot = BandaFoot() 
开发者ID:thiagopena,项目名称:djangoSIGE,代码行数:21,代码来源:report_vendas.py

示例4: inserir_informacoes_endereco

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def inserir_informacoes_endereco(self):
        self.ender_info = True
        txt = ObjectValue(attribute_name='cliente.endereco_padrao.format_endereco',
                          display_format='Endereço: %s', top=1.1 * cm, left=0.3 * cm, width=19.4 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT, 'fontSize': 10, 'leading': 10}
        self.elements.append(txt)

        txt = ObjectValue(attribute_name='cliente.endereco_padrao.municipio',
                          display_format='Cidade: %s', top=1.6 * cm, left=0.3 * cm, width=8 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT, 'fontSize': 10, 'leading': 10}
        self.elements.append(txt)

        txt = ObjectValue(attribute_name='cliente.endereco_padrao.uf', display_format='UF: %s',
                          top=1.6 * cm, left=8.1 * cm, width=4 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT, 'fontSize': 10, 'leading': 10}
        self.elements.append(txt)

        txt = ObjectValue(attribute_name='cliente.endereco_padrao.cep', display_format='CEP: %s',
                          top=1.6 * cm, left=13 * cm, width=19.4 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT, 'fontSize': 10, 'leading': 10}
        self.elements.append(txt) 
开发者ID:thiagopena,项目名称:djangoSIGE,代码行数:23,代码来源:report_vendas.py

示例5: generate_style

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def generate_style(self, font_name=None, font_size=None):
        super(MyPdfDocument, self).generate_style(font_name, font_size)

        _styles = getSampleStyleSheet()

        self.style.normal = copy.deepcopy(_styles['Normal'])
        self.style.normal.alignment = 4
        self.style.normal.fontName = '%s' % self.style.fontName
        self.style.normal.fontSize = self.style.fontSize
        self.style.normal.firstLineIndent = 0.4 * cm
        self.style.normal.spaceBefore = self.style.fontSize * 1.5
        # normal.textColor = '#0e2b58'

        self.style.end_connection = copy.deepcopy(_styles['Normal'])
        self.style.end_connection.alignment = 0
        self.style.end_connection.fontName = '%s-Bold' % self.style.fontName
        self.style.end_connection.fontSize = self.style.fontSize
        self.style.end_connection.spaceBefore = self.style.fontSize * 3

        self.style.table_header = copy.deepcopy(self.style.normal)
        self.style.table_header.alignment = TA_CENTER 
开发者ID:salan668,项目名称:FAE,代码行数:23,代码来源:MyPDFDocument.py

示例6: getDrawing02

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def getDrawing02():
    """Various Line shapes.

    The lines are blue and their strokeWidth is 5 mm.
    One line has a strokeDashArray set to [5, 10, 15].
    """

    D = Drawing(400, 200)
    D.add(Line(50,50, 300,100,
               strokeColor=colors.blue,
               strokeWidth=0.5*cm,
               ))
    D.add(Line(50,100, 300,50,
               strokeColor=colors.blue,
               strokeWidth=0.5*cm,
               strokeDashArray=[5, 10, 15],
               ))

    #x = 1/0 # Comment this to see the actual drawing!

    return D 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:23,代码来源:testshapes.py

示例7: _num

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def _num(s, unit=1, allowRelative=True):
    """Convert a string like '10cm' to an int or float (in points).
       The default unit is point, but optionally you can use other
       default units like mm.
    """
    if s.endswith('cm'):
        unit=cm
        s = s[:-2]
    if s.endswith('in'):
        unit=inch
        s = s[:-2]
    if s.endswith('pt'):
        unit=1
        s = s[:-2]
    if s.endswith('i'):
        unit=inch
        s = s[:-1]
    if s.endswith('mm'):
        unit=mm
        s = s[:-2]
    if s.endswith('pica'):
        unit=pica
        s = s[:-4]
    return _convnum(s,unit,allowRelative) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:26,代码来源:paraparser.py

示例8: __init__

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def __init__(self):
        super(CanhotoRetrato, self).__init__()
        self.elements = []
        lbl, txt = self.inclui_texto(nome='', titulo='', texto=u'', top=0*cm, left=0*cm, width=16*cm)
        fld = self.inclui_campo_sem_borda(nome='canhoto_recebemos', conteudo=u'NFe.canhoto_formatado', top=0*cm, left=0*cm, width=16*cm)
        fld.borders = {'top': 1.0, 'right': 1.0, 'bottom': 1.0, 'left':1.0 }#mudança de borda
        fld.padding_top = 0.08*cm
        fld.padding_left = 0.08*cm
        fld.padding_bottom = 0.08*cm
        fld.padding_right = 0.08*cm
        fld.style = DESCRITIVO_CAMPO
        fld.height = 0.70*cm

        self.inclui_texto(nome='canhoto_data', titulo=u'DATA DE RECEBIMENTO', texto='', top=0.7*cm, left=0*cm, width=2.7*cm)
        self.inclui_texto(nome='canhoto_assinatura', titulo=u'IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR', texto='', top=0.7*cm, left=2.7*cm, width=13.3*cm)

        lbl, txt = self.inclui_texto(nome='canhoto_nfe', titulo=u'NF-e', texto='', top=0*cm, left=16*cm, width=3.4*cm, height=1.4*cm, margem_direita=True)
        lbl.style = DESCRITIVO_NUMERO
        fld = self.inclui_campo_sem_borda(nome='canhoto_numero', conteudo=u'NFe.numero_formatado', top=0.35*cm, left=16*cm, width=3.4*cm, height=0.5*cm)
        fld.style = DESCRITIVO_NUMERO
        fld = self.inclui_campo_sem_borda(nome='canhoto_serie', conteudo=u'NFe.serie_formatada', top=0.8*cm, left=16*cm, width=3.4*cm, height=0.5*cm)
        fld.style = DESCRITIVO_NUMERO

        self.elements.append(Line(top=1.65*cm, bottom=1.65*cm, left=0*cm, right=19.4*cm, stroke_width=0.1))
        self.height = 1.9*cm 
开发者ID:thiagopena,项目名称:PySIGNFe,代码行数:27,代码来源:danferetrato.py

示例9: __init__

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def __init__(self):
        super(CanhotoPaisagem, self).__init__()
        self.elements = []
        lbl, txt = self.inclui_texto(nome='', titulo='', texto=u'', top=4.2*cm, left=0.15*cm, width=0.9*cm, height=16.5*cm)
        fld = self.inclui_campo_sem_borda(nome='canhoto_recebemos_vertical', conteudo=u'NFe.canhoto_formatado', top=20.2*cm, left=0.15*cm, width=16.5*cm)
        fld.style = {'fontName': FONTE_NEGRITO, 'fontSize': FONTE_TAMANHO_6}
        
        self.inclui_texto(nome='', titulo=u'', texto='', top=15.7*cm, left=1.05*cm, height=5*cm, width=1*cm)
        fld = self.inclui_texto_sem_borda(nome='canhoto_data_vertical', texto=u'DATA DE RECEBIMENTO', top=20.2*cm, left=1.05*cm, height=1.02*cm, width=5*cm)
        fld.style = {'fontName': FONTE_NEGRITO, 'fontSize': FONTE_TAMANHO_6}
        self.inclui_texto(nome='', titulo=u'', texto='', top=4.2*cm, left=1.05*cm, height=11.5*cm, width=1*cm)
        fld = self.inclui_texto_sem_borda(nome='canhoto_assinatura_vertical', texto=u'IDENTIFICAÇÃO E ASSINATURA DO RECEBEDOR', top=15.2*cm, left=1.05*cm, height=1.02*cm, width=5*cm)
        fld.style = {'fontName': FONTE_NEGRITO, 'fontSize': FONTE_TAMANHO_6}
        
        self.inclui_texto(nome='', titulo=u'', texto='', top=0.3*cm, left=0.15*cm, height=3.9*cm, width=1.9*cm)
        fld = self.inclui_texto_sem_borda(nome='canhoto_nfe_vertical', texto=u'NF-e', top=2.4*cm, left=0.2*cm, height=3.4*cm, width=1.4*cm)
        fld.style = {'fontName': FONTE_NEGRITO, 'fontSize': FONTE_TAMANHO_11}
        fld = self.inclui_campo_sem_borda(nome='canhoto_numero_vertical', conteudo=u'NFe.numero_formatado', top=3.3*cm, left=0.7*cm, width=3.4*cm, height=0.5*cm)
        fld.style = {'fontName': FONTE_NEGRITO, 'fontSize': FONTE_TAMANHO_12}
        fld = self.inclui_campo_sem_borda(nome='canhoto_serie_vertical', conteudo=u'NFe.serie_formatada', top=3*cm, left=1.3*cm, width=3.4*cm, height=0.5*cm)
        fld.style = {'fontName': FONTE_NEGRITO, 'fontSize': FONTE_TAMANHO_12}
        
        self.elements.append(Line(top=0.3*cm, bottom=20.7*cm, left=2.3*cm, right=2.3*cm, stroke_width=0.1))
        self.height = 0*cm 
开发者ID:thiagopena,项目名称:PySIGNFe,代码行数:26,代码来源:danfepaisagem.py

示例10: on_later_pages

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def on_later_pages(self, canvas, doc):
        canvas.saveState()
        canvas.setFont('Helvetica', 10)
        canvas.setLineWidth(0.5)
        canvas.line(doc.leftMargin, 1.5*cm, A4[0]-doc.rightMargin, 1.5*cm)
        canvas.drawString(doc.leftMargin, 0.8*cm, "Nanopype report")
        canvas.drawCentredString(A4[0] // 2, 0.8 * cm, "{:d}".format(doc.page))
        canvas.drawRightString(A4[0] - doc.rightMargin, 0.8*cm, "{}".format(self.tag))
        canvas.restoreState() 
开发者ID:giesselmann,项目名称:nanopype,代码行数:11,代码来源:report.py

示例11: add_summary

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def add_summary(self, summary_table=[]):
        self.story.append(Spacer(1, 8*cm))
        self.story.append(Paragraph("Sequencing Report", self.title_style))
        style = self.normal_style
        style.alignment = TA_CENTER
        self.story.append(Paragraph("{}".format(self.tag), style))
        self.story.append(Spacer(1, 4*cm))
        summary_table_style = [('ALIGN',(0,0),(0,-1),'RIGHT'),
                               ('ALIGN',(1,0),(1,-1),'LEFT')]
        if len(summary_table):
            self.story.append(Table(summary_table, style=summary_table_style))
        self.story.append(Spacer(1, 1*cm))
        self.story.append(Paragraph("Nanopype {}".format(self.version), style))
        self.story.append(PageBreak()) 
开发者ID:giesselmann,项目名称:nanopype,代码行数:16,代码来源:report.py

示例12: add_section_flowcells

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def add_section_flowcells(self, runnames=[]):
        self.story.append(Paragraph("{:d} Flow cells".format(self.get_section_number()), self.heading_style))
        self.story.append(Spacer(1, 0))
        table_data = [('{:3d}: '.format(i), runname) for i, runname in enumerate(runnames)]
        table_style = [('FONTSIZE', (0,0), (-1, -1), 10),
                        ('BOTTOMPADDING', (0,0), (-1,-1), 1),
                        ('TOPPADDING', (0,0), (-1,-1), 1),
                        ('VALIGN', (0,0), (-1,-1), 'MIDDLE')]
        self.story.append(Table(table_data, style=table_style))
        self.story.append(Spacer(1, 0.5*cm)) 
开发者ID:giesselmann,项目名称:nanopype,代码行数:12,代码来源:report.py

示例13: add_section_sequences

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def add_section_sequences(self, plots=[], stats=None):
        section = self.get_section_number()
        subsection = itertools.count(1)
        if stats is not None:
            self.story.append(Paragraph("{:d} Basecalling".format(section), self.heading_style))
            self.story.append(Spacer(1, 0))
            self.story.append(Paragraph("{:d}.{:d} Summary".format(section, next(subsection)), self.heading2_style))
            #['Tag', 'Basecalling', 'Sum', 'Mean', 'Median', 'N50', 'Maximum']
            header = ['', ''] + list(stats.columns.values[2:])
            table_data = [header] + [[y if isinstance(y, str) else '{:.0f}'.format(y) for y in x] for x in stats.values]
            table_style = [ ('FONTSIZE', (0,0), (-1, -1), 10),
                            ('LINEABOVE', (0,1), (-1,1), 0.5, colors.black),
                            ('LINEBEFORE', (2,0), (2,-1), 0.5, colors.black),
                            ('ALIGN', (0,0), (1,-1), 'LEFT'),
                            ('ALIGN', (2,0), (-1,-1), 'RIGHT')]
            self.story.append(Table(table_data, style=table_style))
            self.story.append(Spacer(1, 0))
        for key, group in itertools.groupby(plots, lambda x : x[1].basecalling):
            self.story.append(Paragraph('{:d}.{:d} {}:'.format(section, next(subsection), key.capitalize()), self.heading2_style))
            for plot_file, plot_wildcards in sorted(list(group), key=lambda x : x[1].i):
                im = svg2rlg(plot_file)
                im = Image(im, width=im.width * self.plot_scale, height=im.height * self.plot_scale)
                im.hAlign = 'CENTER'
                self.story.append(im)
                self.story.append(Spacer(1, 0))
        self.story.append(Spacer(1, 0.5*cm)) 
开发者ID:giesselmann,项目名称:nanopype,代码行数:28,代码来源:report.py

示例14: __init__

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def __init__(self):
        super(DadosFornecedor, self).__init__()
        self.ender_info = False
        self.elements = []
        txt = ObjectValue(attribute_name='fornecedor.nome_razao_social',
                          top=0.3 * cm, left=0.3 * cm, width=8 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT_BOLD,
                     'fontSize': 12, 'leading': 12}
        self.elements.append(txt)

        self.height = 2.7 * cm 
开发者ID:thiagopena,项目名称:djangoSIGE,代码行数:13,代码来源:report_compras.py

示例15: inserir_informacoes_pj

# 需要导入模块: from reportlab.lib import units [as 别名]
# 或者: from reportlab.lib.units import cm [as 别名]
def inserir_informacoes_pj(self):
        txt = ObjectValue(attribute_name='fornecedor.pessoa_jur_info.format_cnpj',
                          top=0.3 * cm, left=8.1 * cm, width=4 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT_BOLD,
                     'fontSize': 10, 'leading': 10}
        self.elements.append(txt)

        txt = ObjectValue(attribute_name='fornecedor.pessoa_jur_info.format_ie',
                          top=0.3 * cm, left=13 * cm, width=6.4 * cm, height=0.5 * cm)
        txt.style = {'fontName': REPORT_FONT_BOLD,
                     'fontSize': 10, 'leading': 10}
        self.elements.append(txt) 
开发者ID:thiagopena,项目名称:djangoSIGE,代码行数:14,代码来源:report_compras.py


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