safe.gui.tools.minimum_needs.needs_profile module

This is the concrete Minimum Needs class that contains the logic to load the minimum needs to and from the QSettings

class safe.gui.tools.minimum_needs.needs_profile.NeedsProfile[source]

Bases: safe.common.minimum_needs.MinimumNeeds

The concrete MinimumNeeds class to be used in a QGIS environment.

In the case where we assume QGIS we use the QSettings object to store the minimum needs.

New in version 2.2..

static format_sentence(sentence, resource)[source]

Populate the placeholders in the sentence.

Parameters:
  • sentence (basestring, str) – The sentence with placeholder keywords.
  • resource (dict) – The resource to be placed into the sentence.
Returns:

The formatted sentence.

Return type:

basestring

get_needs_parameters()[source]

Get the minimum needs resources in parameter format

Returns:The minimum needs resources wrapped in parameters.
Return type:list
get_profiles()[source]

Get all the minimum needs profiles.

Returns:The minimum needs by name.
Return type:list
load()[source]

Load the minimum needs.

If the minimum needs defined in QSettings use it, if not, get the most relevant available minimum needs (based on QGIS locale). The last thing to do is to just use the default minimum needs.

load_profile(profile)[source]

Load a specific profile into the current minimum needs.

Parameters:profile (basestring, str) – The profile’s name
precision_of(number_as_text)[source]

The number of digits after the decimal will be counted and used as returned as the precision.

Parameters:number_as_text (basestring) – A textual representation of the number whose precision we wish to determine.
Returns:The precision of the passed in textual representation of a number.
Return type:int
provenance[source]

The provenance that is provided with the loaded profile.

Returns:The provenance.
Return type:str
remove_profile(profile)[source]

Remove a profile.

Parameters:profile (basestring, str) – The profile to be removed.
root_directory[source]

Get the home root directory

Returns:root directory
Return type:QString
save()[source]

Save the minimum needs to the QSettings object.

save_profile(profile)[source]

Save the current minimum needs into a new profile.

Parameters:profile (basestring, str) – The profile’s name
safe.gui.tools.minimum_needs.needs_profile.add_needs_parameters(parameters)[source]

Add minimum needs to an impact functions parameters.

Parameters:parameters (dict) – A dictionary of impact function parameters.
Returns:A dictionary of parameters with minimum needs appended.
Return type:dict
safe.gui.tools.minimum_needs.needs_profile.filter_needs_parameters(parameter_list)[source]

Get all minimum needs parameters.

Parameters:parameter_list (list) – A list of parameters
Returns:A list of ResourceParameter
Return type:list
safe.gui.tools.minimum_needs.needs_profile.get_needs_provenance(parameters)[source]

Get the provenance of minimum needs.

Parameters:parameters (dict) – A dictionary of impact function parameters.
Returns:A parameter of provenance
Return type:TextParameter
safe.gui.tools.minimum_needs.needs_profile.get_needs_provenance_value(parameters)[source]

Get the value of provenance.

Parameters:parameters (dict) – A dictionary of impact function parameters.
Returns:A string value of provenance
Return type:str