[qooxdoo-commit] SF.net SVN: qooxdoo:[18197] trunk/qooxdoo/tool/pylib/generator
Brought to you by:
ecker,
martinwittemann
From: <th...@us...> - 2009-02-27 17:22:58
|
Revision: 18197 http://qooxdoo.svn.sourceforge.net/qooxdoo/?rev=18197&view=rev Author: thron7 Date: 2009-02-27 17:22:39 +0000 (Fri, 27 Feb 2009) Log Message: ----------- [BUG #2011] add caching of ImageInfo and locale (CLDR) data Modified Paths: -------------- trunk/qooxdoo/tool/pylib/generator/Generator.py trunk/qooxdoo/tool/pylib/generator/action/ImageInfo.py trunk/qooxdoo/tool/pylib/generator/action/Locale.py Modified: trunk/qooxdoo/tool/pylib/generator/Generator.py =================================================================== --- trunk/qooxdoo/tool/pylib/generator/Generator.py 2009-02-27 16:45:49 UTC (rev 18196) +++ trunk/qooxdoo/tool/pylib/generator/Generator.py 2009-02-27 17:22:39 UTC (rev 18197) @@ -1312,7 +1312,7 @@ imgpath= resource #imguri = resource[1] imguri = resource - imageInfo = self._imageInfo.getImageInfo(imgpath) + imageInfo = self._imageInfo.getImageInfo(imgpath, assetId) # use an ImgInfoFmt object, to abstract from flat format imgfmt = ImgInfoFmt() Modified: trunk/qooxdoo/tool/pylib/generator/action/ImageInfo.py =================================================================== --- trunk/qooxdoo/tool/pylib/generator/action/ImageInfo.py 2009-02-27 16:45:49 UTC (rev 18196) +++ trunk/qooxdoo/tool/pylib/generator/action/ImageInfo.py 2009-02-27 17:22:39 UTC (rev 18197) @@ -46,20 +46,29 @@ return result - def getImageInfo(self, fileName): + def getImageInfo(self, fileName, assetId): img = fileName - if memcache.has_key(img): - return memcache[img] + #if memcache.has_key(img): + # return memcache[img] + + cacheId = "img-%s" % assetId + + imgInfo = self._cache.readmulti(cacheId, fileName) + if imgInfo != None: + return imgInfo self._console.debug("Analysing image: %s" % img) #mo = self.imgpatt.search(img) imgInfo = ImgInfo(img).getInfo() if imgInfo: - result = memcache[img] = {'width': imgInfo[0], 'height': imgInfo[1], 'type': imgInfo[2]} + #result = memcache[img] = {'width': imgInfo[0], 'height': imgInfo[1], 'type': imgInfo[2]} + result = {'width': imgInfo[0], 'height': imgInfo[1], 'type': imgInfo[2]} else: result = {} + self._cache.writemulti(cacheId, result) + return result Modified: trunk/qooxdoo/tool/pylib/generator/action/Locale.py =================================================================== --- trunk/qooxdoo/tool/pylib/generator/action/Locale.py 2009-02-27 16:45:49 UTC (rev 18196) +++ trunk/qooxdoo/tool/pylib/generator/action/Locale.py 2009-02-27 17:22:39 UTC (rev 18197) @@ -48,9 +48,18 @@ locale = "en" else: locale = entry - self._console.debug("Processing locale: %s" % locale) - data[entry] = cldr.parseCldrFile(os.path.join(root, "%s.xml" % locale)) + locFile = os.path.join(root, "%s.xml" % locale) + cacheId = "locale-%s" % locale + + locDat = self._cache.read(cacheId, locFile) + if locDat == None: + self._console.debug("Processing locale: %s" % locale) + locDat = cldr.parseCldrFile(locFile) + self._cache.write(cacheId, locDat) + + data[entry] = locDat + self._console.outdent() return data This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |