1.1.2.8. gnr.core.gnrhtml – Server-side HTML generations (web pages and printable reports)

Last page update: November 23, 2011

Classes:

Complete reference:

1.1.2.8.1. Introduction

Usually in GenroPy the pages are built on the client side: the page structure is transfered as a Bag; after that, the Genro’s javascript tools take care to build the DOM and all the necessary (webpage elements). So, you have the complete control of the page, and you can modify the page itself simply modifying the Bag that constructs the page.

You can build the page completely server side. It is useful to index pages for search engines and, above all, to make the :ref:`ref_for_the_print` <-- TODO

In a server side page you can use all the Dojo widgets, but without Genro additions and without Genro extensions (e.g. the dbSelect doesn’t work)

1.1.2.8.4. gnr.core.gnrhtml - The complete reference list

class gnr.core.gnrhtml.GnrHtmlBuilder(page_height=None, page_width=None, page_margin_top=None, page_margin_left=None, page_margin_right=None, page_margin_bottom=None, showTemplateContent=None, htmlTemplate=None, page_debug=False, srcfactory=None, css_requires=None, print_button=None, bodyAttributes=None)

TODO

calculate_style(attr, um, **kwargs)

TODO

Parameters:
  • attr – TODO
  • um – the unit of measurement
finalize(src)

TODO

Parameters:src – TODO
finalize_cell(row, attr, cell)

TODO

Parameters:
  • row – TODO
  • attr – TODO
  • cell – TODO
finalize_layout(parent, attr, layout)

TODO

Parameters:
  • parent – TODO
  • attr – TODO
  • layout – TODO
finalize_pass(src, attr, value)

TODO

Parameters:
  • src – TODO
  • attr – TODO
  • value – TODO
finalize_row(layout, attr, row)

TODO

Parameters:
  • layout – TODO
  • attr – TODO
  • row – TODO
initializeSrc(**bodyAttributes)

TODO

newPage()

Create a new page

prepareTplLayout(tpl)

Prepare the layout template

Parameters:tpl – the template
setLabel(cell, attr)

TODO

Parameters:
  • cell – TODO
  • attr – TODO
styleForLayout()

TODO

styleMaker(attr)

TODO

Parameters:attr – TODO
toHtml(filepath=None)

TODO

Parameters:filepath – TODO
toPdf(filename)

TODO

Parameters:filename – TODO
class gnr.core.gnrhtml.GnrHtmlSrc(source=None, **kwargs)

Structure used to build server-side HTML pages. Prints are based on this class

cell(content=None, width=0, content_class=None, lbl=None, lbl_class=None, lbl_height=None, cell_border=None, **kwargs)

Build a cell() and return it

Parameters:
  • content – the row’s content
  • width – the row’s width
  • content_class – the row’s content class
  • lbl – the cell’s label
  • lbl_class – the class of the row’s label
  • lbl_height – the height of the row’s label
  • lbl_height – the border of the row’s label
  • if you don’t define the cell width, then it takes all the remaining space
child(tag, *args, **kwargs)

TODO

comment(content=None)

Creates an HTML comment tag (<!-- -->)

Shortcut to create a <link rel="stylesheet" type="text/css""> tag

layout(name='l1', um='mm', top=0, left=0, bottom=0, right=0, width=0, height=0, border_width=0.29999999999999999, border_color='grey', border_style='solid', row_border=True, cell_border=True, lbl_height=3, lbl_class='lbl_base', content_class='content_base', hasBorderTop=None, hasBorderLeft=None, hasBorderRight=None, hasBorderBottom=None, **kwargs)

Build a layout element and return it

Parameters:
  • name – the layout name
  • um – the layout’s unit of measurement
  • top – the height of the top region
  • left – the width of the left region
  • bottom – the height of the bottom region
  • right – the width of the right region
  • width – layout’s width
  • height – layout’s height
  • border_width – add the border width
  • border_color – add the border color
  • border_style – add the border style
  • row_border – add the row border
  • cell_border – add the cell border
  • lbl_height – add the label height
  • lbl_class – add the label class
  • content_class – add the content class
  • hasBorderTop – add the top border
  • hasBorderLeft – add the left border
  • hasBorderRight – add the right border
  • hasBorderBottom – add the bottom border
  • **kwargs

    you can pass:

    • style: a string with css style

Creates a <link> tag

meta(name=None, content=None, http_equiv=None, **kwargs)

Creates a <meta> tag

row(height=0, row_border=None, cell_border=None, lbl_height=None, lbl_class=None, content_class=None, **kwargs)

Build a row and return it

Parameters:
  • height – the row’s height
  • row_border – the row’s border
  • cell_border – the border of the row’s cell
  • lbl_height – the height of the row’s label
  • lbl_class – the class of the row’s label
  • content_class – the class of the row’s content
script(script='', _type='text/javascript', **kwargs)

Creates a <script> tag

style(style='', **kwargs)

Creates a <style> tag