print_preview

class camelot.view.action_steps.print_preview.ChartDocument(chart)[source]

Helper class to print matplotlib charts

Parameters:chart – a camelot.container.chartcontainer.FigureContainer object or a camelot.container.chartcontainer.AxesContainer subclass
class camelot.view.action_steps.print_preview.PrintChart(chart)[source]

Display a print preview dialog box for a matplotlib chart.

Parameters:chart – a camelot.container.chartcontainer.FigureContainer object or a camelot.container.chartcontainer.AxesContainer subclass

Example use of this action step :

class camelot.view.action_steps.print_preview.PrintHtml(html)[source]

Display a print preview dialog box for an html string.

Parameters:html – a string containing the html to render in the print preview.

the rendering of the html can be customised using the same attributes as those of the PrintPreview class.

class camelot.view.action_steps.print_preview.PrintJinjaTemplate(template, context={}, environment=<camelot.core.templates.environment>)[source]

Render a jinja template into a print preview dialog.

Parameters:
  • template – the name of the template as it can be fetched from the Jinja environment.
  • context – a dictionary with objects to be used when rendering the template
  • environment – a jinja2.Environment object to be used to load templates from. This defaults to the environment object available in camelot.core.templates
class camelot.view.action_steps.print_preview.PrintPreview(document)[source]

Display a print preview dialog box.

Parameters:document – an instance of QtGui.QTextDocument or QtWebKit.QWebView that has a print_() method. The thread affinity of this object will be changed to be able to use it in the GUI.

the print preview can be customised using these attributes :

margin_left

change the left margin of the content to the page border, unit is set by margin_unit

margin_top

change the top margin of the content to the page border, unit is set by margin_unit

margin_right

change the right margin of the content to the page border, unit is set by margin_unit

margin_bottom

change the bottom margin of the content to the page border, unit is set by margin_unit

margin_unit

defin which unit is used for the defined margins (e.g. margin_left, margin_bottom)

page_size

the page size, by default QtGui.QPrinter.A4 is used

page_orientation

the page orientation, by default QtGui.QPrinter.Portrait is used.

document

the QtGui.QTextDocument holding the document that will be shown in the print preview

../../../_images/simple_report.png
render(gui_context)[source]

create the print preview widget. this method is used to unit test the action step.

class camelot.view.action_steps.print_preview.PrintPreviewDialog(printer, gui_context, actions=[], parent=None, flags=0)[source]

A custom QtGui.QPrintPreviewDialog that allows additional actions on the toolbar.

Parameters:

Previous topic

orm

Next topic

select_file

This Page