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


Python KeywordsDialog.add_list_entry方法代码示例

本文整理汇总了Python中safe_qgis.tools.keywords_dialog.KeywordsDialog.add_list_entry方法的典型用法代码示例。如果您正苦于以下问题:Python KeywordsDialog.add_list_entry方法的具体用法?Python KeywordsDialog.add_list_entry怎么用?Python KeywordsDialog.add_list_entry使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在safe_qgis.tools.keywords_dialog.KeywordsDialog的用法示例。


在下文中一共展示了KeywordsDialog.add_list_entry方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_add_warnings_for_colons

# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import add_list_entry [as 别名]
 def test_add_warnings_for_colons(self):
     """Test add entry to list works."""
     dialog = KeywordsDialog(PARENT, IFACE)
     dialog.reset(False)
     dialog.add_list_entry('bar', 'fo:o')
     result = dialog.get_value_for_key('bar')
     expected_result = 'fo.o'
     message = '\nGot: %s\nExpected: %s\n' % (result, expected_result)
     self.assertEqual(result, expected_result, message)
     #
     # Check the user gets a message if they put colons in the value
     #
     expected_result = 'Colons are not allowed, replaced with "."'
     result = str(dialog.lblMessage.text())
     message = (
         'lblMessage error \nGot: %s\nExpected: %s\n' %
         (result, expected_result))
     self.assertEqual(result, expected_result, message)
     #
     # Check the user gets a message if they put colons in the key
     #
     dialog.add_list_entry('ba:r', 'foo')
     expected_result = 'Colons are not allowed, replaced with "."'
     result = str(dialog.lblMessage.text())
     message = (
         'lblMessage error \nGot: %s\nExpected: %s\n' %
         (result, expected_result))
     self.assertEqual(result, expected_result, message)
开发者ID:cccs-ip,项目名称:inasafe,代码行数:30,代码来源:test_keywords_dialog.py

示例2: test_addWarningsForColons

# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import add_list_entry [as 别名]
 def test_addWarningsForColons(self):
     """Test add entry to list works"""
     myDialog = KeywordsDialog(PARENT, IFACE)
     myDialog.reset(False)
     myDialog.add_list_entry('bar', 'fo:o')
     myResult = myDialog.get_value_for_key('bar')
     myExpectedResult = 'fo.o'
     myMessage = ('\nGot: %s\nExpected: %s\n' %
                  (myResult, myExpectedResult))
     #print 'Dict', myDialog.getKeywords()
     assert myResult == myExpectedResult, myMessage
     #
     # Check the user gets a message if they put colons in the value
     #
     myExpectedResult = 'Colons are not allowed, replaced with "."'
     myResult = str(myDialog.lblMessage.text())
     myMessage = ('lblMessage error \nGot: %s\nExpected: %s\n' %
                  (myResult, myExpectedResult))
     #print 'Dict', myDialog.getKeywords()
     assert myResult == myExpectedResult, myMessage
     #
     # Check the user gets a message if they put colons in the key
     #
     myDialog.add_list_entry('ba:r', 'foo')
     myExpectedResult = 'Colons are not allowed, replaced with "."'
     myResult = str(myDialog.lblMessage.text())
     myMessage = ('lblMessage error \nGot: %s\nExpected: %s\n' %
                  (myResult, myExpectedResult))
     #print 'Dict', myDialog.getKeywords()
     assert myResult == myExpectedResult, myMessage
开发者ID:feyeandal,项目名称:inasafe,代码行数:32,代码来源:test_keywords_dialog.py

示例3: test_add_list_entry

# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import add_list_entry [as 别名]
 def test_add_list_entry(self):
     """Test add entry to list works."""
     dialog = KeywordsDialog(PARENT, IFACE)
     dialog.reset(False)
     dialog.add_list_entry('bar', 'foo')
     result = dialog.get_value_for_key('bar')
     expected_result = 'foo'
     message = '\nGot: %s\nExpected: %s\n' % (result, expected_result)
     self.assertEqual(result, expected_result, message)
开发者ID:cccs-ip,项目名称:inasafe,代码行数:11,代码来源:test_keywords_dialog.py

示例4: test_remove_iItem_by_key

# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import add_list_entry [as 别名]
 def test_remove_iItem_by_key(self):
     """Test remove item by its key works."""
     dialog = KeywordsDialog(PARENT, IFACE)
     dialog.reset(False)
     dialog.add_list_entry('bar', 'foo')
     dialog.remove_item_by_key('bar')
     result = dialog.lstKeywords.count()
     expected_result = 0
     message = '\nGot: %s\nExpected: %s\n' % (result, expected_result)
     self.assertEqual(result, expected_result, message)
开发者ID:cccs-ip,项目名称:inasafe,代码行数:12,代码来源:test_keywords_dialog.py

示例5: test_addListEntry

# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import add_list_entry [as 别名]
 def test_addListEntry(self):
     """Test add entry to list works"""
     myDialog = KeywordsDialog(PARENT, IFACE)
     myDialog.reset(False)
     myDialog.add_list_entry('bar', 'foo')
     myResult = myDialog.get_value_for_key('bar')
     myExpectedResult = 'foo'
     myMessage = ('\nGot: %s\nExpected: %s\n' %
                  (myResult, myExpectedResult))
     #print 'Dict', myDialog.getKeywords()
     assert myResult == myExpectedResult, myMessage
开发者ID:feyeandal,项目名称:inasafe,代码行数:13,代码来源:test_keywords_dialog.py

示例6: test_removeItemByKey

# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import add_list_entry [as 别名]
 def test_removeItemByKey(self):
     """Test remove item by its key works"""
     myDialog = KeywordsDialog(PARENT, IFACE)
     myDialog.reset(False)
     myDialog.add_list_entry('bar', 'foo')
     myDialog.remove_item_by_key('bar')
     myResult = myDialog.lstKeywords.count()
     myExpectedResult = 0
     myMessage = ('\nGot: %s\nExpected: %s\n' %
                  (myResult, myExpectedResult))
     #print 'Dict', myDialog.getKeywords()
     assert myResult == myExpectedResult, myMessage
开发者ID:feyeandal,项目名称:inasafe,代码行数:14,代码来源:test_keywords_dialog.py

示例7: test_on_pbn_remove_clicked

# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import add_list_entry [as 别名]
    def test_on_pbn_remove_clicked(self):
        """Test pressing remove works on key list"""
        dialog = KeywordsDialog(PARENT, IFACE)
        dialog.reset(False)

        result = dialog.lstKeywords.count()
        expected_result = 0
        message = '\nGot: %s\nExpected: %s\n' % (result, expected_result)
        self.assertEqual(result, expected_result, message)

        dialog.add_list_entry('bar', 'foo')
        result = dialog.lstKeywords.count()
        expected_result = 1
        message = '\nGot: %s\nExpected: %s\n' % (result, expected_result)
        self.assertEqual(result, expected_result, message)
开发者ID:cccs-ip,项目名称:inasafe,代码行数:17,代码来源:test_keywords_dialog.py

示例8: test_on_pbnRemove_clicked

# 需要导入模块: from safe_qgis.tools.keywords_dialog import KeywordsDialog [as 别名]
# 或者: from safe_qgis.tools.keywords_dialog.KeywordsDialog import add_list_entry [as 别名]
    def test_on_pbnRemove_clicked(self):
        """Test pressing remove works on key list"""
        myDialog = KeywordsDialog(PARENT, IFACE)
        myDialog.reset(False)

        myResult = myDialog.lstKeywords.count()
        myExpectedResult = 0
        myMessage = ('\nGot: %s\nExpected: %s\n' %
                     (myResult, myExpectedResult))
        #print 'Dict', myDialog.getKeywords()
        assert myResult == myExpectedResult, myMessage

        myDialog.add_list_entry('bar', 'foo')
        myResult = myDialog.lstKeywords.count()
        myExpectedResult = 1
        myMessage = ('\nGot: %s\nExpected: %s\n' %
                     (myResult, myExpectedResult))
        #print 'Dict', myDialog.getKeywords()
        assert myResult == myExpectedResult, myMessage
开发者ID:feyeandal,项目名称:inasafe,代码行数:21,代码来源:test_keywords_dialog.py


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