def test_ReportWriter(tmpdir): report_writer = ReportWriter(default_template=os.path.join( 'tests', 'data', "template_rw.pug"), title="My default title", version="0.1.2") html = report_writer.pug_to_html(my_name="Zulko", my_organization="EGF") report_writer.write_report(html, os.path.join(str(tmpdir), "test_rw.pdf"))
from pdf_reports import ReportWriter # DEFINE A WRITER WITH DEFAULT TEMPLATE AND VALUES report_writer = ReportWriter(default_stylesheets=["style.css"], default_template="template.pug", title="My default title", version="0.1.2") # THEN LATER IN YOUR CODE: html = report_writer.pug_to_html(my_name="Zulko", my_organization="EGF") report_writer.write_report(html, "example_reportwriter.pdf")
PDF_REPORTS_AVAILABLE = True except ImportError: def ReportWriter(*a, **kw): return None PDF_REPORTS_AVAILABLE = False THIS_DIR = os.path.dirname(os.path.realpath(__file__)) ASSETS_DIR = os.path.join(THIS_DIR, "assets") TITLE_FONTDICT = fontdict = dict(size=14, weight="bold") report_writer = ReportWriter( dnachisel_logo_url=os.path.join(ASSETS_DIR, "logo.png"), version=__version__, default_stylesheets=(os.path.join(ASSETS_DIR, "style.css"), ), ) install_reports_extra_message = ( "Could not load %s (is it installed ?). You can install all " "dependencies for generating reports in DNA Chisel with this command:\n\n " "pip install dnachisel[reports]") def write_no_solution_report(target, problem, error, file_content=None, file_path=None): """Write a report on incompatibility found in the problem's constraints.
from ...version import __version__ from pdf_reports import ReportWriter from sequenticon import sequenticon import os THIS_PATH = os.path.dirname(os.path.realpath(__file__)) TEMPLATES_PATH = os.path.join(THIS_PATH, "templates") def template_path(name): return os.path.join(TEMPLATES_PATH, name) report_writer = ReportWriter( plateo_logo_url=os.path.join(TEMPLATES_PATH, 'imgs', 'logo.png'), version=__version__, default_stylesheets=(template_path("default_style.css"),) )