safe.utilities.analysis_handler module

InaSAFE Disaster risk assessment tool by AusAid GUI InaSAFE Wizard Dialog.

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.utilities.analysis_handler.AnalysisHandler(parent)[source]

Bases: PyQt4.QtCore.QObject

Analysis handler for the dock and the wizard.

analysisDone
analysis_error(exception, message)[source]

A helper to spawn an error and halt processing.

An exception will be logged, busy status removed and a message displayed.

Note

Copied from the dock

Parameters:
  • message (ErrorMessage, Message) – an ErrorMessage to display
  • exception (Exception) – An exception that was raised
completed()[source]

Slot activated when the process is done.

Note

Adapted from the dock

disable_signal_receiver()[source]

Remove dispatcher for all available signal from Analysis.

Note

Adapted from the dock

enable_signal_receiver()[source]

Setup dispatcher for all available signal from Analysis.

Note

Adapted from the dock

hide_busy()[source]

Unlock buttons A helper function to indicate processing is done.

init_analysis()[source]

Setup analysis to make it ready to work.

Note

Copied or adapted from the dock

open_map_in_composer(impact_report)[source]

Open map in composer given MapReport instance.

..note:: (AG) See https://github.com/AIFDR/inasafe/issues/911. We
need to set the composition to the composer before loading the template.
Parameters:impact_report (ImpactReport) – Impact Report to be opened in composer.
print_map(mode='pdf')[source]

Open impact report dialog that used define report options.

Parameters:mode – Mode for report - defaults to PDF.
print_map_to_pdf(impact_report)[source]

Print map to PDF given MapReport instance.

Parameters:impact_report (ImpactReport) – Impact Report instance that is ready to print
read_settings()[source]

Restore settings from QSettings.

Do this on init and after changing options in the options dialog.

setup_and_run_analysis()[source]

Setup and execute the analysis

show_busy()[source]

Lock buttons and enable the busy cursor.

show_dynamic_message(sender, message)[source]

Send a dynamic message to the message viewer.

Dynamic messages are appended to any existing content in the MessageViewer.

Note

Modified from the dock

Parameters:
  • sender (Object, None) – The object that sent the message.
  • message (Message) – An instance of our rich message class.
show_error_message(error_message)[source]

Send an error message to the message viewer.

Error messages cause any previous content in the MessageViewer to be replaced with new content.

Note

Copied from the dock

Parameters:error_message (ErrorMessage) – An instance of our rich error message class.
show_results(qgis_impact_layer, engine_impact_layer)[source]

Helper function for slot activated when the process is done.

Note

Adapted from the dock

Parameters:
  • qgis_impact_layer (QgsMapLayer, QgsVectorLayer, QgsRasterLayer) – A QGIS layer representing the impact.
  • engine_impact_layer (ReadLayer) – A safe_layer representing the impact.
Returns:

Provides a report for writing to the dock.

Return type:

str

show_static_message(message)[source]

Send a static message to the message viewer.

Static messages cause any previous content in the MessageViewer to be replaced with new content.

Note

Copied from the dock

Parameters:message (Message) – An instance of our rich message class.