def _GetPathFromIconNum(self, iconNum): parts = iconNum.split('_') if len(parts) == 2: sheet, iconNum = parts iconSize = uix.GetIconSize(sheet) return 'res:/ui/texture/icons/%s_%s_%s.png' % ( int(sheet), int(iconSize), int(iconNum)) elif len(parts) == 4: root, sheet, iconSize, iconNum = parts return 'res:/ui/texture/icons/%s_%s_%s.png' % ( int(sheet), int(iconSize), int(iconNum)) else: return 'res:/ui/texture/icons/105_64_45.png'
def LoadIcon(self, *args): sprite = uiprimitives.Sprite(parent=self, align=uiconst.TOALL, state=uiconst.UI_DISABLED, idx=0, pos=(0, 0, 0, 0)) if not hasattr(self, 'attrs'): return icon = self.attrs.src[5:] if isinstance(icon, unicode): icon = icon.encode('ascii', 'xmlcharrefreplace') spl = icon.split('_') if len(spl) == 2: texpix, num = spl iconSize = uix.GetIconSize(texpix) icon = 'ui_%s_%s_%s' % (texpix, iconSize, num) uiutil.MapIcon(sprite, icon, ignoreSize=True)
def _GetPathFromIconNum(self, iconNum): if iconNum.startswith('res:/'): return iconNum parts = iconNum.split('_') if len(parts) == 2: sheet, iconNum = parts iconSize = uix.GetIconSize(sheet) return 'res:/ui/texture/icons/%s_%s_%s.png' % ( int(sheet), int(iconSize), int(iconNum)) elif len(parts) == 4: root, sheet, iconSize, iconNum = parts if root == 'ui': root = 'icons' return 'res:/ui/texture/%s/%s_%s_%s.png' % ( root, int(sheet), int(iconSize), int(iconNum)) else: return neocomCommon.ICONPATH_DEFAULT
def ConvertIconNoToResPath(self, iconNo): resPath = None parts = iconNo.split('_') if len(parts) == 2: sheet, iconNum = parts iconSize = uix.GetIconSize(sheet) resPath = 'res:/ui/texture/icons/%s_%s_%s.png' % (int(sheet), int(iconSize), int(iconNum)) if iconNo.startswith('corps_'): resPath = 'res:/ui/texture/corps/' + iconNo[6:] + '.png' iconSize = 128 elif iconNo.startswith('alliance_'): resPath = 'res:/ui/texture/alliance/' + iconNo[9:] + '.png' iconSize = 128 elif iconNo.startswith('c_'): c, sheet, iconNum = parts resPath = 'res:/ui/texture/corps/%s_128_%s.png' % (int(sheet), int(iconNum)) iconSize = 128 elif iconNo.startswith('a_'): a, sheet, iconNum = parts resPath = 'res:/ui/texture/alliance/%s_128_%s.png' % (int(sheet), int(iconNum)) iconSize = 128 if resPath: return (resPath, iconSize) print 'MISSING CONVERSION HANDLING FOR', iconNo