From 239ec496126200c5c2a140220ec5cdff2358c2bc Mon Sep 17 00:00:00 2001 From: Faris Ansari Date: Wed, 20 Oct 2021 19:06:16 +0530 Subject: [PATCH] style: formatting --- frappe/printing/page/print/print.js | 4 ++-- .../print_format_builder.js | 2 +- .../print_format_builder_beta.js | 2 +- .../public/js/print_format_builder/utils.js | 4 ++-- frappe/utils/weasyprint.py | 20 +++++++++---------- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/frappe/printing/page/print/print.js b/frappe/printing/page/print/print.js index dab22fdb14..f10c703589 100644 --- a/frappe/printing/page/print/print.js +++ b/frappe/printing/page/print/print.js @@ -621,14 +621,14 @@ frappe.ui.form.PrintView = class { name: this.frm.doc.name, print_format: print_format.name, letterhead: this.get_letterhead() - }) + }); let w = window.open(`/api/method/frappe.utils.weasyprint.download_pdf?${params}`); if (!w) { frappe.msgprint(__('Please enable pop-ups')); return; } } else { - this.render_page('/api/method/frappe.utils.print_format.download_pdf?') + this.render_page('/api/method/frappe.utils.print_format.download_pdf?'); } } diff --git a/frappe/printing/page/print_format_builder/print_format_builder.js b/frappe/printing/page/print_format_builder/print_format_builder.js index 72dc12038e..313e8da539 100644 --- a/frappe/printing/page/print_format_builder/print_format_builder.js +++ b/frappe/printing/page/print_format_builder/print_format_builder.js @@ -136,7 +136,7 @@ frappe.PrintFormatBuilder = class PrintFormatBuilder { beta: Boolean(beta) }, callback: (r) => { - if(r.message) { + if (r.message) { let print_format = r.message; if (print_format.print_format_builder_beta) { frappe.set_route('print-format-builder-beta', print_format.name); diff --git a/frappe/printing/page/print_format_builder_beta/print_format_builder_beta.js b/frappe/printing/page/print_format_builder_beta/print_format_builder_beta.js index e86fabb311..e923bbcb00 100644 --- a/frappe/printing/page/print_format_builder_beta/print_format_builder_beta.js +++ b/frappe/printing/page/print_format_builder_beta/print_format_builder_beta.js @@ -1,5 +1,5 @@ frappe.pages["print-format-builder-beta"].on_page_load = function(wrapper) { - var page = frappe.ui.make_app_page({ + frappe.ui.make_app_page({ parent: wrapper, title: __("Print Format Builder"), single_column: true diff --git a/frappe/public/js/print_format_builder/utils.js b/frappe/public/js/print_format_builder/utils.js index 5cfb0c4702..879fe9efd2 100644 --- a/frappe/public/js/print_format_builder/utils.js +++ b/frappe/public/js/print_format_builder/utils.js @@ -106,8 +106,8 @@ export function get_table_columns(df) { typeof tf.width == "number" && tf.width < 100 ? tf.width : tf.width - ? 20 - : 10; + ? 20 + : 10; table_columns.push({ label: tf.label, fieldname: tf.fieldname, diff --git a/frappe/utils/weasyprint.py b/frappe/utils/weasyprint.py index 89b45c629b..bd79534e69 100644 --- a/frappe/utils/weasyprint.py +++ b/frappe/utils/weasyprint.py @@ -37,11 +37,11 @@ class PrintFormatGenerator: Parameters ---------- print_format: str - Name of the Print Format + Name of the Print Format doc: str - Document to print + Document to print letterhead: str - Letter Head to apply (optional) + Letter Head to apply (optional) """ self.base_url = frappe.utils.get_url() self.print_format = frappe.get_doc("Print Format", print_format) @@ -101,7 +101,7 @@ class PrintFormatGenerator: Returns ------- pdf: a bytes sequence - The rendered PDF. + The rendered PDF. """ self._make_header_footer() @@ -124,14 +124,14 @@ class PrintFormatGenerator: Parameters ---------- element: str - Either 'header' or 'footer' + Either 'header' or 'footer' Returns ------- element_body: BlockBox - A Weasyprint pre-rendered representation of an html element + A Weasyprint pre-rendered representation of an html element element_height: float - The height of this element, which will be then translated in a html height + The height of this element, which will be then translated in a html height """ html = HTML(string=getattr(self, f"{element}_html"), base_url=self.base_url,) element_doc = html.render( @@ -160,11 +160,11 @@ class PrintFormatGenerator: Parameters ---------- main_doc: Document - The top level representation for a PDF page in Weasyprint. + The top level representation for a PDF page in Weasyprint. header_body: BlockBox - A representation for an html element in Weasyprint. + A representation for an html element in Weasyprint. footer_body: BlockBox - A representation for an html element in Weasyprint. + A representation for an html element in Weasyprint. """ for page in main_doc.pages: page_body = PrintFormatGenerator.get_element(page._page_box.all_children(), "body")