safe.gui.tools.minimum_needs.needs_manager_dialog module

Impact Layer Merge Dialog.

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.tools.minimum_needs.needs_manager_dialog.NeedsManagerDialog(parent=None, dock=None)[source]

Bases: PyQt4.QtGui.QDialog, Ui_NeedsManagerDialogBase

Dialog class for the InaSAFE global minimum needs configuration.

New in version 2.2..

add_new_resource()[source]

Handle add new resource requests.

add_resource(resource)[source]

Add a resource to the minimum needs table.

Parameters:resource (dict) – The resource to be added
clear_resource_list()[source]

Clear the resource list.

discard_changes()[source]

Discard the changes to the resource add/edit.

edit_resource()[source]

Handle edit resource requests.

export_profile()[source]

Export minimum needs to a json file.

This method will save the current state of the minimum needs setup. Then open a dialog allowing the user to browse to the desired destination location and allow the user to save the needs as a json file.

import_profile()[source]

Import minimum needs from an existing json file.

The minimum needs are loaded from a file into the table. This state is only saved if the form is accepted.

load_profiles()[source]

Load the profiles into the dropdown list.

mark_current_profile_as_pending()[source]

Mark the current profile as pending by colouring the text red.

mark_current_profile_as_saved()[source]

Mark the current profile as saved by colouring the text black.

new_profile()[source]

Create a new profile by name.

page_changed(index)[source]

Slot for when tab changes in the stacked widget changes.

Parameters:index (int) – Index of the now active tab.
populate_resource_list()[source]

Populate the list resource list.

reject()[source]

Overload the base dialog reject event so we can handle state change.

If the user is in resource editing mode, clicking close button, window [x] or pressing escape should switch context back to the profile view, not close the whole window.

See https://github.com/AIFDR/inasafe/issues/1387

remove_profile()[source]

Remove the current profile.

Make sure the user is sure.

remove_resource()[source]

Remove the currently selected resource.

save_profile()[source]

Save the current state of the minimum needs widget.

The minimum needs widget current state is saved to the QSettings via the appropriate QMinimumNeeds class’ method.

save_profile_as()[source]

Save the minimum needs under a new profile name.

save_resource()[source]

Accept the add/edit of the current resource.

select_profile(index)[source]

Select a given profile by index.

Slot for when profile is selected.

Parameters:index (int) – The selected item’s index
select_profile_by_name(profile_name)[source]

Select a given profile by profile name

Parameters:profile_name (str) – The profile name
set_up_resource_parameters()[source]

Set up the resource parameter for the add/edit view.

show_help()[source]

Load the help text for the dialog.

switch_context(page)[source]

Switch context tabs by tab widget name.

Parameters:page (QWidget) – The page should be focussed.