safe.plugin module

InaSAFE Disaster risk assessment tool by AusAid QGIS plugin implementation.

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.plugin.Plugin(iface)[source]

Bases: object

The QGIS interface implementation for the InaSAFE plugin.

This class acts as the ‘glue’ between QGIS and our custom logic. It creates a toolbar and menu bar entry and launches the InaSAFE user interface if these are activated.

add_action(action, add_to_toolbar=True)[source]

Add a toolbar icon to the InaSAFE toolbar.

Parameters:
  • action (QAction) – The action that should be added to the toolbar.
  • add_to_toolbar (bool) – Flag indicating whether the action should also be added to the InaSAFE toolbar. Defaults to True.
add_test_layers()[source]

Add standard test layers.

change_i18n(new_locale)[source]

Change internationalisation for the plugin.

Override the system locale and then see if we can get a valid translation file for whatever locale is effectively being used.

Parameters:new_locale (str) – The new locale i.e. ‘id’, ‘af’, etc.
Raises:TranslationLoadException
clear_modules()[source]

Unload inasafe functions and try to return QGIS to before InaSAFE.

initGui()[source]

Gui initialisation procedure (for QGIS plugin api).

Note

Don’t change the name of this method from initGui!

This method is called by QGIS and should be used to set up any graphical user interface elements that should appear in QGIS by default (i.e. before the user performs any explicit action with the plugin).

layer_changed(layer)[source]

Enable or disable keywords editor icon when active layer changes.

Parameters:layer (QgsMapLayer) – The layer that is now active.
save_scenario()[source]

Save current scenario to text file

shortcut_f7()[source]

Executed when user press F7 - will show the shakemap importer.

show_batch_runner()[source]

Show the batch runner dialog.

show_extent_selector()[source]

Show the extent selector widget for defining analysis extents.

show_function_centric_wizard()[source]

Show the keywords creation wizard.

show_impact_merge()[source]

Show the impact layer merge dialog.

show_keywords_wizard()[source]

Show the keywords creation wizard.

show_minimum_needs()[source]

Show the minimum needs dialog.

show_minimum_needs_configuration()[source]

Show the minimum needs dialog.

show_options()[source]

Show the options dialog.

show_osm_downloader()[source]

Show the OSM buildings downloader dialog.

show_shakemap_importer()[source]

Show the converter dialog.

toggle_dock_visibility()[source]

Show or hide the dock widget.

toggle_inasafe_action(checked)[source]

Check or un-check the toggle inaSAFE toolbar button.

This slot is called when the user hides the inaSAFE panel using its close button or using view->panels.

Parameters:checked (bool) – True if the dock should be shown, otherwise False.
tr(message)[source]

Get the translation for a string using Qt translation API.

We implement this ourselves since we do not inherit QObject.

Parameters:message (str, QString) – String for translation.
Returns:Translated version of message.
Return type:QString
unload()[source]

GUI breakdown procedure (for QGIS plugin api).

Note

Don’t change the name of this method from unload!

This method is called by QGIS and should be used to remove any graphical user interface elements that should appear in QGIS.