### Navigation

- index
- modules
- next
- previous
- Home »
- Contents »
- InaSAFE’s API documentation »
- Package::safe_qgis »

# Module: safe_qgis.keywords_dialog

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 `safe_qgis.keywords_dialog.``KeywordsDialog`(parent, iface, theDock=None, theLayer=None)

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

  `accept`()

    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)

    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.
  `applyPendingChanges`()

    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

  `getKeywords`()

    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)

    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`()

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

    Args:
      None
    Returns:
      None.
    Raises:
      no exceptions explicitly raised.
  `makeKeyValueEditable`(theItem)

    Set leKey and leValue to the clicked item in the lstKeywords.

    Args: None

    Returns: None

    Raises: None

  `on_cboSubcategory_currentIndexChanged`(theIndex=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.

    Args:
      None
    Returns:
      None.
    Raises:
      no exceptions explicitly raised.
  `on_leTitle_textEdited`(theText)

    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`()

    Automatic slot executed when the pbnAddToList1 button is pressed.

    Args:
      None
    Returns:
      None.
    Raises:
      no exceptions explicitly raised.
  `on_pbnAddToList2_clicked`()

    Automatic slot executed when the pbnAddToList2 button is pressed.

    Args:
      None
    Returns:
      None.
    Raises:
      no exceptions explicitly raised.
  `on_pbnAdvanced_toggled`(theFlag)

    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`()

    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)

    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)

    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.
  `on_radPostprocessing_toggled`(theFlag)

    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.
  `removeItemByKey`(theKey)

    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)

    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)

    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)

    Set the category radio button based on theCategory.

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

    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`()

    Load the help text for the keywords safe_qgis

  `updateControlsFromList`()

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

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

This module forms part of the InaSAFE tool.

### Navigation

- index
- modules
- next
- previous
- Home »
- Contents »
- InaSAFE’s API documentation »
- Package::safe_qgis »