当前位置: 首页>>代码示例>>Python>>正文


Python KeywordsDialog.tr方法代码示例

本文整理汇总了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
开发者ID:FlavioFalcao,项目名称:inasafe,代码行数:60,代码来源:test_keywords_dialog.py

示例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
开发者ID:feyeandal,项目名称:inasafe,代码行数:56,代码来源:test_keywords_dialog.py

示例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
开发者ID:feyeandal,项目名称:inasafe,代码行数:32,代码来源:test_keywords_dialog.py

示例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)
开发者ID:FlavioFalcao,项目名称:inasafe,代码行数:35,代码来源:test_keywords_dialog.py


注:本文中的safe_qgis.tools.keywords_dialog.KeywordsDialog.tr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。