本文整理汇总了Python中safe.gui.tools.minimum_needs.needs_profile.NeedsProfile.get_needs_parameters方法的典型用法代码示例。如果您正苦于以下问题:Python NeedsProfile.get_needs_parameters方法的具体用法?Python NeedsProfile.get_needs_parameters怎么用?Python NeedsProfile.get_needs_parameters使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类safe.gui.tools.minimum_needs.needs_profile.NeedsProfile
的用法示例。
在下文中一共展示了NeedsProfile.get_needs_parameters方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _initializes_minimum_needs_fields
# 需要导入模块: from safe.gui.tools.minimum_needs.needs_profile import NeedsProfile [as 别名]
# 或者: from safe.gui.tools.minimum_needs.needs_profile.NeedsProfile import get_needs_parameters [as 别名]
def _initializes_minimum_needs_fields():
"""Initialize minimum needs fields.
Minimum needs definitions are taken from currently used profile.
"""
needs_profile = NeedsProfile()
needs_profile.load()
fields = []
needs_parameters = needs_profile.get_needs_parameters()
for need_parameter in needs_parameters:
if isinstance(need_parameter, ResourceParameter):
format_args = {
'namespace': minimum_needs_namespace,
'key': _normalize_field_name(need_parameter.name),
'name': need_parameter.name,
'field_name': _normalize_field_name(need_parameter.name),
}
key = '{namespace}__{key}_count_field'.format(**format_args)
name = '{name}'.format(**format_args)
field_name = '{namespace}__{field_name}'.format(**format_args)
field_type = QVariant.LongLong # See issue #4039
length = 11 # See issue #4039
precision = 0
absolute = True
replace_null = False
description = need_parameter.description
field_definition = {
'key': key,
'name': name,
'field_name': field_name,
'type': field_type,
'length': length,
'precision': precision,
'absolute': absolute,
'description': description,
'replace_null': replace_null,
'unit_abbreviation': need_parameter.unit.abbreviation,
# Link to need_parameter
'need_parameter': need_parameter
}
fields.append(field_definition)
return fields