本文整理汇总了Python中safe_extras.parameters.boolean_parameter.BooleanParameter.help_text方法的典型用法代码示例。如果您正苦于以下问题:Python BooleanParameter.help_text方法的具体用法?Python BooleanParameter.help_text怎么用?Python BooleanParameter.help_text使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类safe_extras.parameters.boolean_parameter.BooleanParameter
的用法示例。
在下文中一共展示了BooleanParameter.help_text方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_init
# 需要导入模块: from safe_extras.parameters.boolean_parameter import BooleanParameter [as 别名]
# 或者: from safe_extras.parameters.boolean_parameter.BooleanParameter import help_text [as 别名]
def test_init(self):
"""Test initialize qt4 parameter factory."""
boolean_parameter = BooleanParameter('1231231')
boolean_parameter.name = 'Boolean'
boolean_parameter.help_text = 'A boolean parameter'
boolean_parameter.description = 'A test _description'
boolean_parameter.is_required = True
boolean_parameter.value = True
float_parameter = FloatParameter()
float_parameter.name = 'Float Parameter'
float_parameter.is_required = True
float_parameter.precision = 3
float_parameter.minimum_allowed_value = 1.0
float_parameter.maximum_allowed_value = 2.0
float_parameter.help_text = 'Short help.'
float_parameter.description = 'Long description for parameter.'
float_parameter.unit = 'metres'
float_parameter.value = 1.1
parameters = [boolean_parameter, float_parameter]
qt4_parameter_factory = Qt4ParameterFactory()
widgets = []
widget_classes = []
for parameter in parameters:
widget = qt4_parameter_factory.get_widget(parameter)
widgets.append(widget)
widget_classes.append(widget.__class__)
expected_classes = [BooleanParameterWidget, FloatParameterWidget]
message = 'Expected %s got %s' % (expected_classes, widget_classes)
self.assertListEqual(widget_classes, expected_classes, message)
示例2: test_init
# 需要导入模块: from safe_extras.parameters.boolean_parameter import BooleanParameter [as 别名]
# 或者: from safe_extras.parameters.boolean_parameter.BooleanParameter import help_text [as 别名]
def test_init(self):
parameter = BooleanParameter('1231231')
parameter.name = 'Boolean'
parameter.help_text = 'A boolean parameter'
parameter.description = 'A test _description'
parameter.is_required = True
parameter.value = True
widget = BooleanParameterWidget(parameter)
expected_value = parameter.name
real_value = widget._label.text()
message = 'Expected %s get %s' % (expected_value, real_value)
self.assertEqual(expected_value, real_value, message)
expected_value = parameter.value
real_value = widget._check_box_input.isChecked()
message = 'Expected %s get %s' % (expected_value, real_value)
self.assertEqual(expected_value, real_value, message)
# change value
widget._check_box_input.setChecked(False)
expected_value = False
real_value = widget._check_box_input.isChecked()
message = 'Expected %s get %s' % (expected_value, real_value)
self.assertEqual(expected_value, real_value, message)
示例3: default_gender_postprocessor
# 需要导入模块: from safe_extras.parameters.boolean_parameter import BooleanParameter [as 别名]
# 或者: from safe_extras.parameters.boolean_parameter.BooleanParameter import help_text [as 别名]
def default_gender_postprocessor():
"""Get gender postprocessor selector.
:return: A selector to activate gender postprocessor.
:rtype: list
"""
gender = BooleanParameter()
gender.name = "Gender"
gender.value = True
gender.help_text = tr("Gender ratio breakdown.")
gender.description = tr(
"Check this option if you wish to calculate a breakdown by gender " "for the affected population."
)
return [gender]
示例4: road_type_postprocessor
# 需要导入模块: from safe_extras.parameters.boolean_parameter import BooleanParameter [as 别名]
# 或者: from safe_extras.parameters.boolean_parameter.BooleanParameter import help_text [as 别名]
def road_type_postprocessor():
"""Get road-type parameter for postprocessing.
:return: A list of boolean parameter.
:rtype: list
"""
road_type = BooleanParameter()
road_type.name = tr("Road type")
road_type.value = True
road_type.help_text = tr("Road breakdown by type.")
road_type.description = tr(
"Check this option if you want to enable a road impact report broken " "down by road type."
)
return [road_type]
示例5: minimum_needs_selector
# 需要导入模块: from safe_extras.parameters.boolean_parameter import BooleanParameter [as 别名]
# 或者: from safe_extras.parameters.boolean_parameter.BooleanParameter import help_text [as 别名]
def minimum_needs_selector():
"""Get minimum needs postprocessor selector.
:return: A selector to activate minimum needs postprocessor.
:rtype: list
"""
minimum_needs_flag = BooleanParameter()
minimum_needs_flag.name = 'MinimumNeeds'
minimum_needs_flag.value = True
minimum_needs_flag.help_text = tr('Minimum needs breakdown.')
minimum_needs_flag.description = tr(
'Check this option if you wish to calculate minimum needs for the '
'affected population. Minimum needs will be calculated according to '
'the defaults defined in the minimum needs configuration tool.'
)
return [minimum_needs_flag]
示例6: test_boolean
# 需要导入模块: from safe_extras.parameters.boolean_parameter import BooleanParameter [as 别名]
# 或者: from safe_extras.parameters.boolean_parameter.BooleanParameter import help_text [as 别名]
def test_boolean(self):
"""Test a bool parameter works properly.
.. versionadded:: 2.2
"""
parameter = BooleanParameter('1231231')
parameter.name = 'Boolean'
parameter.help_text = 'A boolean parameter'
parameter.description = 'A test _description'
parameter.is_required = True
parameter.value = True
self.assertEqual(True, parameter.value)
with self.assertRaises(TypeError):
parameter.value = 'Test'
示例7: aggregation_categorical_postprocessor
# 需要导入模块: from safe_extras.parameters.boolean_parameter import BooleanParameter [as 别名]
# 或者: from safe_extras.parameters.boolean_parameter.BooleanParameter import help_text [as 别名]
def aggregation_categorical_postprocessor():
"""Get aggregation categorical postprocessor selectors.
:return: List of boolean parameter.
:rtype: list
"""
aggregation_categorical = BooleanParameter()
aggregation_categorical.name = tr('Aggregation categorical')
aggregation_categorical.value = True
aggregation_categorical.help_text = tr(
'Report breakdown by type/category.')
aggregation_categorical.description = tr(
'Enable the aggregation by categories. For example if you have '
'roads classified by type, you will get a report broken down by road '
'type for each aggregation area.'
)
return [aggregation_categorical]