sas.qtgui.Utilities.Reports package

Subpackages

Submodules

sas.qtgui.Utilities.Reports.ReportDialog module

class sas.qtgui.Utilities.Reports.ReportDialog.ReportDialog(report_data: ReportData, parent: QObject | None = None)

Bases: QDialog, Ui_ReportDialogUI

Class for stateless grid-like printout of model parameters for mutiple models

onPrint()

Display the print dialog and send the report to printer

onSave()

Display the Save As… prompt and save the report if instructed so

static save_pdf(data, filename)

Create a PDF file from html source string. Returns True is the file creation was successful. : data: html string : filename: name of file to be saved

setupDialog(output=None)

Display the HTML content in the browser.

staticMetaObject = PySide6.QtCore.QMetaObject("ReportDialog" inherits "QDialog": )
static write_string(string, filename)

Write string to file

sas.qtgui.Utilities.Reports.reportdata module

class sas.qtgui.Utilities.Reports.reportdata.ReportData(html: str = '<html><body>No Data</body></html>', text: str = 'No data')

Bases: object

html: str = '<html><body>No Data</body></html>'
text: str = 'No data'

sas.qtgui.Utilities.Reports.reports module

class sas.qtgui.Utilities.Reports.reports.ReportBase(title: str, style_link: str | None = None, show_figure_section_title=True, show_param_section_title=True)

Bases: object

add_data_details(data: Data1D)

Add details of input data to the report

add_image_from_bytes(bytes: BytesIO, file_type='png')

Add an image from a BytesIO object

add_image_from_file(filename: str)

Add image to report from a source file

add_plot(fig, image_type='png', figure_title: str | None = None)

Add a plot to the report

Parameters:
  • fig – matplotlib.figure.Figure, Matplotlib figure object to add

  • image_type – str, type of embedded image - ‘svg’ or ‘png’, defaults to ‘svg’

  • figure_title – Optional[str] - Optionally add an html header tag, defaults to None

Raises:

ValueError – if image_type is bad

add_table(data: list[list[Any]], titles: Iterable[str] | None = None, target_tag='model-parameters', column_prefix='column')

Add a table of parameters to the report

add_table_dict(d: dict[str, Any], titles: tuple[str, str] | None = None)
property html: str

A string containing the html of the document

property report_data: ReportData
save_html(filename: str)
save_pdf(filename: str)
save_text(filename: str)
property text: str

Text version of the document (actually RST)

sas.qtgui.Utilities.Reports.reports.main()

This can be run locally without sasview to make it easy to adjust the report layout/styling, it will generate a report with some arbitrary data

class sas.qtgui.Utilities.Reports.reports.pretty_units(*args, **kwargs)

Bases: span

HTML tag for units, prettifies angstroms, inverse angstroms and inverse cm TODO: Should be replaced when there is a better way of handling units

tagname = 'span'

Module contents