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


Python colors.gray方法代碼示例

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


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

示例1: get_logs

# 需要導入模塊: from reportlab.lib import colors [as 別名]
# 或者: from reportlab.lib.colors import gray [as 別名]
def get_logs(self, source, depth, row_idx, lvl=logging.ERROR):
        """
        Get logs created by the `report.logger` object.
        Only select the logs with severity level equal to or higher than `lvl`.
        """
        font_size = const.FONT_SIZE_SMALL
        width = const.WRAP_LIMITS[font_size]
        logs = [log for log in source.logs if log["levelno"] >= lvl]

        return (
            RowData(
                start=row_idx,
                content=[
                    [wrap(log["message"], width=width), "", "", ""]
                    for log in logs
                ],
                style=RowStyle(
                    font=(const.FONT, font_size),
                    left_padding=const.INDENT * depth,
                    text_color=colors.gray,
                ),
            )
            if logs
            else None
        ) 
開發者ID:Morgan-Stanley,項目名稱:testplan,代碼行數:27,代碼來源:reports.py

示例2: sample1

# 需要導入模塊: from reportlab.lib import colors [as 別名]
# 或者: from reportlab.lib.colors import gray [as 別名]
def sample1():
    "Make up something from the individual Sectors"

    d = Drawing(400, 400)
    g = Group()

    s1 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=0, endangledegrees=120, radius1=100)
    s1.fillColor=colors.red
    s1.strokeColor=None
    d.add(s1)
    s2 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=120, endangledegrees=240, radius1=100)
    s2.fillColor=colors.green
    s2.strokeColor=None
    d.add(s2)
    s3 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=240, endangledegrees=260, radius1=100)
    s3.fillColor=colors.blue
    s3.strokeColor=None
    d.add(s3)
    s4 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=260, endangledegrees=360, radius1=100)
    s4.fillColor=colors.gray
    s4.strokeColor=None
    d.add(s4)

    return d 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:26,代碼來源:doughnut.py

示例3: getDrawing05

# 需要導入模塊: from reportlab.lib import colors [as 別名]
# 或者: from reportlab.lib.colors import gray [as 別名]
def getDrawing05():
    """Text strings with various anchors (alignments).

    Text alignment conforms to the anchors in the left column.
    """

    D = Drawing(400, 200)

    lineX = 250
    D.add(Line(lineX,10, lineX,190, strokeColor=colors.gray))

    y = 130
    for anchor in ('start', 'middle', 'end'):
        D.add(String(lineX, y, 'Hello World', textAnchor=anchor))
        D.add(String(50, y, anchor + ':'))
        y = y - 30

    return D 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:20,代碼來源:testshapes.py

示例4: draw_grid

# 需要導入模塊: from reportlab.lib import colors [as 別名]
# 或者: from reportlab.lib.colors import gray [as 別名]
def draw_grid(self, canvas):
        canvas.setLineWidth(0.2)
        canvas.setStrokeColor(colors.gray)
        canvas.line(
            self.shipping_labels_margin[0],
            self.page_height / 2,
            self.shipping_labels_width + self.shipping_labels_margin[0],
            self.page_height / 2,
        )
        canvas.line(
            self.page_width / 2,
            self.shipping_labels_margin[1],
            self.page_width / 2,
            self.shipping_labels_height + self.shipping_labels_margin[1],
        )

    # noinspection PyUnusedLocal 
開發者ID:olist,項目名稱:correios,代碼行數:19,代碼來源:pdf.py

示例5: apply_color

# 需要導入模塊: from reportlab.lib import colors [as 別名]
# 或者: from reportlab.lib.colors import gray [as 別名]
def apply_color(formatter, cmap=None, font_bw=1, stripe_rows=1, stripe_cols=0,
                    hdr_border_clazz=BorderTypeGrid, cell_border_clazz=BorderTypeOutline, border_weight=.7):
        """
        font_bw: bool, If True use black and white fonts. If False, then use the cmap
        """
        cmap = cmap or Style.Blue
        light = cmap.get('Light', white)
        medium = cmap.get('Medium', gray)
        dark = cmap.get('Dark', black)
        # the ranges
        header = formatter.all.iloc[:formatter.header.nrows]
        cells = formatter.all.iloc[formatter.header.nrows:]
        # color the header
        hdr_border_clazz and header.set_border_type(hdr_border_clazz, color=medium, weight=border_weight)
        header.set_textcolor(font_bw and white or light)
        header.set_background(dark)
        # color the cells
        cell_border_clazz and cells.set_border_type(cell_border_clazz, color=medium, weight=border_weight)
        stripe_rows and cells.set_row_backgrounds([light, white])
        stripe_cols and cells.set_col_backgrounds([white, light])
        not font_bw and cells.set_textcolor(dark) 
開發者ID:bpsmith,項目名稱:tia,代碼行數:23,代碼來源:table.py

示例6: _build_service_provider_and_client_info

# 需要導入模塊: from reportlab.lib import colors [as 別名]
# 或者: from reportlab.lib.colors import gray [as 別名]
def _build_service_provider_and_client_info(self):
        if isinstance(self.service_provider_info, ServiceProviderInfo) and isinstance(self.client_info, ClientInfo):
            # Merge Table
            table_data = [
                [
                    Paragraph('Service Provider', self._defined_styles.get('Heading1')), '',
                    '',
                    Paragraph('Client', self._defined_styles.get('Heading1')), ''
                ]
            ]
            table_style = [
                ('SPAN', (0, 0), (1, 0)),
                ('SPAN', (3, 0), (4, 0)),
                ('LINEBELOW', (0, 0), (1, 0), 1, colors.gray),
                ('LINEBELOW', (3, 0), (4, 0), 1, colors.gray),
                ('LEFTPADDING', (0, 0), (-1, -1), 0),
            ]
            client_info_data = self._client_info_data()
            service_provider_data = self._service_provider_data()
            diff = abs(len(client_info_data) - len(service_provider_data))
            if diff > 0:
                if len(client_info_data) < len(service_provider_data):
                    client_info_data.extend([["", ""]]*diff)
                else:
                    service_provider_data.extend([["", ""]*diff])
            for d in zip(service_provider_data, client_info_data):
                d[0].append('')
                d[0].extend(d[1])
                table_data.append(d[0])
            self._story.append(
                Table(table_data, style=table_style)
            )
        else:
            self._build_service_provider_info()
            self._build_client_info() 
開發者ID:CiCiApp,項目名稱:PyInvoice,代碼行數:37,代碼來源:templates.py

示例7: draw

# 需要導入模塊: from reportlab.lib import colors [as 別名]
# 或者: from reportlab.lib.colors import gray [as 別名]
def draw(self):
        # general widget bits
        s = float(self.size)  # abbreviate as we will use this a lot
        g = NotAllowed.draw(self)

        # no-smoking-sign specific bits
        newx = self.x+(s/2)-(s/3.5)
        newy = self.y+(s/2)-(s/32)
        cigarrette1 = shapes.Rect(x = newx, y = newy, width = (s/2), height =(s/16),
                fillColor = colors.ghostwhite, strokeColor = colors.gray, strokeWidth=0)
        newx=newx+(s/2)+(s/64)
        g.insert(-1,cigarrette1)

        cigarrette2 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16),
                fillColor = colors.orangered, strokeColor = None, strokeWidth=0)
        newx= newx+(s/35)
        g.insert(-1,cigarrette2)

        cigarrette3 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16),
                fillColor = colors.orangered, strokeColor = None, strokeWidth=0)
        newx= newx+(s/35)
        g.insert(-1,cigarrette3)

        cigarrette4 = shapes.Rect(x = newx, y = newy, width = (s/80), height =(s/16),
                fillColor = colors.orangered, strokeColor = None, strokeWidth=0)
        newx= newx+(s/35)
        g.insert(-1,cigarrette4)

        return g 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:31,代碼來源:signsandsymbols.py

示例8: drawOn

# 需要導入模塊: from reportlab.lib import colors [as 別名]
# 或者: from reportlab.lib.colors import gray [as 別名]
def drawOn(self, canvas, x, y, _sW=0):
        "Tell it to draw itself on the canvas.  Do not override"
        x = self._hAlignAdjust(x,_sW)
        canvas.saveState()
        canvas.translate(x, y)
        self._drawOn(canvas)
        if hasattr(self, '_showBoundary') and self._showBoundary:
            #diagnostic tool support
            canvas.setStrokeColor(gray)
            canvas.rect(0,0,self.width, self.height)
        canvas.restoreState() 
開發者ID:Microvellum,項目名稱:Fluid-Designer,代碼行數:13,代碼來源:flowables.py


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