|
1 <?xml version="1.0" encoding="UTF-8"?> |
|
2 <container xmlns="http://www.symbianfoundation.org/xml/implml/1"> |
|
3 |
|
4 <container> |
|
5 <phase name="pre"/> |
|
6 <tag name="target" value="rofs3"/> |
|
7 |
|
8 <ruleml xmlns="http://www.s60.com/xml/ruleml/3"> |
|
9 <rule> |
|
10 ${HbTheme.UIThemeFile} configures ${HbTheme.HbDefaultTheme} = {% get_themename_from_thx( ${HbTheme.UIThemeFile}, 'themes' ) %} |
|
11 </rule> |
|
12 <rule> |
|
13 ${HbTheme.PriorityThemeFile} configures ${HbTheme.HbPriorityThemeName} = {% get_themename_from_thx( ${HbTheme.PriorityThemeFile}, 'prioritytheme' ) %} |
|
14 </rule> |
|
15 <eval_globals> |
|
16 |
|
17 import sys, zipfile, os, os.path |
|
18 import tempfile |
|
19 import shutil |
|
20 |
|
21 def get_themename_from_thx(file, themesfolder): |
|
22 ret = None |
|
23 |
|
24 outdir = get_output_folder() |
|
25 outdir = os.path.join(outdir, 'resource') |
|
26 if not os.path.exists(outdir): |
|
27 os.mkdir(outdir) |
|
28 outdir = os.path.join(outdir, 'hb') |
|
29 if not os.path.exists(outdir): |
|
30 os.mkdir(outdir) |
|
31 outdir = os.path.join(outdir, themesfolder) |
|
32 if not os.path.exists(outdir): |
|
33 os.mkdir(outdir) |
|
34 unzip_file_into_dir(file, outdir) |
|
35 |
|
36 # Get filesnames in outdir |
|
37 files_in_dir = os.listdir(outdir) |
|
38 |
|
39 # Search for themeindex file |
|
40 for fn in files_in_dir: |
|
41 if os.path.splitext(fn)[1] == '.themeindex': |
|
42 ret = os.path.splitext(fn)[0] |
|
43 |
|
44 return ret |
|
45 |
|
46 def unzip_file_into_dir(file, dir): |
|
47 """ |
|
48 Unzips file into given folder. |
|
49 """ |
|
50 |
|
51 zfobj = zipfile.ZipFile(file,'r') |
|
52 for name in zfobj.namelist(): |
|
53 if name.endswith('/'): |
|
54 os.mkdir(os.path.join(dir, name)) |
|
55 else: |
|
56 outfile = open(os.path.join(dir, name), 'wb') |
|
57 outfile.write(zfobj.read(name)) |
|
58 outfile.close() |
|
59 |
|
60 def get_output_folder(): |
|
61 output = ruleml.context.output |
|
62 output = os.path.join(output, 'content') |
|
63 if not os.path.exists(output): |
|
64 os.mkdir(output) |
|
65 |
|
66 return output |
|
67 |
|
68 </eval_globals> |
|
69 |
|
70 </ruleml> |
|
71 </container> |
|
72 |
|
73 <container> |
|
74 <phase name="normal"/> |
|
75 <tag name="target" value="rofs3"/> |
|
76 |
|
77 <content xmlns="http://www.s60.com/xml/content/2"> |
|
78 <output dir=""> |
|
79 <input dir="content"/> |
|
80 </output> |
|
81 </content> |
|
82 </container> |
|
83 |
|
84 </container> |