Module: safe_qgis.html_renderer

InaSAFE Disaster risk assessment tool developed by AusAid -
InaSAFE map making module.

Contact : ole.moller.nielsen@gmail.com

Note

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

class safe_qgis.html_renderer.HtmlRenderer(thePageDpi)[source]

A class for creating a map.

htmlLoadedSlot()[source]

Slot called when the page is loaded.

Args: None Returns: None Raises: None

loadAndWait(theHtmlPath=None, theHtmlSnippet=None)[source]

Load some html to a web view and wait till it is done.

printImpactTable(theKeywords, theFilename=None)[source]

High level table generator to print layer keywords.

It gets the summary and impact table from a QgsMapLayer’s keywords and renders to pdf, returning the resulting PDF file path.

Args:
theKeywords: dic containing impact layer keywords (required)
Returns:
str: Path to generated pdf file.
Raises:
None
printToPdf(theHtml, theFilename=None)[source]

Render an html snippet into the printer, paginating as needed.

Args:
  • theHtml: str A string containing an html snippet. It will have a

    header and footer appended to it in order to make it a valid html document. The header will also apply the bootstrap theme to the document.

  • theFilename: str String containing a pdf file path that the

    output will be written to.

Returns:
str: The file path of the output pdf (which is the same as the
theFilename parameter if it was specified.
Raises:
None
renderHtmlToPixmap(theHtml, theWidthMM)[source]

Render some HTML to a pixmap.

Args:
  • theHtml - HTML to be rendered. It is assumed that the html is a snippet only, containing no body element - a standard header and footer will be appended.
  • theWidthMM- width of the table in mm - will be converted to points based on the resolution of our page.
Returns:
QPixmap
Raises:
Any exceptions raised by the InaSAFE library will be propagated.
tr(theString)[source]

We implement this since we do not inherit QObject.

Args:
theString - string for translation.
Returns:
Translated version of theString.
Raises:
no exceptions explicitly raised.

This module forms part of the InaSAFE tool.

Previous topic

Module: safe_qgis.exceptions

Next topic

Module: safe_qgis.dock

This Page