code: def clear_layout(layout):
      
      # Different platform has different treatment
      # If InaSAFE running on Windows or Linux
  
      # Adapted from http://stackoverflow.com/a/9383780
      if layout is not None:
          while layout.count():
              item = layout.takeAt(0)
              widget = item.widget()
              if widget is not None:
                  # Remove the widget from layout
                  widget.close()
                  widget.deleteLater()
              else:
                  clear_layout(item.layout())
  
              # Remove the item from layout
              layout.removeItem(item)
              del item
docs: Clear layout content.
  
      :param layout: A layout.
      :type layout: QLayout