## # For QGIS < 2.18.13 and QGIS < 2.14.19, docstrings are used in the QGIS GUI # in the Expression dialog and also in the InaSAFE Help dialog. # # For QGIS >= 2.18.13, QGIS >= 2.14.19 and QGIS 3, the translated variable will # be used in QGIS. # help_text is used for QGIS 2.18 and 2.14 # helpText is used for QGIS 3 : https://github.com/qgis/QGIS/pull/5059 ## description = tr('Retrieve default InaSAFE HTML resources (style and script) ' 'from InaSAFE analysis report of current selected analysis.') examples = {'inasafe_html_resources()': None} help_message = generate_expression_help(description, examples) @qgsfunction(args='auto', group=group, usesGeometry=False, referencedColumns=[], help_text=help_message.to_html(), helpText=help_message.to_html()) def default_inasafe_html_resources(feature, parent): """Retrieve default InaSAFE HTML resources (style and script). """ _ = feature, parent # NOQA project_context_scope = QgsExpressionContextUtils.projectScope() key = provenance_layer_analysis_impacted['provenance_key'] if not project_context_scope.hasVariable(key):
__revision__ = 'fdf1afffab4271e5fbb873566278d5b4a7ff5722' ## # For QGIS < 2.18.13 and QGIS < 2.14.19, docstrings are used in the QGIS GUI # in the Expression dialog and also in the InaSAFE Help dialog. # # For QGIS >= 2.18.13, QGIS >= 2.14.19 and QGIS 3, the translated variable will # be used in QGIS. # help_text is used for QGIS 2.18 and 2.14 # helpText is used for QGIS 3 : https://github.com/qgis/QGIS/pull/5059 ## description = tr( 'Retrieve a value from a field in the analysis summary layer.') examples = {'inasafe_analysis_summary_field_value(\'total_not_exposed\')': 3} help_message = generate_expression_help(description, examples) @qgsfunction(args='auto', group='InaSAFE', usesGeometry=False, referencedColumns=[], help_text=help_message.to_html(), helpText=help_message.to_html()) def inasafe_analysis_summary_field_value(field, feature, parent): """Retrieve a value from a field in the analysis summary layer. e.g. inasafe_analysis_summary_field_value('total_not_exposed') -> 3 """ _ = feature, parent # NOQA project_context_scope = QgsExpressionContextUtils.projectScope(
## # For QGIS < 2.18.13 and QGIS < 2.14.19, docstrings are used in the QGIS GUI # in the Expression dialog and also in the InaSAFE Help dialog. # # For QGIS >= 2.18.13, QGIS >= 2.14.19 and QGIS 3, the translated variable will # be used in QGIS. # help_text is used for QGIS 2.18 and 2.14 # helpText is used for QGIS 3 : https://github.com/qgis/QGIS/pull/5059 ## description = tr('Retrieve the full path of inasafe-logo-white.svg.') examples = { 'inasafe_logo_white_path()': None } help_message = generate_expression_help(description, examples) @qgsfunction( args='auto', group=group, usesGeometry=False, referencedColumns=[]) def inasafe_logo_white_path(feature, parent): """Retrieve the full path of inasafe-logo-white.svg.""" _ = feature, parent # NOQA return inasafe_logo_white['path'] @qgsfunction( args='auto', group=group, usesGeometry=False, referencedColumns=[], help_text=help_message.to_html(), helpText=help_message.to_html()) def inasafe_field_header(field, feature, parent): """Retrieve a header name of the field name from definitions.
## # For QGIS < 2.18.13 and QGIS < 2.14.19, docstrings are used in the QGIS GUI # in the Expression dialog and also in the InaSAFE Help dialog. # # For QGIS >= 2.18.13, QGIS >= 2.14.19 and QGIS 3, the translated variable will # be used in QGIS. # help_text is used for QGIS 2.18 and 2.14 # helpText is used for QGIS 3 : https://github.com/qgis/QGIS/pull/5059 ## description = tr( 'Retrieve a value from a field in the analysis summary layer.') examples = { 'inasafe_analysis_summary_field_value(\'total_not_exposed\')': 3 } help_message = generate_expression_help(description, examples) @qgsfunction( args='auto', group='InaSAFE', usesGeometry=False, referencedColumns=[], help_text=help_message.to_html(), helpText=help_message.to_html()) def inasafe_analysis_summary_field_value(field, feature, parent): """Retrieve a value from a field in the analysis summary layer. e.g. inasafe_analysis_summary_field_value('total_not_exposed') -> 3 """ _ = feature, parent # NOQA project_context_scope = QgsExpressionContextUtils.projectScope( QgsProject.instance()) registry = QgsProject.instance()