Module: is_keywords_dialog

This page contains the documentation for the InaSAFE is_keywords_dialog module.

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

class gui.is_keywords_dialog.ISKeywordsDialog(parent, iface, theDock=None)[source]

Dialog implementation class for the Risk In A Box keywords editor.

accept()[source]

Automatic slot executed when the ok button is pressed.

It will write out the keywords for the layer that is active.

Args:
None
Returns:
None.
Raises:
no exceptions explicitly raised.
addListEntry(theKey, theValue)[source]

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)
Returns:
None.
Raises:
no exceptions explicitly raised.
getKeywords()[source]

Obtain the state of the dialog as a keywords dict

Args:
None
Returns:
dict - a dictionary of keyword reflecting the state of the dialog.
Raises:
no exceptions explicitly raised.
getValueForKey(theKey)[source]

Check if our key list contains a specific key, and return its value if present.

Args:
theKey- String representing the key to search for
Returns:
Value of key if matched otherwise none
Raises:
no exceptions explicitly raised.
loadStateFromKeywords()[source]

Set the ui state to match the keywords of the currently active layer.

Args:
None
Returns:
None.
Raises:
no exceptions explicitly raised.
on_cboSubcategory_currentIndexChanged(theIndex=None)[source]

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.

Args:
None
Returns:
None.
Raises:
no exceptions explicitly raised.
on_leTitle_textEdited(theText)[source]

Update the keywords list whenver the user changes the title. This slot is not called is the title is changed programmatically.

Args:
None
Returns:
dict - a dictionary of keyword reflecting the state of the dialog.
Raises:
no exceptions explicitly raised.
on_pbnAddToList1_clicked()[source]

Automatic slot executed when the pbnAddToList1 button is pressed.

Args:
None
Returns:
None.
Raises:
no exceptions explicitly raised.
on_pbnAddToList2_clicked()[source]

Automatic slot executed when the pbnAddToList2 button is pressed.

Args:
None
Returns:
None.
Raises:
no exceptions explicitly raised.
on_pbnAdvanced_toggled(theFlag)[source]

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!

Args:
theFlag - boolean indicating the new checked state of the button
Returns:
None.
Raises:
no exceptions explicitly raised.
on_pbnRemove_clicked()[source]

Automatic slot executed when the pbnRemove button is pressed.

It will remove any selected items in the keywords list.

Args:
None
Returns:
None.
Raises:
no exceptions explicitly raised.
on_radExposure_toggled(theFlag)[source]

Automatic slot executed when the hazard radio is toggled on.

Args:
theFlag - boolean indicating the new checked state of the button
Returns:
None.
Raises:
no exceptions explicitly raised.
on_radHazard_toggled(theFlag)[source]

Automatic slot executed when the hazard radio is toggled.

Args:
theFlag - boolean indicating the new checked state of the button
Returns:
None.
Raises:
no exceptions explicitly raised.
removeItemByKey(theKey)[source]

Remove an item from the kvp list given its key.

Args:
theKey - key of item to be removed.
Returns:
None
Raises:
no exceptions explicitly raised.
removeItemByValue(theValue)[source]

Remove an item from the kvp list given its key.

Args:
theValue - value of item to be removed.
Returns:
None
Raises:
no exceptions explicitly raised.
reset(thePrimaryKeywordsOnlyFlag=True)[source]

Reset all controls to a blank state.

Args:
thePrimaryKeywordsOnlyFlag - if True (the default), only reset Subcategory, datatype and units.
Returns:
None
Raises:
no exceptions explicitly raised.
setCategory(theCategory)[source]

Set the category radio button based on theCategory.

Args:
theCategory - a string which must be either ‘hazard’ or ‘exposure’.
Returns:
False if the radio button could not be updated
Raises:
no exceptions explicitly raised.
setSubcategoryList(theEntries, theSelectedItem=None)[source]

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.
Returns:
None.
Raises:
no exceptions explicitly raised.
showHelp()[source]

Load the help text for the keywords gui

updateControlsFromList()[source]

Set the ui state to match the keywords of the currently active layer.

Args:
None
Returns:
None.
Raises:
no exceptions explicitly raised.

Previous topic

Module: is_map

Next topic

Module: is_help

This Page