Python reportlab.lib.colors.grey() Examples
The following are 4
code examples of reportlab.lib.colors.grey().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
reportlab.lib.colors
, or try the search function
.
Example #1
Source File: report.py From flask-restful-example with MIT License | 10 votes |
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
Example #2
Source File: reports.py From testplan with Apache License 2.0 | 6 votes |
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, ), )
Example #3
Source File: assertions.py From testplan with Apache License 2.0 | 5 votes |
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, ) )
Example #4
Source File: areas.py From Fluid-Designer with GNU General Public License v3.0 | 4 votes |
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