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


Python IconsCollection.getIcons方法代码示例

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


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

示例1: testGroups_02

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testGroups_02(self):
        collection = IconsCollection('../test/icons/Только группы')

        self.assertEqual(len(collection.getIcons(None)), 0)
        self.assertEqual(collection.getGroups(), ['Группа 3', 'Группа 4'])
        self.assertEqual(len(collection.getIcons('Группа 3')), 3)
        self.assertEqual(len(collection.getIcons('Группа 4')), 4)
        self.assertIsNone(collection.getCover(None))
开发者ID:Jenyay,项目名称:outwiker,代码行数:10,代码来源:test_iconscollection.py

示例2: testGroups_01

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testGroups_01 (self):
        collection = IconsCollection (u'../test/icons/Иконки и группы')

        self.assertEqual (len (collection.getIcons(None)), 4)
        self.assertEqual (collection.getGroups(), [u'Группа 1', u'Группа 2'])
        self.assertEqual (len (collection.getIcons (u'Группа 1')), 3)
        self.assertEqual (len (collection.getIcons (u'Группа 2')), 4)
        self.assertIsNone (collection.getCover(None))
        self.assertTrue (collection.getCover(u'Группа 1').endswith (u'__cover.png'))
        self.assertIsNone (collection.getCover(u'Группа 2'))
开发者ID:LihMeh,项目名称:outwiker,代码行数:12,代码来源:iconscollection.py

示例3: testAddIcons_19_resize

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testAddIcons_19_resize(self):
        files = ['16x16.png',
                 '16x15.png',
                 '16x17.png',
                 '15x16.png',
                 '17x16.png',
                 '17x17.png',
                 '15x15.png',
                 '8x8.png',
                 '8x16.png',
                 '16x8.png',
                 'first.png',
                 'first_vertical.png']

        fullPaths = [os.path.join(self.imagesDir, fname) for fname in files]

        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)
        collection.addIcons(None, fullPaths)

        icons = sorted(collection.getIcons(None))
        self.assertEqual(len(icons), 12)

        icons = {fname: os.path.join(self.tempDir1, fname) for fname in files}

        for fname in files:
            self.assertEqual(getImageSize(icons[fname]), (16, 16))
开发者ID:Jenyay,项目名称:outwiker,代码行数:29,代码来源:test_iconscollection.py

示例4: testRenameGroup_04_self

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testRenameGroup_04_self(self):
        files = ['new.png', 'image_01.JPG']
        fullPaths = [os.path.join(self.imagesDir, fname) for fname in files]
        os.mkdir(self.tempDir1)

        collection = IconsCollection(self.tempDir1)
        collection.addGroup('Новая группа')
        collection.addIcons('Новая группа', fullPaths)

        collection.renameGroup('Новая группа', 'Новая группа')
        self.assertEqual(collection.getGroups(), ['Новая группа'])
        self.assertEqual(len(collection.getIcons('Новая группа')), 2)

        newcollection = IconsCollection(self.tempDir1)
        self.assertEqual(newcollection.getGroups(), ['Новая группа'])
        self.assertEqual(len(newcollection.getIcons('Новая группа')), 2)
开发者ID:Jenyay,项目名称:outwiker,代码行数:18,代码来源:test_iconscollection.py

示例5: _getGroupsInfo

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def _getGroupsInfo(self):
        result = []

        for n, path in enumerate(getIconsDirList()):
            # First None is root directory
            collection = IconsCollection(path)
            for groupname in [None] + sorted(collection.getGroups(), key=self._localize):
                # Get group name
                if groupname is None:
                    title = _(u'Not in groups')
                else:
                    title = self._localize(groupname)

                iconslist = collection.getIcons(groupname)
                cover = collection.getCover(groupname)
                if cover is None:
                    cover = self._default_group_cover

                group_type = (IconsGroupInfo.TYPE_BUILTIN if n == 0
                              else IconsGroupInfo.TYPE_CUSTOM)

                result.append(IconsGroupInfo(iconslist,
                                             title,
                                             cover,
                                             group_type=group_type,
                                             sort_key=os.path.basename))

        self._addRecentIconsGroup(result)
        eventParam = IconsGroupsListInitParams(result)
        self._application.onIconsGroupsListInit(self._page, eventParam)

        return eventParam.groupsList
开发者ID:Jenyay,项目名称:outwiker,代码行数:34,代码来源:iconspanel.py

示例6: testEmpty_02

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testEmpty_02(self):
        collection = IconsCollection('../test/icons/Без иконок')

        self.assertEqual(collection.getIcons(None), [])
        self.assertEqual(collection.getGroups(), [])
        self.assertRaises(KeyError, collection.getIcons, 'Группа')
        self.assertRaises(KeyError, collection.getCover, 'Группа')
        self.assertIsNone(collection.getCover(''))
开发者ID:Jenyay,项目名称:outwiker,代码行数:10,代码来源:test_iconscollection.py

示例7: testAddIcons_03_empty

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testAddIcons_03_empty(self):
        files = []
        fullPaths = [os.path.join(self.imagesDir, fname) for fname in files]

        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)

        collection.addIcons('', fullPaths)
        self.assertEqual(collection.getIcons(None), [])
开发者ID:Jenyay,项目名称:outwiker,代码行数:11,代码来源:test_iconscollection.py

示例8: testAddIcons_02_empty

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testAddIcons_02_empty (self):
        files = []
        fullPaths = [os.path.join (self.imagesDir, fname) for fname in files]

        os.mkdir (self.tempDir1)
        collection = IconsCollection (self.tempDir1)
        collection.addGroup (u'Новая группа')

        collection.addIcons (u'Новая группа', fullPaths)
        self.assertEqual (collection.getIcons (u'Новая группа'), [])
开发者ID:LihMeh,项目名称:outwiker,代码行数:12,代码来源:iconscollection.py

示例9: testAddIcons_06

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testAddIcons_06(self):
        files = ['new.png']
        fullPaths = [os.path.join(self.imagesDir, fname) for fname in files]

        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)

        collection.addIcons(None, fullPaths)

        icons = collection.getIcons(None)
        self.assertIn('new.png', icons[0])
开发者ID:Jenyay,项目名称:outwiker,代码行数:13,代码来源:test_iconscollection.py

示例10: testAddIcons_07

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testAddIcons_07 (self):
        files = [u'new.png', u'image_01.JPG']
        fullPaths = [os.path.join (self.imagesDir, fname) for fname in files]

        os.mkdir (self.tempDir1)
        collection = IconsCollection (self.tempDir1)

        collection.addIcons (None, fullPaths)

        icons = sorted (collection.getIcons (None))
        self.assertIn (u'image_01.png', icons[0])
        self.assertIn (u'new.png', icons[1])
开发者ID:LihMeh,项目名称:outwiker,代码行数:14,代码来源:iconscollection.py

示例11: testAddIcons_16_invalid

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testAddIcons_16_invalid(self):
        files = ['invalid.png']
        fullPaths = [os.path.join(self.imagesDir, fname) for fname in files]

        groupname = 'Новая группа'

        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)
        collection.addGroup(groupname)

        collection.addIcons(groupname, fullPaths)

        icons = sorted(collection.getIcons(groupname))
        self.assertEqual(len(icons), 0)
开发者ID:Jenyay,项目名称:outwiker,代码行数:16,代码来源:test_iconscollection.py

示例12: testAddIcons_13

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testAddIcons_13(self):
        files = ['__sample.png']
        fullPaths = [os.path.join(self.imagesDir, fname) for fname in files]

        groupname = 'Новая группа'

        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)
        collection.addGroup(groupname)

        collection.addIcons(groupname, fullPaths)

        icons = sorted(collection.getIcons(groupname))
        self.assertEqual(len(icons), 1)
        self.assertNotIn('__sample.png', icons[0])
        self.assertIn('sample.png', icons[0])
开发者ID:Jenyay,项目名称:outwiker,代码行数:18,代码来源:test_iconscollection.py

示例13: testAddIcons_10_not_exists

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testAddIcons_10_not_exists(self):
        files = ['new.png', 'image_01.JPG', 'notexists.png']
        fullPaths = [os.path.join(self.imagesDir, fname) for fname in files]

        groupname = 'Новая группа'

        os.mkdir(self.tempDir1)
        collection = IconsCollection(self.tempDir1)
        collection.addGroup(groupname)

        collection.addIcons(groupname, fullPaths)

        icons = sorted(collection.getIcons(groupname))
        self.assertEqual(len(icons), 2)
        self.assertIn('image_01.png', icons[0])
        self.assertIn('new.png', icons[1])
开发者ID:Jenyay,项目名称:outwiker,代码行数:18,代码来源:test_iconscollection.py

示例14: testAddIcons_11

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testAddIcons_11 (self):
        files = [u'new.png', u'new.png']
        fullPaths = [os.path.join (self.imagesDir, fname) for fname in files]

        groupname = u'Новая группа'

        os.mkdir (self.tempDir1)
        collection = IconsCollection (self.tempDir1)
        collection.addGroup (groupname)

        collection.addIcons (groupname, fullPaths)

        icons = sorted (collection.getIcons (groupname))
        self.assertEqual (len (icons), 2)
        self.assertIn (u'new.png', icons[0])
        self.assertIn (u'new_(1).png', icons[1])
开发者ID:LihMeh,项目名称:outwiker,代码行数:18,代码来源:iconscollection.py

示例15: testSingleRoot

# 需要导入模块: from outwiker.core.iconscollection import IconsCollection [as 别名]
# 或者: from outwiker.core.iconscollection.IconsCollection import getIcons [as 别名]
    def testSingleRoot(self):
        collection = IconsCollection('../test/icons/Без групп')

        self.assertEqual(len(collection.getIcons(None)), 4)
        self.assertEqual(collection.getGroups(), [])
        self.assertTrue(collection.getCover(None).endswith('__cover.png'))
开发者ID:Jenyay,项目名称:outwiker,代码行数:8,代码来源:test_iconscollection.py


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