本文整理汇总了Python中safe_qgis.tools.keywords_dialog.KeywordsDialog.tr方法的典型用法代码示例。如果您正苦于以下问题:Python KeywordsDialog.tr方法的具体用法?Python KeywordsDialog.tr怎么用?Python KeywordsDialog.tr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类safe_qgis.tools.keywords_dialog.KeywordsDialog
的用法示例。
在下文中一共展示了KeywordsDialog.tr方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_on_dsb_female_ratio_default_value_changed
# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import tr [as 别名]
def test_on_dsb_female_ratio_default_value_changed(self):
"""Test hazard radio button toggle behaviour works"""
layer = make_polygon_layer()
defaults = breakdown_defaults()
dialog = KeywordsDialog(PARENT, IFACE, layer=layer)
button = dialog.radPostprocessing
button.setChecked(False)
button.click()
female_ratio_box = dialog.cboFemaleRatioAttribute
#set to Don't use
index = female_ratio_box.findText(dialog.tr('Don\'t use'))
message = (dialog.tr('Don\'t use') + ' not found')
self.assertNotEqual(index, -1, message)
female_ratio_box.setCurrentIndex(index)
message = (
'Toggling the female ratio attribute combo to'
' "Don\'t use" did not add it to the keywords list.')
self.assertEqual(dialog.get_value_for_key(
defaults['FEM_RATIO_ATTR_KEY']), dialog.tr('Don\'t use'),
message)
message = (
'Toggling the female ratio attribute combo to'
' "Don\'t use" did not disable dsbFemaleRatioDefault.')
is_enabled = dialog.dsbFemaleRatioDefault.isEnabled()
assert not is_enabled, message
message = (
'Toggling the female ratio attribute combo to'
' "Don\'t use" did not remove the keyword.')
assert (dialog.get_value_for_key(defaults['FEM_RATIO']) is None), \
message
#set to TEST_REAL
index = female_ratio_box.findText('TEST_REAL')
message = 'TEST_REAL not found'
assert (index != -1), message
female_ratio_box.setCurrentIndex(index)
message = (
'Toggling the female ratio attribute combo to "TEST_REAL"'
' did not add it to the keywords list.')
assert dialog.get_value_for_key(
defaults['FEM_RATIO_ATTR_KEY']) == 'TEST_REAL', message
message = (
'Toggling the female ratio attribute combo to "TEST_REAL"'
' did not disable dsbFemaleRatioDefault.')
is_enabled = dialog.dsbFemaleRatioDefault.isEnabled()
assert not is_enabled, message
message = (
'Toggling the female ratio attribute combo to "TEST_REAL"'
' did not remove the keyword.')
assert (dialog.get_value_for_key(defaults['FEM_RATIO']) is
None), message
示例2: test_on_dsbFemaleRatioDefault_valueChanged
# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import tr [as 别名]
def test_on_dsbFemaleRatioDefault_valueChanged(self):
"""Test hazard radio button toggle behaviour works"""
myLayer = makePolygonLayer()
myDefaults = defaults()
myDialog = KeywordsDialog(PARENT, IFACE, layer=myLayer)
myButton = myDialog.radPostprocessing
myButton.setChecked(False)
# noinspection PyArgumentList
QTest.mouseClick(myButton, QtCore.Qt.LeftButton)
myFemaleRatioAttrBox = myDialog.cboFemaleRatioAttribute
#set to Don't use
myIndex = myFemaleRatioAttrBox.findText(
myDialog.tr('Don\'t use'))
myMessage = (myDialog.tr('Don\'t use') + ' not found')
assert (myIndex != -1), myMessage
myFemaleRatioAttrBox.setCurrentIndex(myIndex)
myMessage = ('Toggling the female ratio attribute combo to'
' "Don\'t use" did not add it to the keywords list.')
assert myDialog.get_value_for_key(
myDefaults['FEM_RATIO_ATTR_KEY']) == myDialog.tr('Don\'t use'), \
myMessage
myMessage = ('Toggling the female ratio attribute combo to'
' "Don\'t use" did not disable dsbFemaleRatioDefault.')
myIsEnabled = myDialog.dsbFemaleRatioDefault.isEnabled()
assert not myIsEnabled, myMessage
myMessage = ('Toggling the female ratio attribute combo to'
' "Don\'t use" did not remove the keyword.')
assert (myDialog.get_value_for_key(myDefaults['FEM_RATIO']) is None), \
myMessage
#set to TEST_REAL
myIndex = myFemaleRatioAttrBox.findText('TEST_REAL')
myMessage = 'TEST_REAL not found'
assert (myIndex != -1), myMessage
myFemaleRatioAttrBox.setCurrentIndex(myIndex)
myMessage = ('Toggling the female ratio attribute combo to "TEST_REAL"'
' did not add it to the keywords list.')
assert myDialog.get_value_for_key(
myDefaults['FEM_RATIO_ATTR_KEY']) == 'TEST_REAL', myMessage
myMessage = ('Toggling the female ratio attribute combo to "TEST_REAL"'
' did not disable dsbFemaleRatioDefault.')
myIsEnabled = myDialog.dsbFemaleRatioDefault.isEnabled()
assert not myIsEnabled, myMessage
myMessage = ('Toggling the female ratio attribute combo to "TEST_REAL"'
' did not remove the keyword.')
assert (myDialog.get_value_for_key(myDefaults['FEM_RATIO']) is
None), myMessage
示例3: test_on_radPostprocessing_toggled
# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import tr [as 别名]
def test_on_radPostprocessing_toggled(self):
"""Test hazard radio button toggle behaviour works"""
myLayer = makePolygonLayer()
myDefaults = defaults()
myDialog = KeywordsDialog(PARENT, IFACE, layer=myLayer)
myButton = myDialog.radPostprocessing
myButton.setChecked(False)
# noinspection PyArgumentList
QTest.mouseClick(myButton, QtCore.Qt.LeftButton)
myMessage = ('Toggling the postprocessing radio did not add a '
'category to the keywords list.')
assert myDialog.get_value_for_key(
'category') == 'postprocessing', myMessage
myMessage = ('Toggling the postprocessing radio did not add an '
'aggregation attribute to the keywords list.')
assert myDialog.get_value_for_key(
myDefaults['AGGR_ATTR_KEY']) == 'KAB_NAME', myMessage
myMessage = ('Toggling the postprocessing radio did not add a '
'female ratio attribute to the keywords list.')
assert myDialog.get_value_for_key(
myDefaults['FEM_RATIO_ATTR_KEY']) == myDialog.tr('Use default'), \
myMessage
myMessage = ('Toggling the postprocessing radio did not add a '
'female ratio default value to the keywords list.')
assert float(myDialog.get_value_for_key(
myDefaults['FEM_RATIO_KEY'])) == myDefaults['FEM_RATIO'], myMessage
示例4: test_on_rad_postprocessing_toggled
# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import tr [as 别名]
def test_on_rad_postprocessing_toggled(self):
"""Test hazard radio button toggle behaviour works"""
layer = make_polygon_layer()
defaults = breakdown_defaults()
dialog = KeywordsDialog(PARENT, IFACE, layer=layer)
button = dialog.radPostprocessing
button.setChecked(False)
button.click()
message = (
'Toggling the postprocessing radio did not add a '
'category to the keywords list.')
self.assertEqual(dialog.get_value_for_key(
'category'), 'postprocessing', message)
message = (
'Toggling the postprocessing radio did not add an '
'aggregation attribute to the keywords list.')
self.assertEqual(dialog.get_value_for_key(
defaults['AGGR_ATTR_KEY']), 'KAB_NAME', message)
message = (
'Toggling the postprocessing radio did not add a '
'female ratio attribute to the keywords list.')
self.assertEqual(dialog.get_value_for_key(
defaults['FEM_RATIO_ATTR_KEY']), dialog.tr('Use default'),
message)
message = (
'Toggling the postprocessing radio did not add a '
'female ratio default value to the keywords list.')
self.assertEqual(float(dialog.get_value_for_key(
defaults['FEM_RATIO_KEY'])), defaults['FEM_RATIO'], message)