InaSAFE Disaster risk assessment tool developed by AusAid - GUI Keywords 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.
Todo
Check raster is single band
Dialog implementation class for the Risk In A Box keywords editor.
Automatic slot executed when the ok button is pressed.
It will write out the keywords for the layer that is active.
Add an item to the keywords list given its key/value.
The key and value must both be valid, non empty strings or an InvalidKVPException will be raised.
If an entry with the same key exists, it’s value will be replaced with theValue.
It will add the current key/value pair to the list if it is not already present. The kvp will also be stored in the data of the listwidgetitem as a simple string delimited with a bar (‘|’).
Args:
- theKey - string representing the key part of the key value pair (kvp)
- theValue - string representing the value part of the key value pair (kvp)
Apply any pending changes e.g. keywords entered without being added. See https://github.com/AIFDR/inasafe/issues/249
Args: None
Returns: None
Raises: None
Obtain the state of the dialog as a keywords dict
Check if our key list contains a specific key, and return its value if present.
Set the ui state to match the keywords of the currently active layer.
Set leKey and leValue to the clicked item in the lstKeywords.
Args: None
Returns: None
Raises: None
Automatic slot executed when the subcategory is changed.
When the user changes the subcategory, we will extract the subcategory and dataype or unit (depending on if it is a hazard or exposure subcategory) from the [] after the name.
Update the keywords list whenver the user changes the title. This slot is not called is the title is changed programmatically.
Automatic slot executed when the pbnAddToList1 button is pressed.
Automatic slot executed when the pbnAddToList2 button is pressed.
Automatic slot executed when the advanced button is toggled.
Note
some of the behaviour for hiding widgets is done using the signal/slot editor in designer, so if you are trying to figure out how the interactions work, look there too!
Automatic slot executed when the pbnRemove button is pressed.
It will remove any selected items in the keywords list.
Automatic slot executed when the hazard radio is toggled on.
Automatic slot executed when the hazard radio is toggled.
Automatic slot executed when the hazard radio is toggled on.
Remove an item from the kvp list given its key.
Remove an item from the kvp list given its key.
Reset all controls to a blank state.
Set the category radio button based on theCategory.
Helper to populate the subcategory list based on category context.
Args:
- theEntries - an OrderedDict of subcategories. The dict entries should be (‘earthquake’, self.tr(‘earthquake’)). See http://www.voidspace.org.uk/python/odict.html for info on OrderedDict.
- theSelectedItem - optional parameter indicating which item should be selected in the combo. If the selected item is not in theList, it will be appended to it.
This module forms part of the InaSAFE tool.