repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
listlengths
20
707
docstring
stringlengths
3
17.3k
docstring_tokens
listlengths
3
222
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
idx
int64
0
252k
inasafe/inasafe
safe/utilities/styling.py
mmi_ramp_roman
def mmi_ramp_roman(raster_layer): """Generate an mmi ramp using range of 1-10 on roman. A standarised range is used so that two shakemaps of different intensities can be properly compared visually with colours stretched accross the same range. The colours used are the 'standard' colours commonly s...
python
def mmi_ramp_roman(raster_layer): """Generate an mmi ramp using range of 1-10 on roman. A standarised range is used so that two shakemaps of different intensities can be properly compared visually with colours stretched accross the same range. The colours used are the 'standard' colours commonly s...
[ "def", "mmi_ramp_roman", "(", "raster_layer", ")", ":", "items", "=", "[", "]", "sorted_mmi_scale", "=", "sorted", "(", "earthquake_mmi_scale", "[", "'classes'", "]", ",", "key", "=", "itemgetter", "(", "'value'", ")", ")", "for", "class_max", "in", "sorted_...
Generate an mmi ramp using range of 1-10 on roman. A standarised range is used so that two shakemaps of different intensities can be properly compared visually with colours stretched accross the same range. The colours used are the 'standard' colours commonly shown for the mercalli scale e.g. on w...
[ "Generate", "an", "mmi", "ramp", "using", "range", "of", "1", "-", "10", "on", "roman", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/styling.py#L38-L74
train
27,000
inasafe/inasafe
safe/gis/tools.py
load_layer_from_registry
def load_layer_from_registry(layer_path): """Helper method to load a layer from registry if its already there. If the layer is not loaded yet, it will create the QgsMapLayer on the fly. :param layer_path: Layer source path. :type layer_path: str :return: Vector layer :rtype: QgsVectorLayer ...
python
def load_layer_from_registry(layer_path): """Helper method to load a layer from registry if its already there. If the layer is not loaded yet, it will create the QgsMapLayer on the fly. :param layer_path: Layer source path. :type layer_path: str :return: Vector layer :rtype: QgsVectorLayer ...
[ "def", "load_layer_from_registry", "(", "layer_path", ")", ":", "# reload the layer in case the layer path has no provider information", "the_layer", "=", "load_layer", "(", "layer_path", ")", "[", "0", "]", "layers", "=", "QgsProject", ".", "instance", "(", ")", ".", ...
Helper method to load a layer from registry if its already there. If the layer is not loaded yet, it will create the QgsMapLayer on the fly. :param layer_path: Layer source path. :type layer_path: str :return: Vector layer :rtype: QgsVectorLayer .. versionadded: 4.3.0
[ "Helper", "method", "to", "load", "a", "layer", "from", "registry", "if", "its", "already", "there", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/tools.py#L66-L87
train
27,001
inasafe/inasafe
safe/gis/tools.py
reclassify_value
def reclassify_value(one_value, ranges): """This function will return the classified value according to ranges. The algorithm will return None if the continuous value has not any class. :param one_value: The continuous value to classify. :type one_value: float :param ranges: Classes, following th...
python
def reclassify_value(one_value, ranges): """This function will return the classified value according to ranges. The algorithm will return None if the continuous value has not any class. :param one_value: The continuous value to classify. :type one_value: float :param ranges: Classes, following th...
[ "def", "reclassify_value", "(", "one_value", ",", "ranges", ")", ":", "if", "(", "one_value", "is", "None", "or", "(", "hasattr", "(", "one_value", ",", "'isNull'", ")", "and", "one_value", ".", "isNull", "(", ")", ")", ")", ":", "return", "None", "for...
This function will return the classified value according to ranges. The algorithm will return None if the continuous value has not any class. :param one_value: The continuous value to classify. :type one_value: float :param ranges: Classes, following the hazard classification definitions. :type r...
[ "This", "function", "will", "return", "the", "classified", "value", "according", "to", "ranges", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/tools.py#L90-L130
train
27,002
inasafe/inasafe
safe/gis/tools.py
decode_full_layer_uri
def decode_full_layer_uri(full_layer_uri_string): """Decode the full layer URI. :param full_layer_uri_string: The full URI provided by our helper. :type full_layer_uri_string: basestring :return: A tuple with the QGIS URI and the provider key. :rtype: tuple """ if not full_layer_uri_string...
python
def decode_full_layer_uri(full_layer_uri_string): """Decode the full layer URI. :param full_layer_uri_string: The full URI provided by our helper. :type full_layer_uri_string: basestring :return: A tuple with the QGIS URI and the provider key. :rtype: tuple """ if not full_layer_uri_string...
[ "def", "decode_full_layer_uri", "(", "full_layer_uri_string", ")", ":", "if", "not", "full_layer_uri_string", ":", "return", "None", ",", "None", "split", "=", "full_layer_uri_string", ".", "split", "(", "'|qgis_provider='", ")", "if", "len", "(", "split", ")", ...
Decode the full layer URI. :param full_layer_uri_string: The full URI provided by our helper. :type full_layer_uri_string: basestring :return: A tuple with the QGIS URI and the provider key. :rtype: tuple
[ "Decode", "the", "full", "layer", "URI", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/tools.py#L147-L163
train
27,003
inasafe/inasafe
safe/gis/tools.py
load_layer
def load_layer(full_layer_uri_string, name=None, provider=None): """Helper to load and return a single QGIS layer based on our layer URI. :param provider: The provider name to use if known to open the layer. Default to None, we will try to guess it, but it's much better if you can provide it. ...
python
def load_layer(full_layer_uri_string, name=None, provider=None): """Helper to load and return a single QGIS layer based on our layer URI. :param provider: The provider name to use if known to open the layer. Default to None, we will try to guess it, but it's much better if you can provide it. ...
[ "def", "load_layer", "(", "full_layer_uri_string", ",", "name", "=", "None", ",", "provider", "=", "None", ")", ":", "if", "provider", ":", "# Cool !", "layer_path", "=", "full_layer_uri_string", "else", ":", "# Let's check if the driver is included in the path", "la...
Helper to load and return a single QGIS layer based on our layer URI. :param provider: The provider name to use if known to open the layer. Default to None, we will try to guess it, but it's much better if you can provide it. :type provider: :param name: The name of the layer. If not provi...
[ "Helper", "to", "load", "and", "return", "a", "single", "QGIS", "layer", "based", "on", "our", "layer", "URI", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/tools.py#L166-L249
train
27,004
inasafe/inasafe
safe/gis/tools.py
load_layer_with_provider
def load_layer_with_provider(layer_uri, provider, layer_name='tmp'): """Load a layer with a specific driver. :param layer_uri: Layer URI that will be used by QGIS to load the layer. :type layer_uri: basestring :param provider: Provider name to use. :type provider: basestring :param layer_name...
python
def load_layer_with_provider(layer_uri, provider, layer_name='tmp'): """Load a layer with a specific driver. :param layer_uri: Layer URI that will be used by QGIS to load the layer. :type layer_uri: basestring :param provider: Provider name to use. :type provider: basestring :param layer_name...
[ "def", "load_layer_with_provider", "(", "layer_uri", ",", "provider", ",", "layer_name", "=", "'tmp'", ")", ":", "if", "provider", "in", "RASTER_DRIVERS", ":", "return", "QgsRasterLayer", "(", "layer_uri", ",", "layer_name", ",", "provider", ")", "elif", "provid...
Load a layer with a specific driver. :param layer_uri: Layer URI that will be used by QGIS to load the layer. :type layer_uri: basestring :param provider: Provider name to use. :type provider: basestring :param layer_name: Layer name to use. Default to 'tmp'. :type layer_name: basestring ...
[ "Load", "a", "layer", "with", "a", "specific", "driver", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/tools.py#L252-L272
train
27,005
inasafe/inasafe
safe/gis/tools.py
load_layer_without_provider
def load_layer_without_provider(layer_uri, layer_name='tmp'): """Helper to load a layer when don't know the driver. Don't use it, it's an empiric function to try each provider one per one. OGR/GDAL is printing a lot of error saying that the layer is not valid. :param layer_uri: Layer URI that will be...
python
def load_layer_without_provider(layer_uri, layer_name='tmp'): """Helper to load a layer when don't know the driver. Don't use it, it's an empiric function to try each provider one per one. OGR/GDAL is printing a lot of error saying that the layer is not valid. :param layer_uri: Layer URI that will be...
[ "def", "load_layer_without_provider", "(", "layer_uri", ",", "layer_name", "=", "'tmp'", ")", ":", "# Let's try the most common vector driver", "layer", "=", "QgsVectorLayer", "(", "layer_uri", ",", "layer_name", ",", "VECTOR_DRIVERS", "[", "0", "]", ")", "if", "lay...
Helper to load a layer when don't know the driver. Don't use it, it's an empiric function to try each provider one per one. OGR/GDAL is printing a lot of error saying that the layer is not valid. :param layer_uri: Layer URI that will be used by QGIS to load the layer. :type layer_uri: basestring ...
[ "Helper", "to", "load", "a", "layer", "when", "don", "t", "know", "the", "driver", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/tools.py#L275-L318
train
27,006
inasafe/inasafe
safe/gis/vector/clip.py
clip
def clip(layer_to_clip, mask_layer): """Clip a vector layer with another. Issue https://github.com/inasafe/inasafe/issues/3186 :param layer_to_clip: The vector layer to clip. :type layer_to_clip: QgsVectorLayer :param mask_layer: The vector layer to use for clipping. :type mask_layer: QgsVect...
python
def clip(layer_to_clip, mask_layer): """Clip a vector layer with another. Issue https://github.com/inasafe/inasafe/issues/3186 :param layer_to_clip: The vector layer to clip. :type layer_to_clip: QgsVectorLayer :param mask_layer: The vector layer to use for clipping. :type mask_layer: QgsVect...
[ "def", "clip", "(", "layer_to_clip", ",", "mask_layer", ")", ":", "output_layer_name", "=", "clip_steps", "[", "'output_layer_name'", "]", "output_layer_name", "=", "output_layer_name", "%", "(", "layer_to_clip", ".", "keywords", "[", "'layer_purpose'", "]", ")", ...
Clip a vector layer with another. Issue https://github.com/inasafe/inasafe/issues/3186 :param layer_to_clip: The vector layer to clip. :type layer_to_clip: QgsVectorLayer :param mask_layer: The vector layer to use for clipping. :type mask_layer: QgsVectorLayer :return: The clip vector layer....
[ "Clip", "a", "vector", "layer", "with", "another", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/clip.py#L23-L63
train
27,007
inasafe/inasafe
safe/utilities/osm_downloader.py
download
def download( feature_type, output_base_path, extent, progress_dialog=None, server_url=None): """Download shapefiles from Kartoza server. .. versionadded:: 3.2 :param feature_type: What kind of features should be downloaded. Currently 'buildings', 'building-...
python
def download( feature_type, output_base_path, extent, progress_dialog=None, server_url=None): """Download shapefiles from Kartoza server. .. versionadded:: 3.2 :param feature_type: What kind of features should be downloaded. Currently 'buildings', 'building-...
[ "def", "download", "(", "feature_type", ",", "output_base_path", ",", "extent", ",", "progress_dialog", "=", "None", ",", "server_url", "=", "None", ")", ":", "if", "not", "server_url", ":", "server_url", "=", "PRODUCTION_SERVER", "# preparing necessary data", "mi...
Download shapefiles from Kartoza server. .. versionadded:: 3.2 :param feature_type: What kind of features should be downloaded. Currently 'buildings', 'building-points' or 'roads' are supported. :type feature_type: str :param output_base_path: The base path of the shape file. :type output...
[ "Download", "shapefiles", "from", "Kartoza", "server", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/osm_downloader.py#L28-L98
train
27,008
inasafe/inasafe
safe/utilities/osm_downloader.py
fetch_zip
def fetch_zip(url, output_path, feature_type, progress_dialog=None): """Download zip containing shp file and write to output_path. .. versionadded:: 3.2 :param url: URL of the zip bundle. :type url: str :param output_path: Path of output file, :type output_path: str :param feature_type: ...
python
def fetch_zip(url, output_path, feature_type, progress_dialog=None): """Download zip containing shp file and write to output_path. .. versionadded:: 3.2 :param url: URL of the zip bundle. :type url: str :param output_path: Path of output file, :type output_path: str :param feature_type: ...
[ "def", "fetch_zip", "(", "url", ",", "output_path", ",", "feature_type", ",", "progress_dialog", "=", "None", ")", ":", "LOGGER", ".", "debug", "(", "'Downloading file from URL: %s'", "%", "url", ")", "LOGGER", ".", "debug", "(", "'Downloading to: %s'", "%", "...
Download zip containing shp file and write to output_path. .. versionadded:: 3.2 :param url: URL of the zip bundle. :type url: str :param output_path: Path of output file, :type output_path: str :param feature_type: What kind of features should be downloaded. Currently 'buildings', '...
[ "Download", "zip", "containing", "shp", "file", "and", "write", "to", "output_path", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/osm_downloader.py#L101-L152
train
27,009
inasafe/inasafe
safe/utilities/osm_downloader.py
extract_zip
def extract_zip(zip_path, destination_base_path): """Extract different extensions to the destination base path. Example : test.zip contains a.shp, a.dbf, a.prj and destination_base_path = '/tmp/CT-buildings Expected result : - /tmp/CT-buildings.shp - /tmp/CT-buildings.dbf - /tmp...
python
def extract_zip(zip_path, destination_base_path): """Extract different extensions to the destination base path. Example : test.zip contains a.shp, a.dbf, a.prj and destination_base_path = '/tmp/CT-buildings Expected result : - /tmp/CT-buildings.shp - /tmp/CT-buildings.dbf - /tmp...
[ "def", "extract_zip", "(", "zip_path", ",", "destination_base_path", ")", ":", "handle", "=", "open", "(", "zip_path", ",", "'rb'", ")", "zip_file", "=", "zipfile", ".", "ZipFile", "(", "handle", ")", "for", "name", "in", "zip_file", ".", "namelist", "(", ...
Extract different extensions to the destination base path. Example : test.zip contains a.shp, a.dbf, a.prj and destination_base_path = '/tmp/CT-buildings Expected result : - /tmp/CT-buildings.shp - /tmp/CT-buildings.dbf - /tmp/CT-buildings.prj If two files in the zip with the s...
[ "Extract", "different", "extensions", "to", "the", "destination", "base", "path", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/osm_downloader.py#L155-L189
train
27,010
inasafe/inasafe
safe/gui/tools/wizard/utilities.py
get_question_text
def get_question_text(constant): """Find a constant by name and return its value. :param constant: The name of the constant to look for. :type constant: string :returns: The value of the constant or red error message. :rtype: string """ if constant in dir(safe.gui.tools.wizard.wizard_strin...
python
def get_question_text(constant): """Find a constant by name and return its value. :param constant: The name of the constant to look for. :type constant: string :returns: The value of the constant or red error message. :rtype: string """ if constant in dir(safe.gui.tools.wizard.wizard_strin...
[ "def", "get_question_text", "(", "constant", ")", ":", "if", "constant", "in", "dir", "(", "safe", ".", "gui", ".", "tools", ".", "wizard", ".", "wizard_strings", ")", ":", "return", "getattr", "(", "safe", ".", "gui", ".", "tools", ".", "wizard", ".",...
Find a constant by name and return its value. :param constant: The name of the constant to look for. :type constant: string :returns: The value of the constant or red error message. :rtype: string
[ "Find", "a", "constant", "by", "name", "and", "return", "its", "value", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/utilities.py#L45-L57
train
27,011
inasafe/inasafe
safe/gui/tools/wizard/utilities.py
layers_intersect
def layers_intersect(layer_a, layer_b): """Check if extents of two layers intersect. :param layer_a: One of the two layers to test overlapping :type layer_a: QgsMapLayer :param layer_b: The second of the two layers to test overlapping :type layer_b: QgsMapLayer :returns: true if the layers in...
python
def layers_intersect(layer_a, layer_b): """Check if extents of two layers intersect. :param layer_a: One of the two layers to test overlapping :type layer_a: QgsMapLayer :param layer_b: The second of the two layers to test overlapping :type layer_b: QgsMapLayer :returns: true if the layers in...
[ "def", "layers_intersect", "(", "layer_a", ",", "layer_b", ")", ":", "extent_a", "=", "layer_a", ".", "extent", "(", ")", "extent_b", "=", "layer_b", ".", "extent", "(", ")", "if", "layer_a", ".", "crs", "(", ")", "!=", "layer_b", ".", "crs", "(", ")...
Check if extents of two layers intersect. :param layer_a: One of the two layers to test overlapping :type layer_a: QgsMapLayer :param layer_b: The second of the two layers to test overlapping :type layer_b: QgsMapLayer :returns: true if the layers intersect, false if they are disjoint :rtype:...
[ "Check", "if", "extents", "of", "two", "layers", "intersect", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/utilities.py#L60-L79
train
27,012
inasafe/inasafe
safe/gui/tools/wizard/utilities.py
get_inasafe_default_value_fields
def get_inasafe_default_value_fields(qsetting, field_key): """Obtain default value for a field with default value. By default it will return label list and default value list label: [Setting, Do not report, Custom] values: [Value from setting, None, Value from QSetting (if exist)] :param qsetting:...
python
def get_inasafe_default_value_fields(qsetting, field_key): """Obtain default value for a field with default value. By default it will return label list and default value list label: [Setting, Do not report, Custom] values: [Value from setting, None, Value from QSetting (if exist)] :param qsetting:...
[ "def", "get_inasafe_default_value_fields", "(", "qsetting", ",", "field_key", ")", ":", "labels", "=", "[", "tr", "(", "'Global (%s)'", ")", ",", "tr", "(", "'Do not report'", ")", ",", "tr", "(", "'Custom'", ")", "]", "values", "=", "[", "get_inasafe_defaul...
Obtain default value for a field with default value. By default it will return label list and default value list label: [Setting, Do not report, Custom] values: [Value from setting, None, Value from QSetting (if exist)] :param qsetting: QSetting object :type qsetting: QSetting :param field_ke...
[ "Obtain", "default", "value", "for", "a", "field", "with", "default", "value", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/utilities.py#L173-L195
train
27,013
inasafe/inasafe
safe/gui/tools/wizard/utilities.py
clear_layout
def clear_layout(layout): """Clear layout content. :param layout: A layout. :type layout: QLayout """ # 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.coun...
python
def clear_layout(layout): """Clear layout content. :param layout: A layout. :type layout: QLayout """ # 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.coun...
[ "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", "(", ")"...
Clear layout content. :param layout: A layout. :type layout: QLayout
[ "Clear", "layout", "content", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/utilities.py#L198-L221
train
27,014
inasafe/inasafe
safe/gui/tools/wizard/utilities.py
skip_inasafe_field
def skip_inasafe_field(layer, inasafe_fields): """Check if it possible to skip inasafe field step. The function will check if the layer has a specified field type. :param layer: A Qgis Vector Layer. :type layer: QgsVectorLayer :param inasafe_fields: List of non compulsory InaSAFE fields default. ...
python
def skip_inasafe_field(layer, inasafe_fields): """Check if it possible to skip inasafe field step. The function will check if the layer has a specified field type. :param layer: A Qgis Vector Layer. :type layer: QgsVectorLayer :param inasafe_fields: List of non compulsory InaSAFE fields default. ...
[ "def", "skip_inasafe_field", "(", "layer", ",", "inasafe_fields", ")", ":", "# Iterate through all inasafe fields", "for", "inasafe_field", "in", "inasafe_fields", ":", "for", "field", "in", "layer", ".", "fields", "(", ")", ":", "# Check the field type", "if", "isi...
Check if it possible to skip inasafe field step. The function will check if the layer has a specified field type. :param layer: A Qgis Vector Layer. :type layer: QgsVectorLayer :param inasafe_fields: List of non compulsory InaSAFE fields default. :type inasafe_fields: list :returns: True if ...
[ "Check", "if", "it", "possible", "to", "skip", "inasafe", "field", "step", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/utilities.py#L224-L248
train
27,015
inasafe/inasafe
safe/gui/tools/wizard/utilities.py
get_image_path
def get_image_path(definition): """Helper to get path of image from a definition in resource directory. :param definition: A definition (hazard, exposure). :type definition: dict :returns: The definition's image path. :rtype: str """ path = resources_path( 'img', 'wizard', 'keyword...
python
def get_image_path(definition): """Helper to get path of image from a definition in resource directory. :param definition: A definition (hazard, exposure). :type definition: dict :returns: The definition's image path. :rtype: str """ path = resources_path( 'img', 'wizard', 'keyword...
[ "def", "get_image_path", "(", "definition", ")", ":", "path", "=", "resources_path", "(", "'img'", ",", "'wizard'", ",", "'keyword-subcategory-%s.svg'", "%", "definition", "[", "'key'", "]", ")", "if", "os", ".", "path", ".", "exists", "(", "path", ")", ":...
Helper to get path of image from a definition in resource directory. :param definition: A definition (hazard, exposure). :type definition: dict :returns: The definition's image path. :rtype: str
[ "Helper", "to", "get", "path", "of", "image", "from", "a", "definition", "in", "resource", "directory", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/utilities.py#L251-L265
train
27,016
inasafe/inasafe
safe/gis/vector/recompute_counts.py
recompute_counts
def recompute_counts(layer): """Recompute counts according to the size field and the new size. This function will also take care of updating the size field. The size post processor won't run after this function again. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The la...
python
def recompute_counts(layer): """Recompute counts according to the size field and the new size. This function will also take care of updating the size field. The size post processor won't run after this function again. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The la...
[ "def", "recompute_counts", "(", "layer", ")", ":", "output_layer_name", "=", "recompute_counts_steps", "[", "'output_layer_name'", "]", "fields", "=", "layer", ".", "keywords", "[", "'inasafe_fields'", "]", "if", "size_field", "[", "'key'", "]", "not", "in", "fi...
Recompute counts according to the size field and the new size. This function will also take care of updating the size field. The size post processor won't run after this function again. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The layer with updated counts. :rtype:...
[ "Recompute", "counts", "according", "to", "the", "size", "field", "and", "the", "new", "size", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/recompute_counts.py#L28-L99
train
27,017
inasafe/inasafe
safe/gis/vector/summary_5_multi_exposure.py
multi_exposure_aggregation_summary
def multi_exposure_aggregation_summary(aggregation, intermediate_layers): """Merge intermediate aggregations into one aggregation summary. Source layer : | aggr_id | aggr_name | count of affected features per exposure type Target layer : | aggregation_id | aggregation_name | Output layer : ...
python
def multi_exposure_aggregation_summary(aggregation, intermediate_layers): """Merge intermediate aggregations into one aggregation summary. Source layer : | aggr_id | aggr_name | count of affected features per exposure type Target layer : | aggregation_id | aggregation_name | Output layer : ...
[ "def", "multi_exposure_aggregation_summary", "(", "aggregation", ",", "intermediate_layers", ")", ":", "target_index_field_name", "=", "(", "aggregation", ".", "keywords", "[", "'inasafe_fields'", "]", "[", "aggregation_id_field", "[", "'key'", "]", "]", ")", "aggrega...
Merge intermediate aggregations into one aggregation summary. Source layer : | aggr_id | aggr_name | count of affected features per exposure type Target layer : | aggregation_id | aggregation_name | Output layer : | aggr_id | aggr_name | count of affected per exposure type for each :para...
[ "Merge", "intermediate", "aggregations", "into", "one", "aggregation", "summary", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/summary_5_multi_exposure.py#L180-L291
train
27,018
inasafe/inasafe
safe/gui/tools/shake_grid/shakemap_converter_dialog.py
ShakemapConverterDialog.on_output_path_textChanged
def on_output_path_textChanged(self): """Action when output file name is changed.""" output_path = self.output_path.text() output_not_xml_msg = tr('output file is not .tif') if output_path and not output_path.endswith('.tif'): self.warning_text.add(output_not_xml_msg) ...
python
def on_output_path_textChanged(self): """Action when output file name is changed.""" output_path = self.output_path.text() output_not_xml_msg = tr('output file is not .tif') if output_path and not output_path.endswith('.tif'): self.warning_text.add(output_not_xml_msg) ...
[ "def", "on_output_path_textChanged", "(", "self", ")", ":", "output_path", "=", "self", ".", "output_path", ".", "text", "(", ")", "output_not_xml_msg", "=", "tr", "(", "'output file is not .tif'", ")", "if", "output_path", "and", "not", "output_path", ".", "end...
Action when output file name is changed.
[ "Action", "when", "output", "file", "name", "is", "changed", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/shake_grid/shakemap_converter_dialog.py#L144-L152
train
27,019
inasafe/inasafe
safe/gui/tools/shake_grid/shakemap_converter_dialog.py
ShakemapConverterDialog.on_input_path_textChanged
def on_input_path_textChanged(self): """Action when input file name is changed.""" input_path = self.input_path.text() input_not_grid_msg = tr('input file is not .xml') if input_path and not input_path.endswith('.xml'): self.warning_text.add(input_not_grid_msg) elif ...
python
def on_input_path_textChanged(self): """Action when input file name is changed.""" input_path = self.input_path.text() input_not_grid_msg = tr('input file is not .xml') if input_path and not input_path.endswith('.xml'): self.warning_text.add(input_not_grid_msg) elif ...
[ "def", "on_input_path_textChanged", "(", "self", ")", ":", "input_path", "=", "self", ".", "input_path", ".", "text", "(", ")", "input_not_grid_msg", "=", "tr", "(", "'input file is not .xml'", ")", "if", "input_path", "and", "not", "input_path", ".", "endswith"...
Action when input file name is changed.
[ "Action", "when", "input", "file", "name", "is", "changed", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/shake_grid/shakemap_converter_dialog.py#L155-L167
train
27,020
inasafe/inasafe
safe/gui/tools/shake_grid/shakemap_converter_dialog.py
ShakemapConverterDialog.prepare_place_layer
def prepare_place_layer(self): """Action when input place layer name is changed.""" if os.path.exists(self.input_place.text()): self.place_layer = QgsVectorLayer( self.input_place.text(), tr('Nearby Cities'), 'ogr' ) if ...
python
def prepare_place_layer(self): """Action when input place layer name is changed.""" if os.path.exists(self.input_place.text()): self.place_layer = QgsVectorLayer( self.input_place.text(), tr('Nearby Cities'), 'ogr' ) if ...
[ "def", "prepare_place_layer", "(", "self", ")", ":", "if", "os", ".", "path", ".", "exists", "(", "self", ".", "input_place", ".", "text", "(", ")", ")", ":", "self", ".", "place_layer", "=", "QgsVectorLayer", "(", "self", ".", "input_place", ".", "tex...
Action when input place layer name is changed.
[ "Action", "when", "input", "place", "layer", "name", "is", "changed", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/shake_grid/shakemap_converter_dialog.py#L170-L183
train
27,021
inasafe/inasafe
safe/gui/tools/shake_grid/shakemap_converter_dialog.py
ShakemapConverterDialog.get_output_from_input
def get_output_from_input(self): """Create default output location based on input location.""" input_path = self.input_path.text() if input_path.endswith('.xml'): output_path = input_path[:-3] + 'tif' elif input_path == '': output_path = '' else: ...
python
def get_output_from_input(self): """Create default output location based on input location.""" input_path = self.input_path.text() if input_path.endswith('.xml'): output_path = input_path[:-3] + 'tif' elif input_path == '': output_path = '' else: ...
[ "def", "get_output_from_input", "(", "self", ")", ":", "input_path", "=", "self", ".", "input_path", ".", "text", "(", ")", "if", "input_path", ".", "endswith", "(", "'.xml'", ")", ":", "output_path", "=", "input_path", "[", ":", "-", "3", "]", "+", "'...
Create default output location based on input location.
[ "Create", "default", "output", "location", "based", "on", "input", "location", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/shake_grid/shakemap_converter_dialog.py#L207-L220
train
27,022
inasafe/inasafe
safe/gui/tools/shake_grid/shakemap_converter_dialog.py
ShakemapConverterDialog.accept
def accept(self): """Handler for when OK is clicked.""" input_path = self.input_path.text() input_title = self.line_edit_title.text() input_source = self.line_edit_source.text() output_path = self.output_path.text() if not output_path.endswith('.tif'): # noins...
python
def accept(self): """Handler for when OK is clicked.""" input_path = self.input_path.text() input_title = self.line_edit_title.text() input_source = self.line_edit_source.text() output_path = self.output_path.text() if not output_path.endswith('.tif'): # noins...
[ "def", "accept", "(", "self", ")", ":", "input_path", "=", "self", ".", "input_path", ".", "text", "(", ")", "input_title", "=", "self", ".", "line_edit_title", ".", "text", "(", ")", "input_source", "=", "self", ".", "line_edit_source", ".", "text", "("...
Handler for when OK is clicked.
[ "Handler", "for", "when", "OK", "is", "clicked", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/shake_grid/shakemap_converter_dialog.py#L222-L306
train
27,023
inasafe/inasafe
safe/gui/tools/shake_grid/shakemap_converter_dialog.py
ShakemapConverterDialog.on_open_input_tool_clicked
def on_open_input_tool_clicked(self): """Autoconnect slot activated when open input tool button is clicked. """ input_path = self.input_path.text() if not input_path: input_path = os.path.expanduser('~') # noinspection PyCallByClass,PyTypeChecker filename, __ ...
python
def on_open_input_tool_clicked(self): """Autoconnect slot activated when open input tool button is clicked. """ input_path = self.input_path.text() if not input_path: input_path = os.path.expanduser('~') # noinspection PyCallByClass,PyTypeChecker filename, __ ...
[ "def", "on_open_input_tool_clicked", "(", "self", ")", ":", "input_path", "=", "self", ".", "input_path", ".", "text", "(", ")", "if", "not", "input_path", ":", "input_path", "=", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", "# noinspection PyCallB...
Autoconnect slot activated when open input tool button is clicked.
[ "Autoconnect", "slot", "activated", "when", "open", "input", "tool", "button", "is", "clicked", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/shake_grid/shakemap_converter_dialog.py#L309-L319
train
27,024
inasafe/inasafe
safe/gui/tools/shake_grid/shakemap_converter_dialog.py
ShakemapConverterDialog.on_open_output_tool_clicked
def on_open_output_tool_clicked(self): """Autoconnect slot activated when open output tool button is clicked. """ output_path = self.output_path.text() if not output_path: output_path = os.path.expanduser('~') # noinspection PyCallByClass,PyTypeChecker filenam...
python
def on_open_output_tool_clicked(self): """Autoconnect slot activated when open output tool button is clicked. """ output_path = self.output_path.text() if not output_path: output_path = os.path.expanduser('~') # noinspection PyCallByClass,PyTypeChecker filenam...
[ "def", "on_open_output_tool_clicked", "(", "self", ")", ":", "output_path", "=", "self", ".", "output_path", ".", "text", "(", ")", "if", "not", "output_path", ":", "output_path", "=", "os", ".", "path", ".", "expanduser", "(", "'~'", ")", "# noinspection Py...
Autoconnect slot activated when open output tool button is clicked.
[ "Autoconnect", "slot", "activated", "when", "open", "output", "tool", "button", "is", "clicked", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/shake_grid/shakemap_converter_dialog.py#L322-L332
train
27,025
inasafe/inasafe
safe/gui/tools/shake_grid/shakemap_converter_dialog.py
ShakemapConverterDialog.launch_keyword_wizard
def launch_keyword_wizard(self): """Launch keyword creation wizard.""" # make sure selected layer is the output layer if self.iface.activeLayer() != self.output_layer: return # launch wizard dialog keyword_wizard = WizardDialog( self.iface.mainWindow(), s...
python
def launch_keyword_wizard(self): """Launch keyword creation wizard.""" # make sure selected layer is the output layer if self.iface.activeLayer() != self.output_layer: return # launch wizard dialog keyword_wizard = WizardDialog( self.iface.mainWindow(), s...
[ "def", "launch_keyword_wizard", "(", "self", ")", ":", "# make sure selected layer is the output layer", "if", "self", ".", "iface", ".", "activeLayer", "(", ")", "!=", "self", ".", "output_layer", ":", "return", "# launch wizard dialog", "keyword_wizard", "=", "Wizar...
Launch keyword creation wizard.
[ "Launch", "keyword", "creation", "wizard", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/shake_grid/shakemap_converter_dialog.py#L388-L398
train
27,026
inasafe/inasafe
safe/gis/vector/union.py
union
def union(union_a, union_b): """Union of two vector layers. Issue https://github.com/inasafe/inasafe/issues/3186 :param union_a: The vector layer for the union. :type union_a: QgsVectorLayer :param union_b: The vector layer for the union. :type union_b: QgsVectorLayer :return: The clip v...
python
def union(union_a, union_b): """Union of two vector layers. Issue https://github.com/inasafe/inasafe/issues/3186 :param union_a: The vector layer for the union. :type union_a: QgsVectorLayer :param union_b: The vector layer for the union. :type union_b: QgsVectorLayer :return: The clip v...
[ "def", "union", "(", "union_a", ",", "union_b", ")", ":", "output_layer_name", "=", "union_steps", "[", "'output_layer_name'", "]", "output_layer_name", "=", "output_layer_name", "%", "(", "union_a", ".", "keywords", "[", "'layer_purpose'", "]", ",", "union_b", ...
Union of two vector layers. Issue https://github.com/inasafe/inasafe/issues/3186 :param union_a: The vector layer for the union. :type union_a: QgsVectorLayer :param union_b: The vector layer for the union. :type union_b: QgsVectorLayer :return: The clip vector layer. :rtype: QgsVectorLa...
[ "Union", "of", "two", "vector", "layers", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/union.py#L33-L90
train
27,027
inasafe/inasafe
safe/gis/vector/union.py
fill_hazard_class
def fill_hazard_class(layer): """We need to fill hazard class when it's empty. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The updated vector layer. :rtype: QgsVectorLayer .. versionadded:: 4.0 """ hazard_field = layer.keywords['inasafe_fields'][hazard_class_f...
python
def fill_hazard_class(layer): """We need to fill hazard class when it's empty. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The updated vector layer. :rtype: QgsVectorLayer .. versionadded:: 4.0 """ hazard_field = layer.keywords['inasafe_fields'][hazard_class_f...
[ "def", "fill_hazard_class", "(", "layer", ")", ":", "hazard_field", "=", "layer", ".", "keywords", "[", "'inasafe_fields'", "]", "[", "hazard_class_field", "[", "'key'", "]", "]", "expression", "=", "'\"%s\" is NULL OR \"%s\" = \\'\\''", "%", "(", "hazard_field", ...
We need to fill hazard class when it's empty. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The updated vector layer. :rtype: QgsVectorLayer .. versionadded:: 4.0
[ "We", "need", "to", "fill", "hazard", "class", "when", "it", "s", "empty", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/union.py#L94-L119
train
27,028
inasafe/inasafe
safe_extras/pydispatch/robustapply.py
function
def function( receiver ): """Get function-like callable object for given receiver returns (function_or_method, codeObject, fromMethod) If fromMethod is true, then the callable already has its first argument bound """ if hasattr(receiver, '__call__'): # Reassign receiver to the actual m...
python
def function( receiver ): """Get function-like callable object for given receiver returns (function_or_method, codeObject, fromMethod) If fromMethod is true, then the callable already has its first argument bound """ if hasattr(receiver, '__call__'): # Reassign receiver to the actual m...
[ "def", "function", "(", "receiver", ")", ":", "if", "hasattr", "(", "receiver", ",", "'__call__'", ")", ":", "# Reassign receiver to the actual method that will be called.", "if", "hasattr", "(", "receiver", ".", "__call__", ",", "im_func", ")", "or", "hasattr", "...
Get function-like callable object for given receiver returns (function_or_method, codeObject, fromMethod) If fromMethod is true, then the callable already has its first argument bound
[ "Get", "function", "-", "like", "callable", "object", "for", "given", "receiver" ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe_extras/pydispatch/robustapply.py#L20-L37
train
27,029
inasafe/inasafe
safe/gui/tools/print_report_dialog.py
PrintReportDialog.populate_template_combobox
def populate_template_combobox(self, path, unwanted_templates=None): """Helper method for populating template combobox. :param unwanted_templates: List of templates that isn't an option. :type unwanted_templates: list .. versionadded: 4.3.0 """ templates_dir = QtCore.QD...
python
def populate_template_combobox(self, path, unwanted_templates=None): """Helper method for populating template combobox. :param unwanted_templates: List of templates that isn't an option. :type unwanted_templates: list .. versionadded: 4.3.0 """ templates_dir = QtCore.QD...
[ "def", "populate_template_combobox", "(", "self", ",", "path", ",", "unwanted_templates", "=", "None", ")", ":", "templates_dir", "=", "QtCore", ".", "QDir", "(", "path", ")", "templates_dir", ".", "setFilter", "(", "QtCore", ".", "QDir", ".", "Files", "|", ...
Helper method for populating template combobox. :param unwanted_templates: List of templates that isn't an option. :type unwanted_templates: list .. versionadded: 4.3.0
[ "Helper", "method", "for", "populating", "template", "combobox", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/print_report_dialog.py#L217-L240
train
27,030
inasafe/inasafe
safe/gui/tools/print_report_dialog.py
PrintReportDialog.retrieve_paths
def retrieve_paths(self, products, report_path, suffix=None): """Helper method to retrieve path from particular report metadata. :param products: Report products. :type products: list :param report_path: Path of the IF output. :type report_path: str :param suffix: Expe...
python
def retrieve_paths(self, products, report_path, suffix=None): """Helper method to retrieve path from particular report metadata. :param products: Report products. :type products: list :param report_path: Path of the IF output. :type report_path: str :param suffix: Expe...
[ "def", "retrieve_paths", "(", "self", ",", "products", ",", "report_path", ",", "suffix", "=", "None", ")", ":", "paths", "=", "[", "]", "for", "product", "in", "products", ":", "path", "=", "ImpactReport", ".", "absolute_output_path", "(", "join", "(", ...
Helper method to retrieve path from particular report metadata. :param products: Report products. :type products: list :param report_path: Path of the IF output. :type report_path: str :param suffix: Expected output product file type (extension). :type suffix: str ...
[ "Helper", "method", "to", "retrieve", "path", "from", "particular", "report", "metadata", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/print_report_dialog.py#L286-L319
train
27,031
inasafe/inasafe
safe/gui/tools/print_report_dialog.py
PrintReportDialog.open_as_pdf
def open_as_pdf(self): """Print the selected report as a PDF product. .. versionadded: 4.3.0 """ # Get output path from datastore report_urls_dict = report_urls(self.impact_function) # get report urls for each product tag as list for key, value in list(report_ur...
python
def open_as_pdf(self): """Print the selected report as a PDF product. .. versionadded: 4.3.0 """ # Get output path from datastore report_urls_dict = report_urls(self.impact_function) # get report urls for each product tag as list for key, value in list(report_ur...
[ "def", "open_as_pdf", "(", "self", ")", ":", "# Get output path from datastore", "report_urls_dict", "=", "report_urls", "(", "self", ".", "impact_function", ")", "# get report urls for each product tag as list", "for", "key", ",", "value", "in", "list", "(", "report_ur...
Print the selected report as a PDF product. .. versionadded: 4.3.0
[ "Print", "the", "selected", "report", "as", "a", "PDF", "product", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/print_report_dialog.py#L321-L366
train
27,032
inasafe/inasafe
safe/gui/tools/print_report_dialog.py
PrintReportDialog.open_in_composer
def open_in_composer(self): """Open in layout designer a given MapReport instance. .. versionadded: 4.3.0 """ impact_layer = self.impact_function.analysis_impacted report_path = dirname(impact_layer.source()) impact_report = self.impact_function.impact_report cu...
python
def open_in_composer(self): """Open in layout designer a given MapReport instance. .. versionadded: 4.3.0 """ impact_layer = self.impact_function.analysis_impacted report_path = dirname(impact_layer.source()) impact_report = self.impact_function.impact_report cu...
[ "def", "open_in_composer", "(", "self", ")", ":", "impact_layer", "=", "self", ".", "impact_function", ".", "analysis_impacted", "report_path", "=", "dirname", "(", "impact_layer", ".", "source", "(", ")", ")", "impact_report", "=", "self", ".", "impact_function...
Open in layout designer a given MapReport instance. .. versionadded: 4.3.0
[ "Open", "in", "layout", "designer", "a", "given", "MapReport", "instance", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/print_report_dialog.py#L368-L409
train
27,033
inasafe/inasafe
safe/gui/tools/print_report_dialog.py
PrintReportDialog.prepare_components
def prepare_components(self): """Prepare components that are going to be generated based on user options. :return: Updated list of components. :rtype: dict """ # Register the components based on user option # First, tabular report generated_components = d...
python
def prepare_components(self): """Prepare components that are going to be generated based on user options. :return: Updated list of components. :rtype: dict """ # Register the components based on user option # First, tabular report generated_components = d...
[ "def", "prepare_components", "(", "self", ")", ":", "# Register the components based on user option", "# First, tabular report", "generated_components", "=", "deepcopy", "(", "all_default_report_components", ")", "# Rohmat: I need to define the definitions here, I can't get", "# the de...
Prepare components that are going to be generated based on user options. :return: Updated list of components. :rtype: dict
[ "Prepare", "components", "that", "are", "going", "to", "be", "generated", "based", "on", "user", "options", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/print_report_dialog.py#L411-L503
train
27,034
inasafe/inasafe
safe/gui/tools/print_report_dialog.py
PrintReportDialog.template_chooser_clicked
def template_chooser_clicked(self): """Slot activated when report file tool button is clicked. .. versionadded: 4.3.0 """ path = self.template_path.text() if not path: path = setting('lastCustomTemplate', '', str) if path: directory = dirname(path...
python
def template_chooser_clicked(self): """Slot activated when report file tool button is clicked. .. versionadded: 4.3.0 """ path = self.template_path.text() if not path: path = setting('lastCustomTemplate', '', str) if path: directory = dirname(path...
[ "def", "template_chooser_clicked", "(", "self", ")", ":", "path", "=", "self", ".", "template_path", ".", "text", "(", ")", "if", "not", "path", ":", "path", "=", "setting", "(", "'lastCustomTemplate'", ",", "''", ",", "str", ")", "if", "path", ":", "d...
Slot activated when report file tool button is clicked. .. versionadded: 4.3.0
[ "Slot", "activated", "when", "report", "file", "tool", "button", "is", "clicked", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/print_report_dialog.py#L539-L557
train
27,035
inasafe/inasafe
safe/gui/tools/print_report_dialog.py
PrintReportDialog.toggle_template_selector
def toggle_template_selector(self): """Slot for template selector elements behaviour. .. versionadded: 4.3.0 """ if self.search_directory_radio.isChecked(): self.template_combo.setEnabled(True) else: self.template_combo.setEnabled(False) if self....
python
def toggle_template_selector(self): """Slot for template selector elements behaviour. .. versionadded: 4.3.0 """ if self.search_directory_radio.isChecked(): self.template_combo.setEnabled(True) else: self.template_combo.setEnabled(False) if self....
[ "def", "toggle_template_selector", "(", "self", ")", ":", "if", "self", ".", "search_directory_radio", ".", "isChecked", "(", ")", ":", "self", ".", "template_combo", ".", "setEnabled", "(", "True", ")", "else", ":", "self", ".", "template_combo", ".", "setE...
Slot for template selector elements behaviour. .. versionadded: 4.3.0
[ "Slot", "for", "template", "selector", "elements", "behaviour", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/print_report_dialog.py#L559-L574
train
27,036
inasafe/inasafe
safe/gui/tools/print_report_dialog.py
PrintReportDialog.show_help
def show_help(self): """Show usage info to the user. .. versionadded: 4.3.0 """ # Read the header and footer html snippets self.main_stacked_widget.setCurrentIndex(0) header = html_header() footer = html_footer() string = header message = impact...
python
def show_help(self): """Show usage info to the user. .. versionadded: 4.3.0 """ # Read the header and footer html snippets self.main_stacked_widget.setCurrentIndex(0) header = html_header() footer = html_footer() string = header message = impact...
[ "def", "show_help", "(", "self", ")", ":", "# Read the header and footer html snippets", "self", ".", "main_stacked_widget", ".", "setCurrentIndex", "(", "0", ")", "header", "=", "html_header", "(", ")", "footer", "=", "html_footer", "(", ")", "string", "=", "he...
Show usage info to the user. .. versionadded: 4.3.0
[ "Show", "usage", "info", "to", "the", "user", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/print_report_dialog.py#L598-L615
train
27,037
inasafe/inasafe
safe/definitions/messages.py
limitations
def limitations(): """Get InaSAFE limitations. :return: All limitations on current InaSAFE. :rtype: list """ limitation_list = list() limitation_list.append(tr('InaSAFE is not a hazard modelling tool.')) limitation_list.append( tr('InaSAFE is a Free and Open Source Software (FOSS) p...
python
def limitations(): """Get InaSAFE limitations. :return: All limitations on current InaSAFE. :rtype: list """ limitation_list = list() limitation_list.append(tr('InaSAFE is not a hazard modelling tool.')) limitation_list.append( tr('InaSAFE is a Free and Open Source Software (FOSS) p...
[ "def", "limitations", "(", ")", ":", "limitation_list", "=", "list", "(", ")", "limitation_list", ".", "append", "(", "tr", "(", "'InaSAFE is not a hazard modelling tool.'", ")", ")", "limitation_list", ".", "append", "(", "tr", "(", "'InaSAFE is a Free and Open Sou...
Get InaSAFE limitations. :return: All limitations on current InaSAFE. :rtype: list
[ "Get", "InaSAFE", "limitations", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/definitions/messages.py#L27-L45
train
27,038
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.update_helper_political_level
def update_helper_political_level(self): """To update the helper about the country and the admin_level.""" current_country = self.country_comboBox.currentText() index = self.admin_level_comboBox.currentIndex() current_level = self.admin_level_comboBox.itemData(index) content = No...
python
def update_helper_political_level(self): """To update the helper about the country and the admin_level.""" current_country = self.country_comboBox.currentText() index = self.admin_level_comboBox.currentIndex() current_level = self.admin_level_comboBox.itemData(index) content = No...
[ "def", "update_helper_political_level", "(", "self", ")", ":", "current_country", "=", "self", ".", "country_comboBox", ".", "currentText", "(", ")", "index", "=", "self", ".", "admin_level_comboBox", ".", "currentIndex", "(", ")", "current_level", "=", "self", ...
To update the helper about the country and the admin_level.
[ "To", "update", "the", "helper", "about", "the", "country", "and", "the", "admin_level", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L140-L155
train
27,039
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.populate_countries
def populate_countries(self): """Populate the combobox about countries and levels.""" for i in range(1, 12): self.admin_level_comboBox.addItem(self.tr('Level %s') % i, i) # Set current index to admin_level 8, the most common one self.admin_level_comboBox.setCurrentIndex(7) ...
python
def populate_countries(self): """Populate the combobox about countries and levels.""" for i in range(1, 12): self.admin_level_comboBox.addItem(self.tr('Level %s') % i, i) # Set current index to admin_level 8, the most common one self.admin_level_comboBox.setCurrentIndex(7) ...
[ "def", "populate_countries", "(", "self", ")", ":", "for", "i", "in", "range", "(", "1", ",", "12", ")", ":", "self", ".", "admin_level_comboBox", ".", "addItem", "(", "self", ".", "tr", "(", "'Level %s'", ")", "%", "i", ",", "i", ")", "# Set current...
Populate the combobox about countries and levels.
[ "Populate", "the", "combobox", "about", "countries", "and", "levels", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L157-L178
train
27,040
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.update_extent
def update_extent(self, extent): """Update extent value in GUI based from an extent. :param extent: A list in the form [xmin, ymin, xmax, ymax] where all coordinates provided are in Geographic / EPSG:4326. :type extent: list """ self.x_minimum.setValue(extent[0]) ...
python
def update_extent(self, extent): """Update extent value in GUI based from an extent. :param extent: A list in the form [xmin, ymin, xmax, ymax] where all coordinates provided are in Geographic / EPSG:4326. :type extent: list """ self.x_minimum.setValue(extent[0]) ...
[ "def", "update_extent", "(", "self", ",", "extent", ")", ":", "self", ".", "x_minimum", ".", "setValue", "(", "extent", "[", "0", "]", ")", "self", ".", "y_minimum", ".", "setValue", "(", "extent", "[", "1", "]", ")", "self", ".", "x_maximum", ".", ...
Update extent value in GUI based from an extent. :param extent: A list in the form [xmin, ymin, xmax, ymax] where all coordinates provided are in Geographic / EPSG:4326. :type extent: list
[ "Update", "extent", "value", "in", "GUI", "based", "from", "an", "extent", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L226-L254
train
27,041
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.update_extent_from_map_canvas
def update_extent_from_map_canvas(self): """Update extent value in GUI based from value in map. .. note:: Delegates to update_extent() """ self.bounding_box_group.setTitle( self.tr('Bounding box from the map canvas')) # Get the extent as [xmin, ymin, xmax, ymax] ...
python
def update_extent_from_map_canvas(self): """Update extent value in GUI based from value in map. .. note:: Delegates to update_extent() """ self.bounding_box_group.setTitle( self.tr('Bounding box from the map canvas')) # Get the extent as [xmin, ymin, xmax, ymax] ...
[ "def", "update_extent_from_map_canvas", "(", "self", ")", ":", "self", ".", "bounding_box_group", ".", "setTitle", "(", "self", ".", "tr", "(", "'Bounding box from the map canvas'", ")", ")", "# Get the extent as [xmin, ymin, xmax, ymax]", "extent", "=", "viewport_geo_arr...
Update extent value in GUI based from value in map. .. note:: Delegates to update_extent()
[ "Update", "extent", "value", "in", "GUI", "based", "from", "value", "in", "map", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L256-L266
train
27,042
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.update_extent_from_rectangle
def update_extent_from_rectangle(self): """Update extent value in GUI based from the QgsMapTool rectangle. .. note:: Delegates to update_extent() """ self.show() self.canvas.unsetMapTool(self.rectangle_map_tool) self.canvas.setMapTool(self.pan_tool) rectangle =...
python
def update_extent_from_rectangle(self): """Update extent value in GUI based from the QgsMapTool rectangle. .. note:: Delegates to update_extent() """ self.show() self.canvas.unsetMapTool(self.rectangle_map_tool) self.canvas.setMapTool(self.pan_tool) rectangle =...
[ "def", "update_extent_from_rectangle", "(", "self", ")", ":", "self", ".", "show", "(", ")", "self", ".", "canvas", ".", "unsetMapTool", "(", "self", ".", "rectangle_map_tool", ")", "self", ".", "canvas", ".", "setMapTool", "(", "self", ".", "pan_tool", ")...
Update extent value in GUI based from the QgsMapTool rectangle. .. note:: Delegates to update_extent()
[ "Update", "extent", "value", "in", "GUI", "based", "from", "the", "QgsMapTool", "rectangle", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L268-L283
train
27,043
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.drag_rectangle_on_map_canvas
def drag_rectangle_on_map_canvas(self): """Hide the dialog and allow the user to draw a rectangle.""" self.hide() self.rectangle_map_tool.reset() self.canvas.unsetMapTool(self.pan_tool) self.canvas.setMapTool(self.rectangle_map_tool)
python
def drag_rectangle_on_map_canvas(self): """Hide the dialog and allow the user to draw a rectangle.""" self.hide() self.rectangle_map_tool.reset() self.canvas.unsetMapTool(self.pan_tool) self.canvas.setMapTool(self.rectangle_map_tool)
[ "def", "drag_rectangle_on_map_canvas", "(", "self", ")", ":", "self", ".", "hide", "(", ")", "self", ".", "rectangle_map_tool", ".", "reset", "(", ")", "self", ".", "canvas", ".", "unsetMapTool", "(", "self", ".", "pan_tool", ")", "self", ".", "canvas", ...
Hide the dialog and allow the user to draw a rectangle.
[ "Hide", "the", "dialog", "and", "allow", "the", "user", "to", "draw", "a", "rectangle", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L291-L297
train
27,044
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.get_checked_features
def get_checked_features(self): """Create a tab with all checked features. :return A list with all features which are checked in the UI. :rtype list """ feature_types = [] if self.roads_flag.isChecked(): feature_types.append('roads') if self.buildings...
python
def get_checked_features(self): """Create a tab with all checked features. :return A list with all features which are checked in the UI. :rtype list """ feature_types = [] if self.roads_flag.isChecked(): feature_types.append('roads') if self.buildings...
[ "def", "get_checked_features", "(", "self", ")", ":", "feature_types", "=", "[", "]", "if", "self", ".", "roads_flag", ".", "isChecked", "(", ")", ":", "feature_types", ".", "append", "(", "'roads'", ")", "if", "self", ".", "buildings_flag", ".", "isChecke...
Create a tab with all checked features. :return A list with all features which are checked in the UI. :rtype list
[ "Create", "a", "tab", "with", "all", "checked", "features", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L299-L319
train
27,045
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.accept
def accept(self): """Do osm download and display it in QGIS.""" error_dialog_title = self.tr('InaSAFE OpenStreetMap Downloader Error') # Lock the bounding_box_group self.bounding_box_group.setDisabled(True) # Get the extent y_minimum = self.y_minimum.value() y_m...
python
def accept(self): """Do osm download and display it in QGIS.""" error_dialog_title = self.tr('InaSAFE OpenStreetMap Downloader Error') # Lock the bounding_box_group self.bounding_box_group.setDisabled(True) # Get the extent y_minimum = self.y_minimum.value() y_m...
[ "def", "accept", "(", "self", ")", ":", "error_dialog_title", "=", "self", ".", "tr", "(", "'InaSAFE OpenStreetMap Downloader Error'", ")", "# Lock the bounding_box_group", "self", ".", "bounding_box_group", ".", "setDisabled", "(", "True", ")", "# Get the extent", "y...
Do osm download and display it in QGIS.
[ "Do", "osm", "download", "and", "display", "it", "in", "QGIS", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L321-L419
train
27,046
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.get_output_base_path
def get_output_base_path( self, output_directory, output_prefix, feature_type, overwrite): """Get a full base name path to save the shapefile. :param output_directory: The directory where to put results. :type output_directory: str ...
python
def get_output_base_path( self, output_directory, output_prefix, feature_type, overwrite): """Get a full base name path to save the shapefile. :param output_directory: The directory where to put results. :type output_directory: str ...
[ "def", "get_output_base_path", "(", "self", ",", "output_directory", ",", "output_prefix", ",", "feature_type", ",", "overwrite", ")", ":", "path", "=", "os", ".", "path", ".", "join", "(", "output_directory", ",", "'%s%s'", "%", "(", "output_prefix", ",", "...
Get a full base name path to save the shapefile. :param output_directory: The directory where to put results. :type output_directory: str :param output_prefix: The prefix to add for the shapefile. :type output_prefix: str :param feature_type: What kind of features should be do...
[ "Get", "a", "full", "base", "name", "path", "to", "save", "the", "shapefile", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L421-L464
train
27,047
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.require_directory
def require_directory(self): """Ensure directory path entered in dialog exist. When the path does not exist, this function will ask the user if he want to create it or not. :raises: CanceledImportDialogError - when user choose 'No' in the question dialog for creating direct...
python
def require_directory(self): """Ensure directory path entered in dialog exist. When the path does not exist, this function will ask the user if he want to create it or not. :raises: CanceledImportDialogError - when user choose 'No' in the question dialog for creating direct...
[ "def", "require_directory", "(", "self", ")", ":", "path", "=", "self", ".", "output_directory", ".", "text", "(", ")", "if", "path", "==", "''", ":", "# If let empty, we create an temporary directory", "return", "if", "os", ".", "path", ".", "exists", "(", ...
Ensure directory path entered in dialog exist. When the path does not exist, this function will ask the user if he want to create it or not. :raises: CanceledImportDialogError - when user choose 'No' in the question dialog for creating directory.
[ "Ensure", "directory", "path", "entered", "in", "dialog", "exist", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L499-L535
train
27,048
inasafe/inasafe
safe/gui/tools/osm_downloader_dialog.py
OsmDownloaderDialog.reject
def reject(self): """Redefinition of the method to remove the rectangle selection tool. It will call the super method. """ self.canvas.unsetMapTool(self.rectangle_map_tool) self.rectangle_map_tool.reset() super(OsmDownloaderDialog, self).reject()
python
def reject(self): """Redefinition of the method to remove the rectangle selection tool. It will call the super method. """ self.canvas.unsetMapTool(self.rectangle_map_tool) self.rectangle_map_tool.reset() super(OsmDownloaderDialog, self).reject()
[ "def", "reject", "(", "self", ")", ":", "self", ".", "canvas", ".", "unsetMapTool", "(", "self", ".", "rectangle_map_tool", ")", "self", ".", "rectangle_map_tool", ".", "reset", "(", ")", "super", "(", "OsmDownloaderDialog", ",", "self", ")", ".", "reject"...
Redefinition of the method to remove the rectangle selection tool. It will call the super method.
[ "Redefinition", "of", "the", "method", "to", "remove", "the", "rectangle", "selection", "tool", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/osm_downloader_dialog.py#L570-L578
train
27,049
inasafe/inasafe
safe/impact_function/multi_exposure_wrapper.py
MultiExposureImpactFunction.add_exposure
def add_exposure(self, layer): """Add an exposure layer in the analysis. :param layer: An exposure layer to be used for the analysis. :type layer: QgsMapLayer """ self._exposures.append(layer) self._is_ready = False
python
def add_exposure(self, layer): """Add an exposure layer in the analysis. :param layer: An exposure layer to be used for the analysis. :type layer: QgsMapLayer """ self._exposures.append(layer) self._is_ready = False
[ "def", "add_exposure", "(", "self", ",", "layer", ")", ":", "self", ".", "_exposures", ".", "append", "(", "layer", ")", "self", ".", "_is_ready", "=", "False" ]
Add an exposure layer in the analysis. :param layer: An exposure layer to be used for the analysis. :type layer: QgsMapLayer
[ "Add", "an", "exposure", "layer", "in", "the", "analysis", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/impact_function/multi_exposure_wrapper.py#L388-L395
train
27,050
inasafe/inasafe
safe/common/parameters/resource_parameter_widget.py
ResourceParameterWidget.get_parameter
def get_parameter(self): """Obtain the parameter object from the current widget state. :returns: A BooleanParameter from the current state of widget """ self._parameter.value = self._input.value() return self._parameter
python
def get_parameter(self): """Obtain the parameter object from the current widget state. :returns: A BooleanParameter from the current state of widget """ self._parameter.value = self._input.value() return self._parameter
[ "def", "get_parameter", "(", "self", ")", ":", "self", ".", "_parameter", ".", "value", "=", "self", ".", "_input", ".", "value", "(", ")", "return", "self", ".", "_parameter" ]
Obtain the parameter object from the current widget state. :returns: A BooleanParameter from the current state of widget
[ "Obtain", "the", "parameter", "object", "from", "the", "current", "widget", "state", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/common/parameters/resource_parameter_widget.py#L37-L43
train
27,051
inasafe/inasafe
safe/gui/tools/wizard/step_fc15_hazlayer_origin.py
StepFcHazLayerOrigin.set_widgets
def set_widgets(self): """Set widgets on the Hazard Layer Origin Type tab.""" # First, list available layers in order to check if there are # any available layers. Note This will be repeated in # set_widgets_step_fc_hazlayer_from_canvas because we need # to list them again after ...
python
def set_widgets(self): """Set widgets on the Hazard Layer Origin Type tab.""" # First, list available layers in order to check if there are # any available layers. Note This will be repeated in # set_widgets_step_fc_hazlayer_from_canvas because we need # to list them again after ...
[ "def", "set_widgets", "(", "self", ")", ":", "# First, list available layers in order to check if there are", "# any available layers. Note This will be repeated in", "# set_widgets_step_fc_hazlayer_from_canvas because we need", "# to list them again after coming back from the Keyword Wizard.", ...
Set widgets on the Hazard Layer Origin Type tab.
[ "Set", "widgets", "on", "the", "Hazard", "Layer", "Origin", "Type", "tab", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/wizard/step_fc15_hazlayer_origin.py#L68-L114
train
27,052
inasafe/inasafe
safe/messaging/item/heading.py
Heading.to_html
def to_html(self): """Render a Heading MessageElement as html :returns: The html representation of the Heading MessageElement. :rtype: str """ if self.text is None: return level = self.level if level > 6: level = 6 return '<h%s%s>...
python
def to_html(self): """Render a Heading MessageElement as html :returns: The html representation of the Heading MessageElement. :rtype: str """ if self.text is None: return level = self.level if level > 6: level = 6 return '<h%s%s>...
[ "def", "to_html", "(", "self", ")", ":", "if", "self", ".", "text", "is", "None", ":", "return", "level", "=", "self", ".", "level", "if", "level", ">", "6", ":", "level", "=", "6", "return", "'<h%s%s><a id=\"%s\"></a>%s%s</h%s>'", "%", "(", "level", "...
Render a Heading MessageElement as html :returns: The html representation of the Heading MessageElement. :rtype: str
[ "Render", "a", "Heading", "MessageElement", "as", "html" ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/messaging/item/heading.py#L68-L86
train
27,053
inasafe/inasafe
safe/messaging/item/heading.py
Heading.to_text
def to_text(self): """Render a Heading MessageElement as plain text :returns: The plain text representation of the Heading MessageElement. """ if self.text is None: return level = '*' * self.level return '%s%s\n' % (level, self.text)
python
def to_text(self): """Render a Heading MessageElement as plain text :returns: The plain text representation of the Heading MessageElement. """ if self.text is None: return level = '*' * self.level return '%s%s\n' % (level, self.text)
[ "def", "to_text", "(", "self", ")", ":", "if", "self", ".", "text", "is", "None", ":", "return", "level", "=", "'*'", "*", "self", ".", "level", "return", "'%s%s\\n'", "%", "(", "level", ",", "self", ".", "text", ")" ]
Render a Heading MessageElement as plain text :returns: The plain text representation of the Heading MessageElement.
[ "Render", "a", "Heading", "MessageElement", "as", "plain", "text" ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/messaging/item/heading.py#L88-L97
train
27,054
inasafe/inasafe
safe/utilities/gis.py
extent_string_to_array
def extent_string_to_array(extent_text): """Convert an extent string to an array. .. versionadded: 2.2.0 :param extent_text: String representing an extent e.g. 109.829170982, -8.13333290561, 111.005344795, -7.49226294379 :type extent_text: str :returns: A list of floats, or None :rtyp...
python
def extent_string_to_array(extent_text): """Convert an extent string to an array. .. versionadded: 2.2.0 :param extent_text: String representing an extent e.g. 109.829170982, -8.13333290561, 111.005344795, -7.49226294379 :type extent_text: str :returns: A list of floats, or None :rtyp...
[ "def", "extent_string_to_array", "(", "extent_text", ")", ":", "coordinates", "=", "extent_text", ".", "replace", "(", "' '", ",", "''", ")", ".", "split", "(", "','", ")", "count", "=", "len", "(", "coordinates", ")", "if", "count", "!=", "4", ":", "m...
Convert an extent string to an array. .. versionadded: 2.2.0 :param extent_text: String representing an extent e.g. 109.829170982, -8.13333290561, 111.005344795, -7.49226294379 :type extent_text: str :returns: A list of floats, or None :rtype: list, None
[ "Convert", "an", "extent", "string", "to", "an", "array", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L26-L53
train
27,055
inasafe/inasafe
safe/utilities/gis.py
extent_to_array
def extent_to_array(extent, source_crs, dest_crs=None): """Convert the supplied extent to geographic and return as an array. :param extent: Rectangle defining a spatial extent in any CRS. :type extent: QgsRectangle :param source_crs: Coordinate system used for input extent. :type source_crs: QgsCo...
python
def extent_to_array(extent, source_crs, dest_crs=None): """Convert the supplied extent to geographic and return as an array. :param extent: Rectangle defining a spatial extent in any CRS. :type extent: QgsRectangle :param source_crs: Coordinate system used for input extent. :type source_crs: QgsCo...
[ "def", "extent_to_array", "(", "extent", ",", "source_crs", ",", "dest_crs", "=", "None", ")", ":", "if", "dest_crs", "is", "None", ":", "geo_crs", "=", "QgsCoordinateReferenceSystem", "(", ")", "geo_crs", ".", "createFromSrid", "(", "4326", ")", "else", ":"...
Convert the supplied extent to geographic and return as an array. :param extent: Rectangle defining a spatial extent in any CRS. :type extent: QgsRectangle :param source_crs: Coordinate system used for input extent. :type source_crs: QgsCoordinateReferenceSystem :param dest_crs: Coordinate system...
[ "Convert", "the", "supplied", "extent", "to", "geographic", "and", "return", "as", "an", "array", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L56-L92
train
27,056
inasafe/inasafe
safe/utilities/gis.py
validate_geo_array
def validate_geo_array(extent): """Validate a geographic extent. .. versionadded:: 3.2 :param extent: A list in the form [xmin, ymin, xmax, ymax] where all coordinates provided are in Geographic / EPSG:4326. :type extent: list :return: True if the extent is valid, otherwise False :rty...
python
def validate_geo_array(extent): """Validate a geographic extent. .. versionadded:: 3.2 :param extent: A list in the form [xmin, ymin, xmax, ymax] where all coordinates provided are in Geographic / EPSG:4326. :type extent: list :return: True if the extent is valid, otherwise False :rty...
[ "def", "validate_geo_array", "(", "extent", ")", ":", "min_longitude", "=", "extent", "[", "0", "]", "min_latitude", "=", "extent", "[", "1", "]", "max_longitude", "=", "extent", "[", "2", "]", "max_latitude", "=", "extent", "[", "3", "]", "# min_latitude ...
Validate a geographic extent. .. versionadded:: 3.2 :param extent: A list in the form [xmin, ymin, xmax, ymax] where all coordinates provided are in Geographic / EPSG:4326. :type extent: list :return: True if the extent is valid, otherwise False :rtype: bool
[ "Validate", "a", "geographic", "extent", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L138-L175
train
27,057
inasafe/inasafe
safe/utilities/gis.py
clone_layer
def clone_layer(layer, keep_selection=True): """Duplicate the layer by taking the same source and copying keywords. :param keep_selection: If we should keep the selection. Default to true. :type keep_selection: bool :param layer: Layer to be duplicated. :type layer: QgsMapLayer :return: The n...
python
def clone_layer(layer, keep_selection=True): """Duplicate the layer by taking the same source and copying keywords. :param keep_selection: If we should keep the selection. Default to true. :type keep_selection: bool :param layer: Layer to be duplicated. :type layer: QgsMapLayer :return: The n...
[ "def", "clone_layer", "(", "layer", ",", "keep_selection", "=", "True", ")", ":", "if", "is_vector_layer", "(", "layer", ")", ":", "new_layer", "=", "QgsVectorLayer", "(", "layer", ".", "source", "(", ")", ",", "layer", ".", "name", "(", ")", ",", "lay...
Duplicate the layer by taking the same source and copying keywords. :param keep_selection: If we should keep the selection. Default to true. :type keep_selection: bool :param layer: Layer to be duplicated. :type layer: QgsMapLayer :return: The new QgsMapLayer object. :rtype: QgsMapLayer
[ "Duplicate", "the", "layer", "by", "taking", "the", "same", "source", "and", "copying", "keywords", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L178-L205
train
27,058
inasafe/inasafe
safe/utilities/gis.py
is_raster_y_inverted
def is_raster_y_inverted(layer): """Check if the raster is upside down, ie Y inverted. See issue : https://github.com/inasafe/inasafe/issues/4026 :param layer: The layer to test. :type layer: QgsRasterLayer :return: A boolean to know if the raster is correct or not. :rtype: bool """ i...
python
def is_raster_y_inverted(layer): """Check if the raster is upside down, ie Y inverted. See issue : https://github.com/inasafe/inasafe/issues/4026 :param layer: The layer to test. :type layer: QgsRasterLayer :return: A boolean to know if the raster is correct or not. :rtype: bool """ i...
[ "def", "is_raster_y_inverted", "(", "layer", ")", ":", "info", "=", "gdal", ".", "Info", "(", "layer", ".", "source", "(", ")", ",", "format", "=", "'json'", ")", "y_maximum", "=", "info", "[", "'cornerCoordinates'", "]", "[", "'upperRight'", "]", "[", ...
Check if the raster is upside down, ie Y inverted. See issue : https://github.com/inasafe/inasafe/issues/4026 :param layer: The layer to test. :type layer: QgsRasterLayer :return: A boolean to know if the raster is correct or not. :rtype: bool
[ "Check", "if", "the", "raster", "is", "upside", "down", "ie", "Y", "inverted", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L223-L237
train
27,059
inasafe/inasafe
safe/utilities/gis.py
is_point_layer
def is_point_layer(layer): """Check if a QGIS layer is vector and its geometries are points. :param layer: A vector layer. :type layer: QgsVectorLayer, QgsMapLayer :returns: True if the layer contains points, otherwise False. :rtype: bool """ try: return (layer.type() == QgsMapLaye...
python
def is_point_layer(layer): """Check if a QGIS layer is vector and its geometries are points. :param layer: A vector layer. :type layer: QgsVectorLayer, QgsMapLayer :returns: True if the layer contains points, otherwise False. :rtype: bool """ try: return (layer.type() == QgsMapLaye...
[ "def", "is_point_layer", "(", "layer", ")", ":", "try", ":", "return", "(", "layer", ".", "type", "(", ")", "==", "QgsMapLayer", ".", "VectorLayer", ")", "and", "(", "layer", ".", "geometryType", "(", ")", "==", "QgsWkbTypes", ".", "PointGeometry", ")", ...
Check if a QGIS layer is vector and its geometries are points. :param layer: A vector layer. :type layer: QgsVectorLayer, QgsMapLayer :returns: True if the layer contains points, otherwise False. :rtype: bool
[ "Check", "if", "a", "QGIS", "layer", "is", "vector", "and", "its", "geometries", "are", "points", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L255-L268
train
27,060
inasafe/inasafe
safe/utilities/gis.py
is_line_layer
def is_line_layer(layer): """Check if a QGIS layer is vector and its geometries are lines. :param layer: A vector layer. :type layer: QgsVectorLayer, QgsMapLayer :returns: True if the layer contains lines, otherwise False. :rtype: bool """ try: return (layer.type() == QgsMapLayer....
python
def is_line_layer(layer): """Check if a QGIS layer is vector and its geometries are lines. :param layer: A vector layer. :type layer: QgsVectorLayer, QgsMapLayer :returns: True if the layer contains lines, otherwise False. :rtype: bool """ try: return (layer.type() == QgsMapLayer....
[ "def", "is_line_layer", "(", "layer", ")", ":", "try", ":", "return", "(", "layer", ".", "type", "(", ")", "==", "QgsMapLayer", ".", "VectorLayer", ")", "and", "(", "layer", ".", "geometryType", "(", ")", "==", "QgsWkbTypes", ".", "LineGeometry", ")", ...
Check if a QGIS layer is vector and its geometries are lines. :param layer: A vector layer. :type layer: QgsVectorLayer, QgsMapLayer :returns: True if the layer contains lines, otherwise False. :rtype: bool
[ "Check", "if", "a", "QGIS", "layer", "is", "vector", "and", "its", "geometries", "are", "lines", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L271-L285
train
27,061
inasafe/inasafe
safe/utilities/gis.py
is_polygon_layer
def is_polygon_layer(layer): """Check if a QGIS layer is vector and its geometries are polygons. :param layer: A vector layer. :type layer: QgsVectorLayer, QgsMapLayer :returns: True if the layer contains polygons, otherwise False. :rtype: bool """ try: return (layer.type() == Qgs...
python
def is_polygon_layer(layer): """Check if a QGIS layer is vector and its geometries are polygons. :param layer: A vector layer. :type layer: QgsVectorLayer, QgsMapLayer :returns: True if the layer contains polygons, otherwise False. :rtype: bool """ try: return (layer.type() == Qgs...
[ "def", "is_polygon_layer", "(", "layer", ")", ":", "try", ":", "return", "(", "layer", ".", "type", "(", ")", "==", "QgsMapLayer", ".", "VectorLayer", ")", "and", "(", "layer", ".", "geometryType", "(", ")", "==", "QgsWkbTypes", ".", "PolygonGeometry", "...
Check if a QGIS layer is vector and its geometries are polygons. :param layer: A vector layer. :type layer: QgsVectorLayer, QgsMapLayer :returns: True if the layer contains polygons, otherwise False. :rtype: bool
[ "Check", "if", "a", "QGIS", "layer", "is", "vector", "and", "its", "geometries", "are", "polygons", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L288-L302
train
27,062
inasafe/inasafe
safe/utilities/gis.py
layer_icon
def layer_icon(layer): """Helper to get the layer icon. :param layer: A layer. :type layer: QgsMapLayer :returns: The icon for the given layer. :rtype: QIcon """ if is_raster_layer(layer): return QgsLayerItem.iconRaster() elif is_point_layer(layer): return QgsLayerItem....
python
def layer_icon(layer): """Helper to get the layer icon. :param layer: A layer. :type layer: QgsMapLayer :returns: The icon for the given layer. :rtype: QIcon """ if is_raster_layer(layer): return QgsLayerItem.iconRaster() elif is_point_layer(layer): return QgsLayerItem....
[ "def", "layer_icon", "(", "layer", ")", ":", "if", "is_raster_layer", "(", "layer", ")", ":", "return", "QgsLayerItem", ".", "iconRaster", "(", ")", "elif", "is_point_layer", "(", "layer", ")", ":", "return", "QgsLayerItem", ".", "iconPoint", "(", ")", "el...
Helper to get the layer icon. :param layer: A layer. :type layer: QgsMapLayer :returns: The icon for the given layer. :rtype: QIcon
[ "Helper", "to", "get", "the", "layer", "icon", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L305-L323
train
27,063
inasafe/inasafe
safe/utilities/gis.py
wkt_to_rectangle
def wkt_to_rectangle(extent): """Compute the rectangle from a WKT string. It returns None if the extent is not valid WKT rectangle. :param extent: The extent. :type extent: basestring :return: The rectangle or None if it is not a valid WKT rectangle. :rtype: QgsRectangle """ geometry ...
python
def wkt_to_rectangle(extent): """Compute the rectangle from a WKT string. It returns None if the extent is not valid WKT rectangle. :param extent: The extent. :type extent: basestring :return: The rectangle or None if it is not a valid WKT rectangle. :rtype: QgsRectangle """ geometry ...
[ "def", "wkt_to_rectangle", "(", "extent", ")", ":", "geometry", "=", "QgsGeometry", ".", "fromWkt", "(", "extent", ")", "if", "not", "geometry", ".", "isGeosValid", "(", ")", ":", "return", "None", "polygon", "=", "geometry", ".", "asPolygon", "(", ")", ...
Compute the rectangle from a WKT string. It returns None if the extent is not valid WKT rectangle. :param extent: The extent. :type extent: basestring :return: The rectangle or None if it is not a valid WKT rectangle. :rtype: QgsRectangle
[ "Compute", "the", "rectangle", "from", "a", "WKT", "string", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L326-L353
train
27,064
inasafe/inasafe
safe/utilities/gis.py
qgis_version_detailed
def qgis_version_detailed(): """Get the detailed version of QGIS. :returns: List containing major, minor and patch. :rtype: list """ version = str(Qgis.QGIS_VERSION_INT) return [int(version[0]), int(version[1:3]), int(version[3:])]
python
def qgis_version_detailed(): """Get the detailed version of QGIS. :returns: List containing major, minor and patch. :rtype: list """ version = str(Qgis.QGIS_VERSION_INT) return [int(version[0]), int(version[1:3]), int(version[3:])]
[ "def", "qgis_version_detailed", "(", ")", ":", "version", "=", "str", "(", "Qgis", ".", "QGIS_VERSION_INT", ")", "return", "[", "int", "(", "version", "[", "0", "]", ")", ",", "int", "(", "version", "[", "1", ":", "3", "]", ")", ",", "int", "(", ...
Get the detailed version of QGIS. :returns: List containing major, minor and patch. :rtype: list
[ "Get", "the", "detailed", "version", "of", "QGIS", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/utilities/gis.py#L356-L363
train
27,065
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
MultiExposureDialog._tab_changed
def _tab_changed(self): """Triggered when the current tab is changed.""" current = self.tab_widget.currentWidget() if current == self.analysisTab: self.btn_back.setEnabled(False) self.btn_next.setEnabled(True) elif current == self.reportingTab: if self...
python
def _tab_changed(self): """Triggered when the current tab is changed.""" current = self.tab_widget.currentWidget() if current == self.analysisTab: self.btn_back.setEnabled(False) self.btn_next.setEnabled(True) elif current == self.reportingTab: if self...
[ "def", "_tab_changed", "(", "self", ")", ":", "current", "=", "self", ".", "tab_widget", ".", "currentWidget", "(", ")", "if", "current", "==", "self", ".", "analysisTab", ":", "self", ".", "btn_back", ".", "setEnabled", "(", "False", ")", "self", ".", ...
Triggered when the current tab is changed.
[ "Triggered", "when", "the", "current", "tab", "is", "changed", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L148-L165
train
27,066
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
MultiExposureDialog.ordered_expected_layers
def ordered_expected_layers(self): """Get an ordered list of layers according to users input. From top to bottom in the legend: [ ('FromCanvas', layer name, full layer URI, QML), ('FromAnalysis', layer purpose, layer group, None), ... ] The f...
python
def ordered_expected_layers(self): """Get an ordered list of layers according to users input. From top to bottom in the legend: [ ('FromCanvas', layer name, full layer URI, QML), ('FromAnalysis', layer purpose, layer group, None), ... ] The f...
[ "def", "ordered_expected_layers", "(", "self", ")", ":", "registry", "=", "QgsProject", ".", "instance", "(", ")", "layers", "=", "[", "]", "count", "=", "self", ".", "list_layers_in_map_report", ".", "count", "(", ")", "for", "i", "in", "range", "(", "c...
Get an ordered list of layers according to users input. From top to bottom in the legend: [ ('FromCanvas', layer name, full layer URI, QML), ('FromAnalysis', layer purpose, layer group, None), ... ] The full layer URI is coming from our helper. ...
[ "Get", "an", "ordered", "list", "of", "layers", "according", "to", "users", "input", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L175-L217
train
27,067
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
MultiExposureDialog._add_layer_clicked
def _add_layer_clicked(self): """Add layer clicked.""" layer = self.tree.selectedItems()[0] origin = layer.data(0, LAYER_ORIGIN_ROLE) if origin == FROM_ANALYSIS['key']: parent = layer.data(0, LAYER_PARENT_ANALYSIS_ROLE) key = layer.data(0, LAYER_PURPOSE_KEY_OR_ID_...
python
def _add_layer_clicked(self): """Add layer clicked.""" layer = self.tree.selectedItems()[0] origin = layer.data(0, LAYER_ORIGIN_ROLE) if origin == FROM_ANALYSIS['key']: parent = layer.data(0, LAYER_PARENT_ANALYSIS_ROLE) key = layer.data(0, LAYER_PURPOSE_KEY_OR_ID_...
[ "def", "_add_layer_clicked", "(", "self", ")", ":", "layer", "=", "self", ".", "tree", ".", "selectedItems", "(", ")", "[", "0", "]", "origin", "=", "layer", ".", "data", "(", "0", ",", "LAYER_ORIGIN_ROLE", ")", "if", "origin", "==", "FROM_ANALYSIS", "...
Add layer clicked.
[ "Add", "layer", "clicked", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L219-L236
train
27,068
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
MultiExposureDialog._remove_layer_clicked
def _remove_layer_clicked(self): """Remove layer clicked.""" layer = self.list_layers_in_map_report.selectedItems()[0] origin = layer.data(LAYER_ORIGIN_ROLE) if origin == FROM_ANALYSIS['key']: key = layer.data(LAYER_PURPOSE_KEY_OR_ID_ROLE) parent = layer.data(LAYE...
python
def _remove_layer_clicked(self): """Remove layer clicked.""" layer = self.list_layers_in_map_report.selectedItems()[0] origin = layer.data(LAYER_ORIGIN_ROLE) if origin == FROM_ANALYSIS['key']: key = layer.data(LAYER_PURPOSE_KEY_OR_ID_ROLE) parent = layer.data(LAYE...
[ "def", "_remove_layer_clicked", "(", "self", ")", ":", "layer", "=", "self", ".", "list_layers_in_map_report", ".", "selectedItems", "(", ")", "[", "0", "]", "origin", "=", "layer", ".", "data", "(", "LAYER_ORIGIN_ROLE", ")", "if", "origin", "==", "FROM_ANAL...
Remove layer clicked.
[ "Remove", "layer", "clicked", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L238-L259
train
27,069
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
MultiExposureDialog.move_layer_down
def move_layer_down(self): """Move the layer down.""" layer = self.list_layers_in_map_report.selectedItems()[0] index = self.list_layers_in_map_report.indexFromItem(layer).row() item = self.list_layers_in_map_report.takeItem(index) self.list_layers_in_map_report.insertItem(index ...
python
def move_layer_down(self): """Move the layer down.""" layer = self.list_layers_in_map_report.selectedItems()[0] index = self.list_layers_in_map_report.indexFromItem(layer).row() item = self.list_layers_in_map_report.takeItem(index) self.list_layers_in_map_report.insertItem(index ...
[ "def", "move_layer_down", "(", "self", ")", ":", "layer", "=", "self", ".", "list_layers_in_map_report", ".", "selectedItems", "(", ")", "[", "0", "]", "index", "=", "self", ".", "list_layers_in_map_report", ".", "indexFromItem", "(", "layer", ")", ".", "row...
Move the layer down.
[ "Move", "the", "layer", "down", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L269-L275
train
27,070
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
MultiExposureDialog._list_selection_changed
def _list_selection_changed(self): """Selection has changed in the list.""" items = self.list_layers_in_map_report.selectedItems() self.remove_layer.setEnabled(len(items) >= 1) if len(items) == 1 and self.list_layers_in_map_report.count() >= 2: index = self.list_layers_in_map...
python
def _list_selection_changed(self): """Selection has changed in the list.""" items = self.list_layers_in_map_report.selectedItems() self.remove_layer.setEnabled(len(items) >= 1) if len(items) == 1 and self.list_layers_in_map_report.count() >= 2: index = self.list_layers_in_map...
[ "def", "_list_selection_changed", "(", "self", ")", ":", "items", "=", "self", ".", "list_layers_in_map_report", ".", "selectedItems", "(", ")", "self", ".", "remove_layer", ".", "setEnabled", "(", "len", "(", "items", ")", ">=", "1", ")", "if", "len", "("...
Selection has changed in the list.
[ "Selection", "has", "changed", "in", "the", "list", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L277-L295
train
27,071
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
MultiExposureDialog._populate_reporting_tab
def _populate_reporting_tab(self): """Populate trees about layers.""" self.tree.clear() self.add_layer.setEnabled(False) self.remove_layer.setEnabled(False) self.move_up.setEnabled(False) self.move_down.setEnabled(False) self.tree.setColumnCount(1) self.tr...
python
def _populate_reporting_tab(self): """Populate trees about layers.""" self.tree.clear() self.add_layer.setEnabled(False) self.remove_layer.setEnabled(False) self.move_up.setEnabled(False) self.move_down.setEnabled(False) self.tree.setColumnCount(1) self.tr...
[ "def", "_populate_reporting_tab", "(", "self", ")", ":", "self", ".", "tree", ".", "clear", "(", ")", "self", ".", "add_layer", ".", "setEnabled", "(", "False", ")", "self", ".", "remove_layer", ".", "setEnabled", "(", "False", ")", "self", ".", "move_up...
Populate trees about layers.
[ "Populate", "trees", "about", "layers", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L301-L358
train
27,072
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
MultiExposureDialog._create_exposure_combos
def _create_exposure_combos(self): """Create one combobox for each exposure and insert them in the UI.""" # Map registry may be invalid if QGIS is shutting down project = QgsProject.instance() canvas_layers = self.iface.mapCanvas().layers() # MapLayers returns a QMap<QString id, ...
python
def _create_exposure_combos(self): """Create one combobox for each exposure and insert them in the UI.""" # Map registry may be invalid if QGIS is shutting down project = QgsProject.instance() canvas_layers = self.iface.mapCanvas().layers() # MapLayers returns a QMap<QString id, ...
[ "def", "_create_exposure_combos", "(", "self", ")", ":", "# Map registry may be invalid if QGIS is shutting down", "project", "=", "QgsProject", ".", "instance", "(", ")", "canvas_layers", "=", "self", ".", "iface", ".", "mapCanvas", "(", ")", ".", "layers", "(", ...
Create one combobox for each exposure and insert them in the UI.
[ "Create", "one", "combobox", "for", "each", "exposure", "and", "insert", "them", "in", "the", "UI", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L360-L468
train
27,073
inasafe/inasafe
safe/gui/tools/multi_exposure_dialog.py
MultiExposureDialog.validate_impact_function
def validate_impact_function(self): """Check validity of the current impact function.""" # Always set it to False self.btn_run.setEnabled(False) for combo in list(self.combos_exposures.values()): if combo.count() == 1: combo.setEnabled(False) hazard ...
python
def validate_impact_function(self): """Check validity of the current impact function.""" # Always set it to False self.btn_run.setEnabled(False) for combo in list(self.combos_exposures.values()): if combo.count() == 1: combo.setEnabled(False) hazard ...
[ "def", "validate_impact_function", "(", "self", ")", ":", "# Always set it to False", "self", ".", "btn_run", ".", "setEnabled", "(", "False", ")", "for", "combo", "in", "list", "(", "self", ".", "combos_exposures", ".", "values", "(", ")", ")", ":", "if", ...
Check validity of the current impact function.
[ "Check", "validity", "of", "the", "current", "impact", "function", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/multi_exposure_dialog.py#L499-L541
train
27,074
inasafe/inasafe
safe/report/extractors/aggregate_postprocessors.py
create_section
def create_section( aggregation_summary, analysis_layer, postprocessor_fields, section_header, use_aggregation=True, units_label=None, use_rounding=True, extra_component_args=None): """Create demographic section context. :param aggregation_summary: Aggregation su...
python
def create_section( aggregation_summary, analysis_layer, postprocessor_fields, section_header, use_aggregation=True, units_label=None, use_rounding=True, extra_component_args=None): """Create demographic section context. :param aggregation_summary: Aggregation su...
[ "def", "create_section", "(", "aggregation_summary", ",", "analysis_layer", ",", "postprocessor_fields", ",", "section_header", ",", "use_aggregation", "=", "True", ",", "units_label", "=", "None", ",", "use_rounding", "=", "True", ",", "extra_component_args", "=", ...
Create demographic section context. :param aggregation_summary: Aggregation summary :type aggregation_summary: qgis.core.QgsVectorlayer :param analysis_layer: Analysis layer :type analysis_layer: qgis.core.QgsVectorLayer :param postprocessor_fields: Postprocessor fields to extract :type postp...
[ "Create", "demographic", "section", "context", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/extractors/aggregate_postprocessors.py#L320-L372
train
27,075
inasafe/inasafe
safe/report/extractors/aggregate_postprocessors.py
create_section_without_aggregation
def create_section_without_aggregation( aggregation_summary, analysis_layer, postprocessor_fields, section_header, units_label=None, use_rounding=True, extra_component_args=None): """Create demographic section context without aggregation. :param aggregation_summary: Aggr...
python
def create_section_without_aggregation( aggregation_summary, analysis_layer, postprocessor_fields, section_header, units_label=None, use_rounding=True, extra_component_args=None): """Create demographic section context without aggregation. :param aggregation_summary: Aggr...
[ "def", "create_section_without_aggregation", "(", "aggregation_summary", ",", "analysis_layer", ",", "postprocessor_fields", ",", "section_header", ",", "units_label", "=", "None", ",", "use_rounding", "=", "True", ",", "extra_component_args", "=", "None", ")", ":", "...
Create demographic section context without aggregation. :param aggregation_summary: Aggregation summary :type aggregation_summary: qgis.core.QgsVectorlayer :param analysis_layer: Analysis layer :type analysis_layer: qgis.core.QgsVectorLayer :param postprocessor_fields: Postprocessor fields to ext...
[ "Create", "demographic", "section", "context", "without", "aggregation", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/report/extractors/aggregate_postprocessors.py#L589-L702
train
27,076
inasafe/inasafe
safe/gis/vector/summary_tools.py
check_inputs
def check_inputs(compulsory_fields, fields): """Helper function to check if the layer has every compulsory fields. :param compulsory_fields: List of compulsory fields. :type compulsory_fields: list :param fields: inasafe_field dictionary from the layer. :type fields: dict :raises: InvalidKeyw...
python
def check_inputs(compulsory_fields, fields): """Helper function to check if the layer has every compulsory fields. :param compulsory_fields: List of compulsory fields. :type compulsory_fields: list :param fields: inasafe_field dictionary from the layer. :type fields: dict :raises: InvalidKeyw...
[ "def", "check_inputs", "(", "compulsory_fields", ",", "fields", ")", ":", "for", "field", "in", "compulsory_fields", ":", "# noinspection PyTypeChecker", "if", "not", "fields", ".", "get", "(", "field", "[", "'key'", "]", ")", ":", "# noinspection PyTypeChecker", ...
Helper function to check if the layer has every compulsory fields. :param compulsory_fields: List of compulsory fields. :type compulsory_fields: list :param fields: inasafe_field dictionary from the layer. :type fields: dict :raises: InvalidKeywordsForProcessingAlgorithm if the layer is not valid...
[ "Helper", "function", "to", "check", "if", "the", "layer", "has", "every", "compulsory", "fields", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/summary_tools.py#L17-L33
train
27,077
inasafe/inasafe
safe/gis/vector/summary_tools.py
create_absolute_values_structure
def create_absolute_values_structure(layer, fields): """Helper function to create the structure for absolute values. :param layer: The vector layer. :type layer: QgsVectorLayer :param fields: List of name field on which we want to aggregate. :type fields: list :return: The data structure. ...
python
def create_absolute_values_structure(layer, fields): """Helper function to create the structure for absolute values. :param layer: The vector layer. :type layer: QgsVectorLayer :param fields: List of name field on which we want to aggregate. :type fields: list :return: The data structure. ...
[ "def", "create_absolute_values_structure", "(", "layer", ",", "fields", ")", ":", "# Let's create a structure like :", "# key is the index of the field : (flat table, definition name)", "source_fields", "=", "layer", ".", "keywords", "[", "'inasafe_fields'", "]", "absolute_fields...
Helper function to create the structure for absolute values. :param layer: The vector layer. :type layer: QgsVectorLayer :param fields: List of name field on which we want to aggregate. :type fields: list :return: The data structure. :rtype: dict
[ "Helper", "function", "to", "create", "the", "structure", "for", "absolute", "values", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/summary_tools.py#L36-L59
train
27,078
inasafe/inasafe
safe/gis/vector/summary_tools.py
add_fields
def add_fields( layer, absolute_values, static_fields, dynamic_structure): """Function to add fields needed in the output layer. :param layer: The vector layer. :type layer: QgsVectorLayer :param absolute_values: The absolute value structure. :type absolute_values: dict :param static_...
python
def add_fields( layer, absolute_values, static_fields, dynamic_structure): """Function to add fields needed in the output layer. :param layer: The vector layer. :type layer: QgsVectorLayer :param absolute_values: The absolute value structure. :type absolute_values: dict :param static_...
[ "def", "add_fields", "(", "layer", ",", "absolute_values", ",", "static_fields", ",", "dynamic_structure", ")", ":", "for", "new_dynamic_field", "in", "dynamic_structure", ":", "field_definition", "=", "new_dynamic_field", "[", "0", "]", "unique_values", "=", "new_d...
Function to add fields needed in the output layer. :param layer: The vector layer. :type layer: QgsVectorLayer :param absolute_values: The absolute value structure. :type absolute_values: dict :param static_fields: The list of static fields to add. :type static_fields: list :param dynami...
[ "Function", "to", "add", "fields", "needed", "in", "the", "output", "layer", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/summary_tools.py#L62-L114
train
27,079
inasafe/inasafe
safe/gui/tools/rectangle_map_tool.py
RectangleMapTool.reset
def reset(self): """ Clear the rubber band for the analysis extents. """ self.start_point = self.end_point = None self.is_emitting_point = False self.rubber_band.reset(QgsWkbTypes.PolygonGeometry)
python
def reset(self): """ Clear the rubber band for the analysis extents. """ self.start_point = self.end_point = None self.is_emitting_point = False self.rubber_band.reset(QgsWkbTypes.PolygonGeometry)
[ "def", "reset", "(", "self", ")", ":", "self", ".", "start_point", "=", "self", ".", "end_point", "=", "None", "self", ".", "is_emitting_point", "=", "False", "self", ".", "rubber_band", ".", "reset", "(", "QgsWkbTypes", ".", "PolygonGeometry", ")" ]
Clear the rubber band for the analysis extents.
[ "Clear", "the", "rubber", "band", "for", "the", "analysis", "extents", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/rectangle_map_tool.py#L50-L56
train
27,080
inasafe/inasafe
safe/gui/tools/rectangle_map_tool.py
RectangleMapTool.canvasPressEvent
def canvasPressEvent(self, e): """ Handle canvas press events so we know when user is capturing the rect. :param e: A Qt event object. :type: QEvent """ self.start_point = self.toMapCoordinates(e.pos()) self.end_point = self.start_point self.is_emitting_p...
python
def canvasPressEvent(self, e): """ Handle canvas press events so we know when user is capturing the rect. :param e: A Qt event object. :type: QEvent """ self.start_point = self.toMapCoordinates(e.pos()) self.end_point = self.start_point self.is_emitting_p...
[ "def", "canvasPressEvent", "(", "self", ",", "e", ")", ":", "self", ".", "start_point", "=", "self", ".", "toMapCoordinates", "(", "e", ".", "pos", "(", ")", ")", "self", ".", "end_point", "=", "self", ".", "start_point", "self", ".", "is_emitting_point"...
Handle canvas press events so we know when user is capturing the rect. :param e: A Qt event object. :type: QEvent
[ "Handle", "canvas", "press", "events", "so", "we", "know", "when", "user", "is", "capturing", "the", "rect", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/rectangle_map_tool.py#L58-L69
train
27,081
inasafe/inasafe
safe/gui/tools/rectangle_map_tool.py
RectangleMapTool.canvasReleaseEvent
def canvasReleaseEvent(self, e): """Handle canvas release events has finished capturing e. :param e: A Qt event object. :type: QEvent """ _ = e # NOQA self.is_emitting_point = False self.rectangle_created.emit()
python
def canvasReleaseEvent(self, e): """Handle canvas release events has finished capturing e. :param e: A Qt event object. :type: QEvent """ _ = e # NOQA self.is_emitting_point = False self.rectangle_created.emit()
[ "def", "canvasReleaseEvent", "(", "self", ",", "e", ")", ":", "_", "=", "e", "# NOQA", "self", ".", "is_emitting_point", "=", "False", "self", ".", "rectangle_created", ".", "emit", "(", ")" ]
Handle canvas release events has finished capturing e. :param e: A Qt event object. :type: QEvent
[ "Handle", "canvas", "release", "events", "has", "finished", "capturing", "e", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/rectangle_map_tool.py#L71-L79
train
27,082
inasafe/inasafe
safe/gui/tools/rectangle_map_tool.py
RectangleMapTool.show_rectangle
def show_rectangle(self, start_point, end_point): """Show the rectangle on the canvas. :param start_point: QGIS Point object representing the origin ( top left). :type start_point: QgsPoint :param end_point: QGIS Point object representing the contra-origin ( bot...
python
def show_rectangle(self, start_point, end_point): """Show the rectangle on the canvas. :param start_point: QGIS Point object representing the origin ( top left). :type start_point: QgsPoint :param end_point: QGIS Point object representing the contra-origin ( bot...
[ "def", "show_rectangle", "(", "self", ",", "start_point", ",", "end_point", ")", ":", "self", ".", "rubber_band", ".", "reset", "(", "QgsWkbTypes", ".", "PolygonGeometry", ")", "if", "(", "start_point", ".", "x", "(", ")", "==", "end_point", ".", "x", "(...
Show the rectangle on the canvas. :param start_point: QGIS Point object representing the origin ( top left). :type start_point: QgsPoint :param end_point: QGIS Point object representing the contra-origin ( bottom right). :type end_point: QgsPoint :retur...
[ "Show", "the", "rectangle", "on", "the", "canvas", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/rectangle_map_tool.py#L93-L125
train
27,083
inasafe/inasafe
safe/gui/tools/rectangle_map_tool.py
RectangleMapTool.rectangle
def rectangle(self): """Accessor for the rectangle. :return: A rectangle showing the designed extent. :rtype: QgsRectangle """ if self.start_point is None or self.end_point is None: return QgsRectangle() elif self.start_point.x() == self.end_point.x() or \ ...
python
def rectangle(self): """Accessor for the rectangle. :return: A rectangle showing the designed extent. :rtype: QgsRectangle """ if self.start_point is None or self.end_point is None: return QgsRectangle() elif self.start_point.x() == self.end_point.x() or \ ...
[ "def", "rectangle", "(", "self", ")", ":", "if", "self", ".", "start_point", "is", "None", "or", "self", ".", "end_point", "is", "None", ":", "return", "QgsRectangle", "(", ")", "elif", "self", ".", "start_point", ".", "x", "(", ")", "==", "self", "....
Accessor for the rectangle. :return: A rectangle showing the designed extent. :rtype: QgsRectangle
[ "Accessor", "for", "the", "rectangle", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/rectangle_map_tool.py#L127-L139
train
27,084
inasafe/inasafe
safe/gui/tools/rectangle_map_tool.py
RectangleMapTool.deactivate
def deactivate(self): """ Disable the tool. """ self.rubber_band.reset(QgsWkbTypes.PolygonGeometry) QgsMapTool.deactivate(self) self.deactivated.emit()
python
def deactivate(self): """ Disable the tool. """ self.rubber_band.reset(QgsWkbTypes.PolygonGeometry) QgsMapTool.deactivate(self) self.deactivated.emit()
[ "def", "deactivate", "(", "self", ")", ":", "self", ".", "rubber_band", ".", "reset", "(", "QgsWkbTypes", ".", "PolygonGeometry", ")", "QgsMapTool", ".", "deactivate", "(", "self", ")", "self", ".", "deactivated", ".", "emit", "(", ")" ]
Disable the tool.
[ "Disable", "the", "tool", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/tools/rectangle_map_tool.py#L160-L166
train
27,085
inasafe/inasafe
safe/gis/vector/clean_geometry.py
clean_layer
def clean_layer(layer): """Clean a vector layer. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The buffered vector layer. :rtype: QgsVectorLayer """ output_layer_name = clean_geometry_steps['output_layer_name'] output_layer_name = output_layer_name % layer.keywor...
python
def clean_layer(layer): """Clean a vector layer. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The buffered vector layer. :rtype: QgsVectorLayer """ output_layer_name = clean_geometry_steps['output_layer_name'] output_layer_name = output_layer_name % layer.keywor...
[ "def", "clean_layer", "(", "layer", ")", ":", "output_layer_name", "=", "clean_geometry_steps", "[", "'output_layer_name'", "]", "output_layer_name", "=", "output_layer_name", "%", "layer", ".", "keywords", "[", "'layer_purpose'", "]", "# start editing", "layer", ".",...
Clean a vector layer. :param layer: The vector layer. :type layer: QgsVectorLayer :return: The buffered vector layer. :rtype: QgsVectorLayer
[ "Clean", "a", "vector", "layer", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/clean_geometry.py#L18-L64
train
27,086
inasafe/inasafe
safe/gis/vector/clean_geometry.py
geometry_checker
def geometry_checker(geometry): """Perform a cleaning if the geometry is not valid. :param geometry: The geometry to check and clean. :type geometry: QgsGeometry :return: Tuple of bool and cleaned geometry. True if the geometry is already valid, False if the geometry was not valid. A c...
python
def geometry_checker(geometry): """Perform a cleaning if the geometry is not valid. :param geometry: The geometry to check and clean. :type geometry: QgsGeometry :return: Tuple of bool and cleaned geometry. True if the geometry is already valid, False if the geometry was not valid. A c...
[ "def", "geometry_checker", "(", "geometry", ")", ":", "if", "geometry", "is", "None", ":", "# The geometry can be None.", "return", "False", ",", "None", "if", "geometry", ".", "isGeosValid", "(", ")", ":", "return", "True", ",", "geometry", "else", ":", "ne...
Perform a cleaning if the geometry is not valid. :param geometry: The geometry to check and clean. :type geometry: QgsGeometry :return: Tuple of bool and cleaned geometry. True if the geometry is already valid, False if the geometry was not valid. A cleaned geometry, or None if the geometr...
[ "Perform", "a", "cleaning", "if", "the", "geometry", "is", "not", "valid", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gis/vector/clean_geometry.py#L67-L90
train
27,087
inasafe/inasafe
safe/gui/widgets/dock.py
remove_provenance_project_variables
def remove_provenance_project_variables(): """Removing variables from provenance data.""" project_context_scope = QgsExpressionContextUtils.projectScope( QgsProject.instance()) existing_variable_names = project_context_scope.variableNames() # Save the existing variables that's not provenance va...
python
def remove_provenance_project_variables(): """Removing variables from provenance data.""" project_context_scope = QgsExpressionContextUtils.projectScope( QgsProject.instance()) existing_variable_names = project_context_scope.variableNames() # Save the existing variables that's not provenance va...
[ "def", "remove_provenance_project_variables", "(", ")", ":", "project_context_scope", "=", "QgsExpressionContextUtils", ".", "projectScope", "(", "QgsProject", ".", "instance", "(", ")", ")", "existing_variable_names", "=", "project_context_scope", ".", "variableNames", "...
Removing variables from provenance data.
[ "Removing", "variables", "from", "provenance", "data", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L1660-L1699
train
27,088
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.aggregation
def aggregation(self, layer): """Setter for the current aggregation layer. :param layer: The current aggregation layer. :type layer: QgsVectorLayer """ # We need to disconnect first. if self._aggregation and self.use_selected_features_only: self._aggregation....
python
def aggregation(self, layer): """Setter for the current aggregation layer. :param layer: The current aggregation layer. :type layer: QgsVectorLayer """ # We need to disconnect first. if self._aggregation and self.use_selected_features_only: self._aggregation....
[ "def", "aggregation", "(", "self", ",", "layer", ")", ":", "# We need to disconnect first.", "if", "self", ".", "_aggregation", "and", "self", ".", "use_selected_features_only", ":", "self", ".", "_aggregation", ".", "selectionChanged", ".", "disconnect", "(", "se...
Setter for the current aggregation layer. :param layer: The current aggregation layer. :type layer: QgsVectorLayer
[ "Setter", "for", "the", "current", "aggregation", "layer", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L267-L282
train
27,089
inasafe/inasafe
safe/gui/widgets/dock.py
Dock._show_organisation_logo
def _show_organisation_logo(self): """Show the organisation logo in the dock if possible.""" dock_width = float(self.width()) # Don't let the image be more tha 100px height maximum_height = 100.0 # px pixmap = QPixmap(self.organisation_logo_path) if pixmap.height() < 1 o...
python
def _show_organisation_logo(self): """Show the organisation logo in the dock if possible.""" dock_width = float(self.width()) # Don't let the image be more tha 100px height maximum_height = 100.0 # px pixmap = QPixmap(self.organisation_logo_path) if pixmap.height() < 1 o...
[ "def", "_show_organisation_logo", "(", "self", ")", ":", "dock_width", "=", "float", "(", "self", ".", "width", "(", ")", ")", "# Don't let the image be more tha 100px height", "maximum_height", "=", "100.0", "# px", "pixmap", "=", "QPixmap", "(", "self", ".", "...
Show the organisation logo in the dock if possible.
[ "Show", "the", "organisation", "logo", "in", "the", "dock", "if", "possible", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L307-L332
train
27,090
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.save_auxiliary_files
def save_auxiliary_files(self, layer, destination): """Save auxiliary files when using the 'save as' function. If some auxiliary files (.xml, .json) exist, this function will copy them when the 'save as' function is used on the layer. :param layer: The layer which has been saved as. ...
python
def save_auxiliary_files(self, layer, destination): """Save auxiliary files when using the 'save as' function. If some auxiliary files (.xml, .json) exist, this function will copy them when the 'save as' function is used on the layer. :param layer: The layer which has been saved as. ...
[ "def", "save_auxiliary_files", "(", "self", ",", "layer", ",", "destination", ")", ":", "enable_busy_cursor", "(", ")", "auxiliary_files", "=", "[", "'xml'", ",", "'json'", "]", "for", "auxiliary_file", "in", "auxiliary_files", ":", "source_basename", "=", "os",...
Save auxiliary files when using the 'save as' function. If some auxiliary files (.xml, .json) exist, this function will copy them when the 'save as' function is used on the layer. :param layer: The layer which has been saved as. :type layer: QgsMapLayer :param destination: The...
[ "Save", "auxiliary", "files", "when", "using", "the", "save", "as", "function", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L501-L545
train
27,091
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.index_changed_aggregation_layer_combo
def index_changed_aggregation_layer_combo(self, index): """Automatic slot executed when the Aggregation combo is changed. :param index: The index number of the selected exposure layer. :type index: int """ if index == 0: # No aggregation layer, we should display the ...
python
def index_changed_aggregation_layer_combo(self, index): """Automatic slot executed when the Aggregation combo is changed. :param index: The index number of the selected exposure layer. :type index: int """ if index == 0: # No aggregation layer, we should display the ...
[ "def", "index_changed_aggregation_layer_combo", "(", "self", ",", "index", ")", ":", "if", "index", "==", "0", ":", "# No aggregation layer, we should display the user requested extent", "self", ".", "aggregation", "=", "None", "extent", "=", "setting", "(", "'user_exte...
Automatic slot executed when the Aggregation combo is changed. :param index: The index number of the selected exposure layer. :type index: int
[ "Automatic", "slot", "executed", "when", "the", "Aggregation", "combo", "is", "changed", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L569-L601
train
27,092
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.toggle_aggregation_layer_combo
def toggle_aggregation_layer_combo(self): """Toggle the aggregation combo enabled status. Whether the combo is toggled on or off will depend on the current dock status. """ selected_hazard_layer = layer_from_combo(self.hazard_layer_combo) selected_exposure_layer = layer_...
python
def toggle_aggregation_layer_combo(self): """Toggle the aggregation combo enabled status. Whether the combo is toggled on or off will depend on the current dock status. """ selected_hazard_layer = layer_from_combo(self.hazard_layer_combo) selected_exposure_layer = layer_...
[ "def", "toggle_aggregation_layer_combo", "(", "self", ")", ":", "selected_hazard_layer", "=", "layer_from_combo", "(", "self", ".", "hazard_layer_combo", ")", "selected_exposure_layer", "=", "layer_from_combo", "(", "self", ".", "exposure_layer_combo", ")", "# more than 1...
Toggle the aggregation combo enabled status. Whether the combo is toggled on or off will depend on the current dock status.
[ "Toggle", "the", "aggregation", "combo", "enabled", "status", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L603-L619
train
27,093
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.unblock_signals
def unblock_signals(self): """Let the combos listen for event changes again.""" self.aggregation_layer_combo.blockSignals(False) self.exposure_layer_combo.blockSignals(False) self.hazard_layer_combo.blockSignals(False)
python
def unblock_signals(self): """Let the combos listen for event changes again.""" self.aggregation_layer_combo.blockSignals(False) self.exposure_layer_combo.blockSignals(False) self.hazard_layer_combo.blockSignals(False)
[ "def", "unblock_signals", "(", "self", ")", ":", "self", ".", "aggregation_layer_combo", ".", "blockSignals", "(", "False", ")", "self", ".", "exposure_layer_combo", ".", "blockSignals", "(", "False", ")", "self", ".", "hazard_layer_combo", ".", "blockSignals", ...
Let the combos listen for event changes again.
[ "Let", "the", "combos", "listen", "for", "event", "changes", "again", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L621-L625
train
27,094
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.block_signals
def block_signals(self): """Prevent the combos and dock listening for event changes.""" self.disconnect_layer_listener() self.aggregation_layer_combo.blockSignals(True) self.exposure_layer_combo.blockSignals(True) self.hazard_layer_combo.blockSignals(True)
python
def block_signals(self): """Prevent the combos and dock listening for event changes.""" self.disconnect_layer_listener() self.aggregation_layer_combo.blockSignals(True) self.exposure_layer_combo.blockSignals(True) self.hazard_layer_combo.blockSignals(True)
[ "def", "block_signals", "(", "self", ")", ":", "self", ".", "disconnect_layer_listener", "(", ")", "self", ".", "aggregation_layer_combo", ".", "blockSignals", "(", "True", ")", "self", ".", "exposure_layer_combo", ".", "blockSignals", "(", "True", ")", "self", ...
Prevent the combos and dock listening for event changes.
[ "Prevent", "the", "combos", "and", "dock", "listening", "for", "event", "changes", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L627-L632
train
27,095
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.debug_group_toggled
def debug_group_toggled(self): """Helper to set a color on the debug button to know if it's debugging. If debug analysis is true or if rounding is disabled, it will be orange. """ use_debug = self.use_debug_action.isChecked() set_setting('use_debug_analysis', use_debug) ...
python
def debug_group_toggled(self): """Helper to set a color on the debug button to know if it's debugging. If debug analysis is true or if rounding is disabled, it will be orange. """ use_debug = self.use_debug_action.isChecked() set_setting('use_debug_analysis', use_debug) ...
[ "def", "debug_group_toggled", "(", "self", ")", ":", "use_debug", "=", "self", ".", "use_debug_action", ".", "isChecked", "(", ")", "set_setting", "(", "'use_debug_analysis'", ",", "use_debug", ")", "disable_rounding", "=", "self", ".", "disable_rounding_action", ...
Helper to set a color on the debug button to know if it's debugging. If debug analysis is true or if rounding is disabled, it will be orange.
[ "Helper", "to", "set", "a", "color", "on", "the", "debug", "button", "to", "know", "if", "it", "s", "debugging", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L634-L648
train
27,096
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.get_layers
def get_layers(self, *args): """Obtain a list of layers currently loaded in QGIS. On invocation, this method will populate hazard_layer_combo, exposure_layer_combo and aggregation_layer_combo on the dialog with a list of available layers. Only **polygon vector** layers will be ...
python
def get_layers(self, *args): """Obtain a list of layers currently loaded in QGIS. On invocation, this method will populate hazard_layer_combo, exposure_layer_combo and aggregation_layer_combo on the dialog with a list of available layers. Only **polygon vector** layers will be ...
[ "def", "get_layers", "(", "self", ",", "*", "args", ")", ":", "_", "=", "args", "# NOQA", "# Prevent recursion", "if", "self", ".", "get_layers_lock", ":", "return", "# Map registry may be invalid if QGIS is shutting down", "project", "=", "QgsProject", ".", "instan...
Obtain a list of layers currently loaded in QGIS. On invocation, this method will populate hazard_layer_combo, exposure_layer_combo and aggregation_layer_combo on the dialog with a list of available layers. Only **polygon vector** layers will be added to the aggregate list. :p...
[ "Obtain", "a", "list", "of", "layers", "currently", "loaded", "in", "QGIS", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L650-L770
train
27,097
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.show_print_dialog
def show_print_dialog(self): """Open the print dialog""" if not self.impact_function: # Now try to read the keywords and show them in the dock try: active_layer = self.iface.activeLayer() keywords = self.keyword_io.read_keywords(active_layer) ...
python
def show_print_dialog(self): """Open the print dialog""" if not self.impact_function: # Now try to read the keywords and show them in the dock try: active_layer = self.iface.activeLayer() keywords = self.keyword_io.read_keywords(active_layer) ...
[ "def", "show_print_dialog", "(", "self", ")", ":", "if", "not", "self", ".", "impact_function", ":", "# Now try to read the keywords and show them in the dock", "try", ":", "active_layer", "=", "self", ".", "iface", ".", "activeLayer", "(", ")", "keywords", "=", "...
Open the print dialog
[ "Open", "the", "print", "dialog" ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L811-L864
train
27,098
inasafe/inasafe
safe/gui/widgets/dock.py
Dock.show_busy
def show_busy(self): """Hide the question group box and enable the busy cursor.""" self.progress_bar.show() self.question_group.setEnabled(False) self.question_group.setVisible(False) enable_busy_cursor() self.repaint() qApp.processEvents() self.busy = Tru...
python
def show_busy(self): """Hide the question group box and enable the busy cursor.""" self.progress_bar.show() self.question_group.setEnabled(False) self.question_group.setVisible(False) enable_busy_cursor() self.repaint() qApp.processEvents() self.busy = Tru...
[ "def", "show_busy", "(", "self", ")", ":", "self", ".", "progress_bar", ".", "show", "(", ")", "self", ".", "question_group", ".", "setEnabled", "(", "False", ")", "self", ".", "question_group", ".", "setVisible", "(", "False", ")", "enable_busy_cursor", "...
Hide the question group box and enable the busy cursor.
[ "Hide", "the", "question", "group", "box", "and", "enable", "the", "busy", "cursor", "." ]
831d60abba919f6d481dc94a8d988cc205130724
https://github.com/inasafe/inasafe/blob/831d60abba919f6d481dc94a8d988cc205130724/safe/gui/widgets/dock.py#L872-L880
train
27,099