safe.gui.widgets.message_viewer module

InaSAFE Disaster risk assessment tool by AusAid - Dispatcher gui example.

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.gui.widgets.message_viewer.MessageViewer(the_parent)[source]

Bases: PyQt4.QtWebKit.QWebView

A simple message queue

clear_dynamic_messages_log()[source]

Clear dynamic message log.

contextMenuEvent(event)[source]

Slot automatically called by Qt on right click on the WebView.

Parameters:event – the event that caused the context menu to be called.
dynamic_message_event(sender, message)[source]

Dynamic event handler - set message state based on event.

Dynamic messages don’t clear the message buffer.

Parameters:
  • sender (Object, None) – Unused - the object that sent the message.
  • message (Message) – A message to show in the viewer.
error_message_event(sender, message)[source]

Error message event handler - set message state based on event.

Error messages are treated as dynamic messages - they don’t clear the message buffer.

Parameters:
  • sender (Object, None) – The object that sent the message.
  • message (Message) – A message to show in the viewer.
html_loaded_slot(ok)[source]

Slot called when the page is loaded.

Parameters:ok (bool) – Flag indicating if the html is loaded.
impact_path[source]

Getter to impact path.

load_html(mode, html)[source]

Load HTML to this class with the mode specified.

There are two modes that can be used:
  • HTML_FILE_MODE: Directly from a local HTML file.
  • HTML_STR_MODE: From a valid HTML string.
Parameters:
  • mode (int) – The mode.
  • html (str) – The html that will be loaded. If the mode is a file, then it should be a path to the htm lfile. If the mode is a string, then it should be a valid HTML string.
load_html_file(file_path)[source]

Load html file into webkit.

Parameters:file_path (str) – The path of the html file
open_current_in_browser()[source]

Open current selected impact report in browser.

page_to_html()[source]

Return the current page contents as html.

page_to_stdout()[source]

Print to console the current page contents as plain text.

page_to_text()[source]

Return the current page contents as plain text.

save_log_to_html()[source]

Helper to write the log out as an html file.

save_report_to_html()[source]

Save report in the dock to html.

show_log()[source]

Show log.

show_messages()[source]

Show all messages.

show_report()[source]

Show report.

static_message_count = 0
static_message_event(sender, message)[source]

Static message event handler - set message state based on event.

Static message events will clear the message buffer before displaying themselves.

Parameters:
to_message()[source]

Collate all message elements to a single message.