本文整理汇总了Python中reportlab.lib.colors.grey方法的典型用法代码示例。如果您正苦于以下问题:Python colors.grey方法的具体用法?Python colors.grey怎么用?Python colors.grey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.lib.colors
的用法示例。
在下文中一共展示了colors.grey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_description
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import grey [as 别名]
def get_description(self, description, depth, row_idx):
"""
Description for a test object,
this will generally be docstring text.
"""
return RowData(
start=row_idx,
content=split_text(
format_description(description),
const.FONT_ITALIC,
const.FONT_SIZE_SMALL,
const.PAGE_WIDTH - (depth * const.INDENT),
keep_leading_whitespace=True,
),
style=RowStyle(
font=(const.FONT_ITALIC, const.FONT_SIZE_SMALL),
left_padding=const.INDENT * depth,
text_color=colors.grey,
),
)
示例2: table_model
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import grey [as 别名]
def table_model():
"""
添加表格
:return:
"""
template_path = current_app.config.get("REPORT_TEMPLATES")
image_path = os.path.join(template_path, 'test.jpg')
new_img = Image(image_path, width=300, height=300)
base = [
[new_img, ""],
["大类", "小类"],
["WebFramework", "django"],
["", "flask"],
["", "web.py"],
["", "tornado"],
["Office", "xlsxwriter"],
["", "openpyxl"],
["", "xlrd"],
["", "xlwt"],
["", "python-docx"],
["", "docxtpl"],
]
style = [
# 设置字体
('FONTNAME', (0, 0), (-1, -1), 'SimSun'),
# 合并单元格 (列,行)
('SPAN', (0, 0), (1, 0)),
('SPAN', (0, 2), (0, 5)),
('SPAN', (0, 6), (0, 11)),
# 单元格背景
('BACKGROUND', (0, 1), (1, 1), HexColor('#548DD4')),
# 字体颜色
('TEXTCOLOR', (0, 1), (1, 1), colors.white),
# 对齐设置
('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
('ALIGN', (0, 0), (-1, -1), 'CENTER'),
# 单元格框线
('GRID', (0, 0), (-1, -1), 0.5, colors.grey),
('BOX', (0, 0), (-1, -1), 0.5, colors.black),
]
component_table = Table(base, style=style)
return component_table
示例3: append_comparison_data
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import grey [as 别名]
def append_comparison_data(data, row, depth, start_idx):
"""TODO."""
offset, key, match, left, right = row
if match == "Passed":
item_color = colors.black
status_color = colors.green
font = const.FONT
elif match == "Failed":
item_color = colors.black
status_color = colors.red
font = const.FONT_BOLD
else:
item_color = colors.grey
status_color = colors.grey
font = const.FONT_ITALIC
if isinstance(left, tuple):
left = "<{}> {}".format(left[0], left[1])
if isinstance(right, tuple):
right = "<{}> {}".format(right[0], right[1])
data.append(
RowData(
content=[key, left, right, match],
style=[
RowStyle(
text_color=item_color,
font=(font, const.FONT_SIZE_SMALL),
left_padding=const.INDENT * (depth + offset + 1),
),
RowStyle(
text_color=status_color, start_column=const.LAST_COLUMN_IDX
),
],
start=start_idx,
)
)
示例4: makeBackground
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import grey [as 别名]
def makeBackground(self):
if self.background is not None:
BG = self.background
if isinstance(BG,Group):
g = BG
for bg in g.contents:
bg.x = self.x
bg.y = self.y
bg.width = self.width
bg.height = self.height
else:
g = Group()
if type(BG) not in (type(()),type([])): BG=(BG,)
for bg in BG:
bg.x = self.x
bg.y = self.y
bg.width = self.width
bg.height = self.height
g.add(bg)
return g
else:
strokeColor,strokeWidth,fillColor=self.strokeColor, self.strokeWidth, self.fillColor
if (strokeWidth and strokeColor) or fillColor:
g = Group()
_3d_dy = getattr(self,'_3d_dy',None)
x = self.x
y = self.y
h = self.height
w = self.width
if _3d_dy is not None:
_3d_dx = self._3d_dx
if fillColor and not strokeColor:
from reportlab.lib.colors import Blacker
c = Blacker(fillColor, getattr(self,'_3d_blacken',0.7))
else:
c = strokeColor
if not strokeWidth: strokeWidth = 0.5
if fillColor or strokeColor or c:
bg = Polygon([x,y,x,y+h,x+_3d_dx,y+h+_3d_dy,x+w+_3d_dx,y+h+_3d_dy,x+w+_3d_dx,y+_3d_dy,x+w,y],
strokeColor=strokeColor or c or grey, strokeWidth=strokeWidth, fillColor=fillColor)
g.add(bg)
g.add(Line(x,y,x+_3d_dx,y+_3d_dy, strokeWidth=0.5, strokeColor=c))
g.add(Line(x+_3d_dx,y+_3d_dy, x+_3d_dx,y+h+_3d_dy,strokeWidth=0.5, strokeColor=c))
fc = Blacker(c, getattr(self,'_3d_blacken',0.8))
g.add(Polygon([x,y,x+_3d_dx,y+_3d_dy,x+w+_3d_dx,y+_3d_dy,x+w,y],
strokeColor=strokeColor or c or grey, strokeWidth=strokeWidth, fillColor=fc))
bg = Line(x+_3d_dx,y+_3d_dy, x+w+_3d_dx,y+_3d_dy,strokeWidth=0.5, strokeColor=c)
else:
bg = None
else:
bg = Rect(x, y, w, h,
strokeColor=strokeColor, strokeWidth=strokeWidth, fillColor=fillColor)
if bg: g.add(bg)
return g
else:
return None