diff -r 02a1dd166f2b -r aa35df067ae7 confml/implml/hbtheme.implml --- a/confml/implml/hbtheme.implml Tue Jul 06 14:53:09 2010 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ - - - - - - - - - - ${HbTheme.UIThemeFile} configures ${HbTheme.HbDefaultTheme} = {% get_themename_from_thx( ${HbTheme.UIThemeFile}, 'themes' ) %} - - - ${HbTheme.PriorityThemeFile} configures ${HbTheme.HbPriorityThemeName} = {% get_themename_from_thx( ${HbTheme.PriorityThemeFile}, 'prioritytheme' ) %} - - - -import sys, zipfile, os, os.path -import tempfile -import shutil - -def get_themename_from_thx(file, themesfolder): - ret = None - - outdir = get_output_folder() - outdir = os.path.join(outdir, 'resource') - if not os.path.exists(outdir): - os.mkdir(outdir) - outdir = os.path.join(outdir, 'hb') - if not os.path.exists(outdir): - os.mkdir(outdir) - outdir = os.path.join(outdir, themesfolder) - if not os.path.exists(outdir): - os.mkdir(outdir) - unzip_file_into_dir(file, outdir) - - # Get filesnames in outdir - files_in_dir = os.listdir(outdir) - - # Search for themeindex file - for fn in files_in_dir: - if os.path.splitext(fn)[1] == '.themeindex': - ret = os.path.splitext(fn)[0] - - return ret - -def unzip_file_into_dir(file, dir): - """ - Unzips file into given folder. - """ - - zfobj = zipfile.ZipFile(file,'r') - for name in zfobj.namelist(): - if name.endswith('/'): - os.mkdir(os.path.join(dir, name)) - else: - outfile = open(os.path.join(dir, name), 'wb') - outfile.write(zfobj.read(name)) - outfile.close() - -def get_output_folder(): - output = ruleml.context.output - output = os.path.join(output, 'content') - if not os.path.exists(output): - os.mkdir(output) - - return output - - - - - - - - - - - - - - - - - -