本文整理汇总了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
)
示例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
示例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
示例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
示例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)
示例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()
示例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
示例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()