Revision: 201025
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Tue, 06 Jul 2010 14:53:09 +0300
changeset 8 02a1dd166f2b
parent 7 2c88b93869a6
child 9 a03989fb355a
child 10 3bdc12ef1448
child 12 aa35df067ae7
Revision: 201025 Kit: 2010127
.hg_archival.txt
.hgtags
bin/extract.py
bin/installs.py
bin/rom.py
bin/svg2nvg.py
bin/sync.py
centralrepository/20022E82.txt
confml/confml/CI_hbtheme.confml
confml/confml/hbtheme.confml
confml/implml/hbtheme.crml
confml/implml/hbtheme_20022e82.crml
makeindex.mk
platformthemes.pro
rom/theme.theme.iby
src/animations/sfwhitetheme/animations.zip
src/effects/sfwhitetheme/applications.zip
src/effects/sfwhitetheme/effects.zip
src/effects/sfwhitetheme/widgets.zip
src/icons/sfblacktheme/scalable/applications.zip
src/icons/sfblacktheme/scalable/icons.zip
src/icons/sfblacktheme/scalable/widgets.zip
src/icons/sfwhitetheme/scalable/applications.zip
src/icons/sfwhitetheme/scalable/icons.zip
src/icons/sfwhitetheme/scalable/widgets.zip
src/style/sfblacktheme/variables/color/hbapplicationcolorgroup.css
src/style/sfblacktheme/variables/color/hbwidgetcolorgroup.css
src/style/sfwhitetheme/variables/color/hbapplicationcolorgroup.css
src/style/sfwhitetheme/variables/color/hbwidgetcolorgroup.css
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/.hg_archival.txt	Tue Jul 06 14:53:09 2010 +0300
@@ -0,0 +1,2 @@
+repo: 3d51a84f3bf4dec77d58f1fac7210a6385dd25ec
+node: 2103b889d8045565157030549ac7e0805672f8a4
--- a/.hgtags	Wed Jun 23 18:49:37 2010 +0300
+++ b/.hgtags	Tue Jul 06 14:53:09 2010 +0300
@@ -14,3 +14,5 @@
 280b969636c8b48588392f9b5fb91f215d0a7333 2010wk21_rc
 939c40e61bc5445a2257a72882ee36f7b4c933ff 2010wk21_rel
 5cb3a8613dd1bec9f1463066dca3e14bc949f41e 2010wk23_rc
+0be404b69d35728f6b7f252b1a332d7303263783 2010wk23_rel
+4a7ffa9f281804f1ba41c9d7886fbed0bb2cce42 2010wk25_rc
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/extract.py	Tue Jul 06 14:53:09 2010 +0300
@@ -0,0 +1,173 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# ============================================================================
+#  Name        : extract.py
+#  Part of     : Hb
+#  Description : Hb themes script for extracting theme archives
+#  Version     : %version: %
+#
+#  Copyright (c) 2008-2010 Nokia.  All rights reserved.
+#  This material, including documentation and any related computer
+#  programs, is protected by copyright controlled by Nokia.  All
+#  rights are reserved.  Copying, including reproducing, storing,
+#  adapting or translating, any or all of this material requires the
+#  prior written consent of Nokia.  This material also contains
+#  confidential information which may not be disclosed to others
+#  without the prior written consent of Nokia.
+# ============================================================================
+
+import os
+import re
+import sys
+import shutil
+import zipfile
+import fnmatch
+import optparse
+
+# ============================================================================
+# Globals
+# ============================================================================
+VERBOSE = False
+INPUT_DIR = os.getcwd()
+OUTPUT_DIR = os.getcwd()
+INCLUDE = None
+EXCLUDE = None
+
+# ============================================================================
+# OptionParser
+# ============================================================================
+class OptionParser(optparse.OptionParser):
+    def __init__(self):
+        optparse.OptionParser.__init__(self)
+        self.add_option("-v", "--verbose", action="store_true", dest="verbose",
+                        help="print verbose information about each step of the sync process")
+        self.add_option("-q", "--quiet", action="store_false", dest="verbose",
+                        help="do not print information about each step of the sync process")
+        self.add_option("-i", "--input", dest="input", metavar="dir",
+                        help="specify the input <dir> (default %s)" % INPUT_DIR)
+        self.add_option("-o", "--output", dest="output", metavar="dir",
+                        help="specify the output <dir> (default %s)" % OUTPUT_DIR)
+        self.add_option("--include", dest="include", action="append", metavar="pattern",
+                        help="specify the include <pattern> (default %s)" % INCLUDE)
+        self.add_option("--exclude", dest="exclude", action="append", metavar="pattern",
+                        help="specify the exclude <pattern> (default %s)" % EXCLUDE)
+
+# ============================================================================
+# Utils
+# ============================================================================
+if not hasattr(os.path, "relpath"):
+    def relpath(path, start=os.curdir):
+        abspath = os.path.abspath(path)
+        absstart = os.path.abspath(start)
+        if abspath == absstart:
+            return "."
+        i = len(absstart)
+        if not absstart.endswith(os.path.sep):
+            i += len(os.path.sep)
+        if not abspath.startswith(absstart):
+            i = 0
+        return abspath[i:]
+    os.path.relpath = relpath
+
+def extract(archive):
+    global INPUT_DIR, OUTPUT_DIR
+
+    path, filename = os.path.split(archive)
+    relpath = os.path.relpath(path, INPUT_DIR)
+    outpath = os.path.join(OUTPUT_DIR, relpath)
+
+    # extract
+    zip = zipfile.ZipFile(archive)
+    for name in zip.namelist():
+        data = zip.read(name)
+        outfile = os.path.join(outpath, name)
+        # overwrite only if different size
+        if not os.path.exists(outfile) or os.path.getsize(outfile) != len(data):
+            file = open(outfile, "w")
+            file.write(data)
+            file.close()
+
+def include_exclude(filepath):
+    global INCLUDE, EXCLUDE
+    result = True
+    if INCLUDE != None:
+        for pattern in INCLUDE:
+            if not fnmatch.fnmatch(filepath, pattern):
+                result = False
+    if EXCLUDE != None:
+        for pattern in EXCLUDE:
+            if fnmatch.fnmatch(filepath, pattern):
+                result = False
+    return result
+
+# ============================================================================
+# main()
+# ============================================================================
+def main():
+    global VERBOSE, INPUT_DIR, OUTPUT_DIR, INCLUDE, EXCLUDE
+
+    parser = OptionParser()
+    (options, args) = parser.parse_args()
+
+    if options.verbose != None:
+        VERBOSE = options.verbose
+    if options.input != None:
+        INPUT_DIR = options.input
+    if options.output != None:
+        OUTPUT_DIR = options.output
+    if options.include != None:
+        INCLUDE = options.include
+    if options.exclude != None:
+        EXCLUDE = options.exclude
+
+    extracted = 0
+    copied = 0
+    omitted = 0
+    workpath = None
+    newline = False
+    sys.stdout.write("Processing: ")
+    for root, dirs, files in os.walk(INPUT_DIR):
+        for file in files:
+            filepath = os.path.join(root, file)
+            extension = os.path.splitext(file)[1]
+            if include_exclude(filepath):
+                # ensure that output dir exists
+                relfilepath = os.path.relpath(filepath, INPUT_DIR)
+                relpath = os.path.split(relfilepath)[0]
+                outpath = os.path.join(OUTPUT_DIR, relpath)
+                if not os.path.exists(outpath):
+                    os.makedirs(outpath)
+
+                # output processing dir info
+                tmppath = os.path.split(filepath)[0]
+                if tmppath != workpath:
+                    if workpath != None:
+                        newline = True
+                        sys.stdout.write("\n            ")
+                    workpath = tmppath
+                    sys.stdout.write(os.path.relpath(workpath, INPUT_DIR).replace("\\", "/"))
+                    sys.stdout.write(".")
+                else:
+                    sys.stdout.write(".")
+
+                # extract zips
+                if extension == ".zip":
+                    extracted += 1
+                    extract(filepath)
+                # copy others
+                else:
+                    copied += 1
+                    shutil.copy(filepath, outpath)
+            else:
+                omitted += 1
+    if newline:
+        sys.stdout.write("\n")
+    print "        ==> %s archives(s) extracted" % extracted
+    print "        ==> %s file(s) copied" % copied
+    print "        ==> %s file(s) omitted" % omitted
+
+    return 0
+
+if __name__ == "__main__":
+    sys.exit(main())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/installs.py	Tue Jul 06 14:53:09 2010 +0300
@@ -0,0 +1,138 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# ============================================================================
+#  Name        : installs.py
+#  Part of     : Hb
+#  Description : Hb themes script for generating installs.pri
+#  Version     : %version: %
+#
+#  Copyright (c) 2008-2010 Nokia.  All rights reserved.
+#  This material, including documentation and any related computer
+#  programs, is protected by copyright controlled by Nokia.  All
+#  rights are reserved.  Copying, including reproducing, storing,
+#  adapting or translating, any or all of this material requires the
+#  prior written consent of Nokia.  This material also contains
+#  confidential information which may not be disclosed to others
+#  without the prior written consent of Nokia.
+# ============================================================================
+
+import os
+import re
+import sys
+import fnmatch
+import optparse
+import posixpath
+
+# ============================================================================
+# Globals
+# ============================================================================
+INPUT_DIR = os.getcwd()
+OUTPUT_DIR = os.getcwd()
+INCLUDE = None
+EXCLUDE = None
+
+# ============================================================================
+# OptionParser
+# ============================================================================
+class OptionParser(optparse.OptionParser):
+    def __init__(self):
+        optparse.OptionParser.__init__(self)
+        self.add_option("-i", "--input", dest="input", metavar="dir",
+                        help="specify the input <dir> (default %s)" % INPUT_DIR)
+        self.add_option("-o", "--output", dest="output", metavar="dir",
+                        help="specify the output <dir> (default %s)" % OUTPUT_DIR)
+        self.add_option("--include", dest="include", action="append", metavar="pattern",
+                        help="specify the include <pattern> (default %s)" % INCLUDE)
+        self.add_option("--exclude", dest="exclude", action="append", metavar="pattern",
+                        help="specify the exclude <pattern> (default %s)" % EXCLUDE)
+
+# ============================================================================
+# Utils
+# ============================================================================
+if not hasattr(os.path, "relpath"):
+    def relpath(path, start=os.curdir):
+        abspath = os.path.abspath(path)
+        absstart = os.path.abspath(start)
+        if abspath == absstart:
+            return "."
+        i = len(absstart)
+        if not absstart.endswith(os.path.sep):
+            i += len(os.path.sep)
+        if not abspath.startswith(absstart):
+            i = 0
+        return abspath[i:]
+    os.path.relpath = relpath
+
+def make_target(path):
+    # generate a compatible make target name from path
+    target = os.path.splitdrive(path)[1].strip("\\/")
+    return "_".join(re.split("[\\\/\.]+", target))
+
+def write_pri(filepath, input_dir):
+    outpath = os.path.dirname(filepath)
+    if not os.path.exists(outpath):
+        os.makedirs(outpath)
+    out = open(filepath, "w")
+
+    roots = []
+    for root, dirs, files in os.walk(input_dir):
+        for file in files:
+            filepath = os.path.abspath(root + "/" + file).replace("\\", "/")
+            filepath = os.path.splitdrive(filepath)[1]
+            if include_exclude(filepath):
+                target = make_target(root)
+                relpath = os.path.relpath(root, input_dir).replace("\\", "/")
+                if os.path.splitext(file)[1] == ".zip":
+                    out.write("symbian:BLD_INF_RULES.prj_exports += \":zip %s $${EPOCROOT}epoc32/data/z/resource/hb/themes/%s/\"\n" % (filepath, relpath))
+                    out.write("symbian:BLD_INF_RULES.prj_exports += \":zip %s $${EPOCROOT}epoc32/winscw/c/resource/hb/themes/%s/\"\n" % (filepath, relpath))
+                    out.write("!isEmpty(%s.commands): %s.commands += &&\n" % (target, target))
+                    out.write("%s.commands += $$QMAKE_UNZIP %s -d $$(HB_THEMES_DIR)/themes/%s\n" % (target, filepath, relpath))
+                else:
+                    out.write("symbian:BLD_INF_RULES.prj_exports += \"%s $${EPOCROOT}epoc32/data/z/resource/hb/themes/%s/\"\n" % (filepath, relpath))
+                    out.write("symbian:BLD_INF_RULES.prj_exports += \"%s $${EPOCROOT}epoc32/winscw/c/resource/hb/themes/%s/\"\n" % (filepath, relpath))
+                    out.write("%s.files += %s\n" % (target, filepath))
+                if root not in roots:
+                    out.write("%s.CONFIG += no_build\n" % target)
+                    out.write("%s.path = $$(HB_THEMES_DIR)/themes/%s\n" % (target, relpath))
+                    out.write("INSTALLS += %s\n" % target)
+                    roots.append(root)
+    out.close()
+    return 0
+
+def include_exclude(filepath):
+    global INCLUDE, EXCLUDE
+    result = True
+    if INCLUDE != None:
+        for pattern in INCLUDE:
+            if not fnmatch.fnmatch(filepath, pattern):
+                result = False
+    if EXCLUDE != None:
+        for pattern in EXCLUDE:
+            if fnmatch.fnmatch(filepath, pattern):
+                result = False
+    return result
+
+# ============================================================================
+# main()
+# ============================================================================
+def main():
+    global INPUT_DIR, OUTPUT_DIR, INCLUDE, EXCLUDE
+
+    parser = OptionParser()
+    (options, args) = parser.parse_args()
+
+    if options.input != None:
+        INPUT_DIR = options.input
+    if options.output != None:
+        OUTPUT_DIR = options.output
+    if options.include != None:
+        INCLUDE = options.include
+    if options.exclude != None:
+        EXCLUDE = options.exclude
+
+    print "Generating: %s/installs.pri" % os.path.basename(OUTPUT_DIR)
+    return write_pri(OUTPUT_DIR + "/installs.pri", INPUT_DIR)
+
+if __name__ == "__main__":
+    sys.exit(main())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/rom.py	Tue Jul 06 14:53:09 2010 +0300
@@ -0,0 +1,217 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# ============================================================================
+#  Name        : rom.py
+#  Part of     : Hb
+#  Description : Hb themes script for generating IBY files
+#  Version     : %version: %
+#
+#  Copyright (c) 2008-2010 Nokia.  All rights reserved.
+#  This material, including documentation and any related computer
+#  programs, is protected by copyright controlled by Nokia.  All
+#  rights are reserved.  Copying, including reproducing, storing,
+#  adapting or translating, any or all of this material requires the
+#  prior written consent of Nokia.  This material also contains
+#  confidential information which may not be disclosed to others
+#  without the prior written consent of Nokia.
+# ============================================================================
+
+import os
+import sys
+import fnmatch
+import zipfile
+import optparse
+import posixpath
+
+# ============================================================================
+# Globals
+# ============================================================================
+VERBOSE = False
+INCLUDE = None
+EXCLUDE = None
+INPUT_DIR = os.getcwd()
+OUTPUT_DIR = os.getcwd()
+SOURCE_PREFIX = "ZRESOURCE/hb/themes"
+TARGET_PREFIX = "RESOURCE_FILES_DIR/hb/themes"
+EXIT_STATUS = 0
+
+# ============================================================================
+# OptionParser
+# ============================================================================
+class OptionParser(optparse.OptionParser):
+    def __init__(self):
+        optparse.OptionParser.__init__(self)
+        self.add_option("-v", "--verbose", action="store_true", dest="verbose",
+                        help="print verbose information about each step of the sync process")
+        self.add_option("-q", "--quiet", action="store_false", dest="verbose",
+                        help="do not print information about each step of the sync process")
+
+        group = optparse.OptionGroup(self, "Input/output options")
+        group.add_option("-i", "--input", dest="input", metavar="dir",
+                         help="specify the input <dir> (default %s)" % INPUT_DIR)
+        group.add_option("-o", "--output", dest="output", metavar="dir",
+                         help="specify the output <dir> (default %s)" % OUTPUT_DIR)
+        group.add_option("--include", dest="include", action="append", metavar="pattern",
+                         help="specify the include <pattern> (default %s)" % INCLUDE)
+        group.add_option("--exclude", dest="exclude", action="append", metavar="pattern",
+                         help="specify the exclude <pattern> (default %s)" % EXCLUDE)
+        self.add_option_group(group)
+
+        group = optparse.OptionGroup(self, "Prefix options")
+        group.add_option("--source-prefix", dest="sourceprefix", metavar="prefix",
+                         help="specify the source <prefix> (default %s)" % SOURCE_PREFIX)
+        group.add_option("--target-prefix", dest="targetprefix", metavar="prefix",
+                         help="specify the target <prefix> (default %s)" % TARGET_PREFIX)
+        self.add_option_group(group)
+
+# ============================================================================
+# Utils
+# ============================================================================
+if not hasattr(os.path, "relpath"):
+    def relpath(path, start=os.curdir):
+        abspath = os.path.abspath(path)
+        absstart = os.path.abspath(start)
+        if abspath == absstart:
+            return "."
+        i = len(absstart)
+        if not absstart.endswith(os.path.sep):
+            i += len(os.path.sep)
+        if not abspath.startswith(absstart):
+            i = 0
+        return abspath[i:]
+    os.path.relpath = relpath
+
+def zip_filelist(filepath):
+    files = list()
+    archive = zipfile.ZipFile(filepath)
+    for entry in archive.namelist():
+        if not entry.endswith("/"):
+            files.append(entry)
+    return files
+
+class Theme:
+    def __init__(self, name):
+        self.name = name
+        self.paths = []
+        self.files = {}
+        self.archives = {}
+
+    def initialize(self):
+        for path in self.paths:
+            for root, dirs, files in os.walk(path):
+                for file in files:
+                    filepath = posixpath.join(root, file).replace("\\", "/")
+                    if self._include(filepath):
+                        extension = os.path.splitext(filepath)[1]
+                        if extension == ".zip":
+                            if root not in self.archives:
+                                self.archives[root] = list()
+                            self.archives[root].append(filepath)
+                        else:
+                            if root not in self.files:
+                                self.files[root] = list()
+                            self.files[root].append(filepath)
+
+    def write_iby(self, ibypath):
+        global SOURCE_PREFIX, TARGET_PREFIX, EXIT_STATUS
+        outpath = os.path.dirname(ibypath)
+        if not os.path.exists(outpath):
+            os.makedirs(outpath)
+        out = open(ibypath, "w")
+        out.write("#ifndef __%s_IBY__\n" % self.name.upper())
+        out.write("#define __%s_IBY__\n" % self.name.upper())
+        out.write("\n")
+        out.write("#include <bldvariant.hrh>\n")
+        out.write("\n")
+        out.write("data=%s/%s.themeindex\t%s/%s.themeindex\n" % (SOURCE_PREFIX, self.name, TARGET_PREFIX, self.name))
+        written_entries = list()
+        for path, files in self.files.iteritems():
+            relpath = os.path.relpath(path, INPUT_DIR).replace("\\", "/")
+            for filepath in files:
+                filename = os.path.basename(filepath)
+                entry = posixpath.join(relpath, filename)
+                if entry not in written_entries:
+                    written_entries.append(filepath)
+                    out.write("data=%s/%s\t%s/%s\n" % (SOURCE_PREFIX, entry, TARGET_PREFIX, entry))
+                else:
+                    print "ERROR: %s duplicate entry %s" % (ibypath, entry)
+                    EXIT_STATUS = -1
+        for path, archives in self.archives.iteritems():
+            relpath = os.path.relpath(path, INPUT_DIR).replace("\\", "/")
+            for archive in archives:
+                files = zip_filelist(archive)
+                for filepath in files:
+                    entry = posixpath.join(relpath, filepath)
+                    if entry not in written_entries:
+                        written_entries.append(entry)
+                        out.write("data=%s/%s\t%s/%s\n" % (SOURCE_PREFIX, entry, TARGET_PREFIX, entry))
+                    else:
+                        print "ERROR: %s duplicate entry %s" % (ibypath, entry)
+                        EXIT_STATUS = -1
+        out.write("\n")
+        out.write("#endif __%s_IBY__\n" % self.name.upper())
+        out.close()
+
+    def _include(self, filepath):
+        result = True
+        if INCLUDE != None:
+            for pattern in INCLUDE:
+                if not fnmatch.fnmatch(filepath, pattern):
+                    result = False
+        if EXCLUDE != None:
+            for pattern in EXCLUDE:
+                if fnmatch.fnmatch(filepath, pattern):
+                    result = False
+        return result
+
+def lookup_themes(path):
+    themes = {}
+    if os.path.exists(path):
+        # base: effects, icons...
+        for base in os.listdir(path):
+            basepath = posixpath.join(path, base)
+            if os.path.isdir(basepath):
+                # theme: footheme, bartheme...
+                for theme in os.listdir(basepath):
+                    themepath = posixpath.join(basepath, theme)
+                    if os.path.isdir(themepath):
+                        if theme not in themes:
+                            themes[theme] = Theme(theme)
+                        themes[theme].paths.append(themepath)
+    return themes
+
+# ============================================================================
+# main()
+# ============================================================================
+def main():
+    global VERBOSE, INPUT_DIR, OUTPUT_DIR, INCLUDE, EXCLUDE, SOURCE_PREFIX, TARGET_PREFIX
+
+    parser = OptionParser()
+    (options, args) = parser.parse_args()
+
+    if options.verbose != None:
+        VERBOSE = options.verbose
+    if options.input != None:
+        INPUT_DIR = options.input
+    if options.output != None:
+        OUTPUT_DIR = options.output
+    if options.include != None:
+        INCLUDE = options.include
+    if options.exclude != None:
+        EXCLUDE = options.exclude
+    if options.sourceprefix != None:
+        SOURCE_PREFIX = options.sourceprefix
+    if options.targetprefix != None:
+        TARGET_PREFIX = options.targetprefix
+
+    themes = lookup_themes(INPUT_DIR)
+    for name, theme in themes.iteritems():
+        theme.initialize()
+        print "Generating: %s.iby" % name
+        theme.write_iby(posixpath.join(OUTPUT_DIR, "%s.iby" % name))
+
+    return EXIT_STATUS
+
+if __name__ == "__main__":
+    sys.exit(main())
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/svg2nvg.py	Tue Jul 06 14:53:09 2010 +0300
@@ -0,0 +1,142 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# ============================================================================
+#  Name        : svg2nvg.py
+#  Part of     : Hb
+#  Description : Hb themes script for converting SVG to NVG
+#  Version     : %version: %
+#
+#  Copyright (c) 2008-2010 Nokia.  All rights reserved.
+#  This material, including documentation and any related computer
+#  programs, is protected by copyright controlled by Nokia.  All
+#  rights are reserved.  Copying, including reproducing, storing,
+#  adapting or translating, any or all of this material requires the
+#  prior written consent of Nokia.  This material also contains
+#  confidential information which may not be disclosed to others
+#  without the prior written consent of Nokia.
+# ============================================================================
+
+import os
+import sys
+import optparse
+
+# ============================================================================
+# Globals
+# ============================================================================
+VERBOSE = False
+ENCODER = "svgtbinencode"
+INPUT_DIR = os.getcwd()
+
+# ============================================================================
+# OptionParser
+# ============================================================================
+class OptionParser(optparse.OptionParser):
+    def __init__(self):
+        optparse.OptionParser.__init__(self)
+        self.add_option("-v", "--verbose", action="store_true", dest="verbose",
+                        help="print verbose information about each step of the sync process")
+        self.add_option("-q", "--quiet", action="store_false", dest="verbose",
+                        help="do not print information about each step of the sync process")
+        self.add_option("-e", "--encoder", dest="encoder", metavar="encoder",
+                        help="specify the encoder (default %s)" % ENCODER)
+        self.add_option("-i", "--input", dest="input", metavar="dir",
+                        help="specify the input <dir> (default %s)" % INPUT_DIR)
+
+# ============================================================================
+# Functions
+# ============================================================================
+if not hasattr(os.path, "relpath"):
+    def relpath(path, start=os.curdir):
+        abspath = os.path.abspath(path)
+        absstart = os.path.abspath(start)
+        if abspath == absstart:
+            return "."
+        i = len(absstart)
+        if not absstart.endswith(os.path.sep):
+            i += len(os.path.sep)
+        if not abspath.startswith(absstart):
+            i = 0
+        return abspath[i:]
+    os.path.relpath = relpath
+
+def _print_summary(succeed, failed, omitted):
+    print "        ==> %s file(s) successfully converted" % succeed
+    print "        ==> %s file(s) failed to convert" % failed
+    print "        ==> %s file(s) omitted" % omitted
+
+def encode(path):
+    global VERBOSE, INPUT_DIR, ENCODER
+
+    failed = 0
+    succeed = 0
+    omitted = 0
+    workpath = None
+    newline = False
+
+    for root, dirs, files in os.walk(path):
+        i = 0
+        for file in files:
+            filepath = os.path.join(root, file)
+            basepath, extension = os.path.splitext(filepath)
+
+            if extension == ".svg":
+                tmppath = os.path.split(filepath)[0]
+                if tmppath != workpath:
+                    if workpath != None:
+                        newline = True
+                        sys.stdout.write("\n")
+                        _print_summary(succeed, failed, omitted)
+                    failed = 0
+                    succeed = 0
+                    omitted = 0
+                    workpath = tmppath
+                    sys.stdout.write("Converting: %s" % os.path.relpath(workpath, INPUT_DIR).replace("\\", "/"))
+                else:
+                    i += 1
+                    if i % 10 == 0:
+                        sys.stdout.write(".")
+
+                command = "%s -v 6 -e .nvg %s" % (ENCODER, filepath)
+                os.system(command)
+                exists = os.path.exists(basepath + ".nvg")
+                if exists:
+                    # cleanup conversion source (.svg)
+                    os.remove(filepath)
+                    succeed += 1
+                else:
+                    failed += 1
+                if VERBOSE:
+                    print "            %s: %s" % (file, exists)
+            elif extension == ".nvg":
+                # cleanup, from previous conversion
+                os.remove(filepath)
+            else:
+                omitted += 1
+
+    if newline:
+        sys.stdout.write("\n")
+    _print_summary(succeed, failed, omitted)
+
+# ============================================================================
+# main()
+# ============================================================================
+def main():
+    global VERBOSE, ENCODER, INPUT_DIR
+
+    parser = OptionParser()
+    (options, args) = parser.parse_args()
+
+    if options.verbose != None:
+        VERBOSE = options.verbose
+    if options.encoder != None:
+        ENCODER = options.encoder
+    if options.input != None:
+        INPUT_DIR = options.input
+
+    encode(INPUT_DIR)
+
+    return 0
+
+if __name__ == "__main__":
+    sys.exit(main())
--- a/bin/sync.py	Wed Jun 23 18:49:37 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,518 +0,0 @@
-#!/usr/bin/env python
-# -*- coding: utf-8 -*-
-#
-# ============================================================================
-#  Name        : sync.py
-#  Part of     : Hb
-#  Description : Hb themes sync script
-#  Version     : %version: %
-#
-#  Copyright (c) 2008-2010 Nokia.  All rights reserved.
-#  This material, including documentation and any related computer
-#  programs, is protected by copyright controlled by Nokia.  All
-#  rights are reserved.  Copying, including reproducing, storing,
-#  adapting or translating, any or all of this material requires the
-#  prior written consent of Nokia.  This material also contains
-#  confidential information which may not be disclosed to others
-#  without the prior written consent of Nokia.
-# ============================================================================
-
-import os
-import re
-import sys
-import time
-import copy
-import shutil
-import fnmatch
-import zipfile
-import optparse
-import tempfile
-import posixpath
-if sys.version_info[0] == 2 and sys.version_info[1] < 4:
-    # for scratchbox compatibility
-    import popen2
-else:
-    import subprocess
-
-# ============================================================================
-# Globals
-# ============================================================================
-VERBOSE = False
-ARCHIVES = False
-INCLUDE = None
-EXCLUDE = None
-INPUT_DIR = os.getcwd()
-OUTPUT_DIR = os.getcwd()
-IBY_SOURCE_PREFIX = "ZRESOURCE/hb/themes"
-IBY_TARGET_PREFIX = "RESOURCE_FILES_DIR/hb/themes"
-BLD_HW_TARGET_PREFIX = "/epoc32/data/z/resource/hb/themes"
-BLD_EMU_TARGET_PREFIX = "/epoc32/winscw/c/resource/hb/themes"
-BLD_TARGET_PREFIXES = []
-SYMBIAN = False
-EXIT_STATUS = 0
-NAME = "themes"
-THEME_COMMON = "themecommon"
-THEME_SETTINGS_FILE = "theme.theme"
-ENCODER = "SVGTBinEncode.exe"
-NVG = True
-
-# ============================================================================
-# OptionParser
-# ============================================================================
-class OptionParser(optparse.OptionParser):
-    def __init__(self):
-        optparse.OptionParser.__init__(self)
-        self.add_option("-v", "--verbose", action="store_true", dest="verbose",
-                        help="print verbose information about each step of the sync process")
-        self.add_option("-q", "--quiet", action="store_false", dest="verbose",
-                        help="do not print information about each step of the sync process")
-        self.add_option("-n", "--name", dest="name", metavar="name",
-                        help="specify the package <name> (default %s)" % NAME)
-        self.add_option("--symbian", action="store_true", dest="symbian",
-                        help="work in Symbian mode")
-        self.add_option("--nvg", action="store_true", dest="nvg",
-                        help="do convert svg to nvg")
-        self.add_option("--no-nvg", action="store_false", dest="nvg",
-                        help="do not convert svg to nvg")
-
-        group = optparse.OptionGroup(self, "Input/output options")
-        self.add_option("-i", "--input", dest="input", metavar="dir",
-                        help="specify the input <dir> (default %s)" % INPUT_DIR)
-        self.add_option("-o", "--output", dest="output", metavar="dir",
-                        help="specify the output <dir> (default %s)" % OUTPUT_DIR)
-        self.add_option("-a", "--archives", action="store_true", dest="archives",
-                        help="export/install archives (default %s)" % ARCHIVES)
-        self.add_option("--include", dest="include", action="append", metavar="pattern",
-                        help="specify the include <pattern> (default %s)" % INCLUDE)
-        self.add_option("--exclude", dest="exclude", action="append", metavar="pattern",
-                        help="specify the exclude <pattern> (default %s)" % EXCLUDE)
-        self.add_option_group(group)
-
-        group = optparse.OptionGroup(self, "Prefix options")
-        self.add_option("--iby-source-prefix", dest="ibysourceprefix", metavar="prefix",
-                        help="specify the iby source <prefix> (default %s)" % IBY_SOURCE_PREFIX)
-        self.add_option("--iby-target-prefix", dest="ibytargetprefix", metavar="prefix",
-                        help="specify the iby target <prefix> (default %s)" % IBY_TARGET_PREFIX)
-        self.add_option("--bld-hw-target-prefix", dest="bldhwtargetprefix", metavar="prefix",
-                        help="specify the bld harware target <prefix> (default %s)" % BLD_HW_TARGET_PREFIX)
-        self.add_option("--bld-emu-target-prefix", dest="bldemutargetprefix", metavar="prefix",
-                        help="specify the bld emulator target <prefix> (default %s)" % BLD_EMU_TARGET_PREFIX)
-        self.add_option("--bld-target-prefix", dest="bldtargetprefixes", action="append", metavar="prefix",
-                        help="specify an additional bld target <prefix>")
-        self.add_option_group(group)
-
-# ============================================================================
-# Utils
-# ============================================================================
-if not hasattr(os.path, "relpath"):
-    def relpath(path, start=os.curdir):
-        abspath = os.path.abspath(path)
-        absstart = os.path.abspath(start)
-        if abspath == absstart:
-            return "."
-        i = len(absstart)
-        if not absstart.endswith(os.path.sep):
-            i += len(os.path.sep)
-        if not abspath.startswith(absstart):
-            i = 0
-        return abspath[i:]
-    os.path.relpath = relpath
-
-def run_process(command, cwd=None):
-    code = 0
-    output = ""
-    try:
-        if cwd != None:
-            oldcwd = os.getcwd()
-            os.chdir(cwd)
-        if sys.version_info[0] == 2 and sys.version_info[1] < 4:
-            process = popen2.Popen4(command)
-            code = process.wait()
-            output = process.fromchild.read()
-        else:
-            process = subprocess.Popen(command, stderr=subprocess.PIPE, stdout=subprocess.PIPE)
-            (stdout, stderr) = process.communicate()
-            code = process.returncode
-            output = stdout + stderr
-        if cwd != None:
-            os.chdir(oldcwd)
-    except Exception, e:
-        print(e)
-        code = -1
-    return [code, output]
-
-def make_target(path):
-    # generate a compatible make target name from path
-    target = os.path.splitdrive(path)[1].strip("\\/")
-    return "_".join(re.split("[\\\/]+", target))
-
-def zip_filelist(filepath):
-    files = list()
-    archive = zipfile.ZipFile(filepath)
-    for entry in archive.namelist():
-        if not entry.endswith("/"):
-            files.append(entry)
-    return files
-
-class Theme:
-    def __init__(self, name):
-        self.name = name
-        self.paths = []
-        self.files = {}
-        self.archives = {}
-
-    def initialize(self):
-        for path in self.paths:
-            for root, dirs, files in os.walk(path):
-                for file in files:
-                    filepath = posixpath.join(root, file).replace("\\", "/")
-                    if self._include(filepath):
-                        extension = os.path.splitext(filepath)[1]
-                        if extension == ".zip":
-                            if root not in self.archives:
-                                self.archives[root] = list()
-                            self.archives[root].append(filepath)
-                        else:
-                            if root not in self.files:
-                                self.files[root] = list()
-                            self.files[root].append(filepath)
-
-    def _write_zip_entry(self, archive, filepath):
-        path, filename = os.path.split(filepath)
-        oldcwd = os.getcwd()
-        os.chdir(path)
-        archive.write(filename)
-        os.chdir(oldcwd)
-
-    def encode(self):
-        print "Encoding: %s" % self.name
-        for path, archives in self.archives.iteritems():
-            relpath = os.path.relpath(path, INPUT_DIR)
-            if not relpath.startswith("icons"):
-                continue
-            for archive in archives:
-                # ensure that output dir exists
-                outpath = os.path.join(OUTPUT_DIR, relpath)
-                if not os.path.exists(outpath):
-                    os.makedirs(outpath)
-
-                # extract to a temp dir
-                tempdir = tempfile.mkdtemp()
-                zip = zipfile.ZipFile(archive)
-                for name in zip.namelist():
-                    file = open(os.path.join(tempdir, name),'w')
-                    file.write(zip.read(name))
-                    file.close()
-
-                # convert & re-archive
-                total = 0
-                converted = 0
-                tmpfile, tmpfilepath = tempfile.mkstemp(".zip")
-                tmparchive = zipfile.ZipFile(tmpfilepath, 'w')
-                for root, dirs, files in os.walk(tempdir):
-                    for file in files:
-                        filepath = os.path.join(root, file)
-                        basepath, extension = os.path.splitext(filepath)
-                        if extension == ".svg":
-                            total += 1
-                            encoder = ENCODER
-                            if os.path.exists("/ext/tools/hbbins/bin/3rdparty/%s" % ENCODER):
-                                encoder = "/ext/tools/hbbins/bin/3rdparty/%s" % ENCODER
-                            res = run_process([encoder, "-v", "6", filepath, "-e", ".nvg"])[0]
-                            exists = os.path.exists(basepath + ".nvg")
-                            if not exists:
-                                self._write_zip_entry(tmparchive, filepath)
-                            else:
-                                converted += 1
-                                self._write_zip_entry(tmparchive, basepath + ".nvg")
-       
-                # cleanup
-                tmparchive.close()
-                os.close(tmpfile)
-                if converted > 0:
-                    shutil.move(tmpfilepath, os.path.join(outpath, os.path.basename(archive)))
-                else:
-                    os.remove(tmpfilepath)
-                shutil.rmtree(tempdir, True)
-                print "          %s (%s/%s)" % (os.path.join(relpath, os.path.basename(archive)), converted, total)
-
-    def write_css(self, csspath):
-        outpath = os.path.dirname(csspath)
-        if not os.path.exists(outpath):
-            os.makedirs(outpath)
-        groupfile = open(csspath, "w")
-        for path, files in copy.deepcopy(self.files.items()):
-            for filepath in files:
-                basename = os.path.basename(filepath)
-                extension = os.path.splitext(basename)[1]
-                if extension == ".css":
-                    if basename != os.path.basename(csspath):
-                        cssfile = open(filepath, "r")
-                        groupfile.write(cssfile.read())
-                        cssfile.close()
-                    self.files[path].remove(filepath)
-        groupfile.close()
-        if outpath not in self.files:
-            self.files[outpath] = list()
-        if csspath not in self.files[outpath]:
-            self.files[outpath].append(csspath)
-
-    def write_iby(self, ibypath):
-        global IBY_SOURCE_PREFIX, IBY_TARGET_PREFIX, EXIT_STATUS
-        outpath = os.path.dirname(ibypath)
-        if not os.path.exists(outpath):
-            os.makedirs(outpath)
-        out = open(ibypath, "w")
-        out.write("#ifndef __%s_IBY__\n" % self.name.upper())
-        out.write("#define __%s_IBY__\n" % self.name.upper())
-        out.write("\n")
-        out.write("#include <bldvariant.hrh>\n")
-        out.write("\n")
-        out.write("data=%s/%s.themeindex\t%s/%s.themeindex\n" % (IBY_SOURCE_PREFIX, self.name, IBY_TARGET_PREFIX, self.name))
-        written_entries = list()
-        for path, files in self.files.iteritems():
-            relpath = os.path.relpath(path, INPUT_DIR).replace("\\", "/")
-            for filepath in files:
-                filename = os.path.basename(filepath)
-                entry = posixpath.join(relpath, filename)
-                if entry not in written_entries:
-                    written_entries.append(filepath)
-                    out.write("data=%s/%s\t%s/%s\n" % (IBY_SOURCE_PREFIX, entry, IBY_TARGET_PREFIX, entry))
-                else:
-                    print "ERROR: %s duplicate entry %s" % (ibypath, entry)
-                    EXIT_STATUS = -1
-        for path, archives in self.archives.iteritems():
-            relpath = os.path.relpath(path, INPUT_DIR).replace("\\", "/")
-            for archive in archives:
-                files = zip_filelist(archive)
-                for filepath in files:
-                    entry = posixpath.join(relpath, filepath)
-                    if entry not in written_entries:
-                        written_entries.append(entry)
-                        out.write("data=%s/%s\t%s/%s\n" % (IBY_SOURCE_PREFIX, entry, IBY_TARGET_PREFIX, entry))
-                    else:
-                        print "ERROR: %s duplicate entry %s" % (ibypath, entry)
-                        EXIT_STATUS = -1
-        out.write("\n")
-        out.write("#endif __%s_IBY__\n" % self.name.upper())
-        out.close()
-
-    def _include(self, filepath):
-        result = True
-        if INCLUDE != None:
-            for pattern in INCLUDE:
-                if not fnmatch.fnmatch(filepath, pattern):
-                    result = False
-        if EXCLUDE != None:
-            for pattern in EXCLUDE:
-                if fnmatch.fnmatch(filepath, pattern):
-                    result = False
-        return result
-
-def lookup_themes(path):
-    themes = {}
-    # base: effects, icons...
-    for base in os.listdir(path):
-        basepath = posixpath.join(path, base)
-        if os.path.isdir(basepath):
-            # theme: footheme, bartheme...
-            for theme in os.listdir(basepath):
-                themepath = posixpath.join(basepath, theme)
-                if os.path.isdir(themepath):
-                    if theme not in themes:
-                        themes[theme] = Theme(theme)
-                    themes[theme].paths.append(themepath)
-    return themes
-
-def write_txt(filepath, themes, prefixes):
-    outpath = os.path.dirname(filepath)
-    if not os.path.exists(outpath):
-        os.makedirs(outpath)
-    out = open(filepath, "w")
-    for name, theme in themes.iteritems():
-        for prefix in prefixes:
-            out.write("%s %s %s\n" % (name, prefix, prefix))
-    out.close()
-
-def write_pri(filepath, themes, prefixes, settingsfile_exists):
-    outpath = os.path.dirname(filepath)
-    if not os.path.exists(outpath):
-        os.makedirs(outpath)
-    outpath = os.path.splitdrive(OUTPUT_DIR)[1]
-    out = open(filepath, "w")
-
-    # clean & dist clean rules
-    out.write("QMAKE_CLEAN += %s\n" % filepath)
-    out.write("QMAKE_CLEAN += %s\n" % (os.path.splitext(filepath)[0] + ".txt"))
-    if settingsfile_exists:
-        out.write("QMAKE_CLEAN += %s.iby\n" % posixpath.join(outpath, THEME_COMMON))
-    for name, theme in themes.iteritems():
-        out.write("QMAKE_CLEAN += %s.iby\n" % posixpath.join(outpath, name))
-        for prefix in prefixes:
-            out.write("QMAKE_CLEAN += %s.themeindex\n" % posixpath.join(prefix, name))
-
-    out.write("symbian {\n")
-    out.write("\tBLD_INF_RULES.prj_exports += \"$${LITERAL_HASH}include <platform_paths.hrh>\"\n")
-
-    if settingsfile_exists:
-        # exporting theme settings file
-        settingsPath = os.path.splitdrive(posixpath.join(INPUT_DIR,THEME_SETTINGS_FILE))[1]
-        out.write("\tBLD_INF_RULES.prj_exports += \"%s\t%s/%s\"\n" % (settingsPath, BLD_HW_TARGET_PREFIX, THEME_SETTINGS_FILE))
-        out.write("\tBLD_INF_RULES.prj_exports += \"%s\t%s/%s\"\n" % (settingsPath, BLD_EMU_TARGET_PREFIX, THEME_SETTINGS_FILE))
-        out.write("\tBLD_INF_RULES.prj_exports += \"%s.iby\tCORE_MW_LAYER_IBY_EXPORT_PATH(%s.iby)\"\n" % (posixpath.join(outpath, THEME_COMMON), THEME_COMMON))
-
-    for name, theme in themes.iteritems():
-        ibyfile = "%s.iby" % name
-        out.write("\tBLD_INF_RULES.prj_exports += \"%s\tCORE_MW_LAYER_IBY_EXPORT_PATH(%s)\"\n" % (posixpath.join(outpath, ibyfile), ibyfile))
-        for path, files in theme.files.iteritems():
-            relpath = os.path.relpath(path, INPUT_DIR).replace("\\", "/")
-            for filepath in files:
-                filepath = os.path.splitdrive(filepath)[1]
-                filename = os.path.basename(filepath)
-                out.write("\tBLD_INF_RULES.prj_exports += \"%s\t%s/%s\"\n" % (filepath, BLD_HW_TARGET_PREFIX, posixpath.join(relpath, filename)))
-                out.write("\tBLD_INF_RULES.prj_exports += \"%s\t%s/%s\"\n" % (filepath, BLD_EMU_TARGET_PREFIX, posixpath.join(relpath, filename)))
-        for path, archives in theme.archives.iteritems():
-            relpath = os.path.relpath(path, INPUT_DIR).replace("\\", "/")
-            for filepath in archives:
-                filepath = os.path.splitdrive(filepath)[1]
-                filename = os.path.basename(filepath)
-                if ARCHIVES:
-                    out.write("\tBLD_INF_RULES.prj_exports += \"%s\t%s/%s\"\n" % (filepath, BLD_HW_TARGET_PREFIX, posixpath.join(relpath, filename)))
-                    out.write("\tBLD_INF_RULES.prj_exports += \"%s\t%s/%s\"\n" % (filepath, BLD_EMU_TARGET_PREFIX, posixpath.join(relpath, filename)))
-                else:
-                    out.write("\tBLD_INF_RULES.prj_exports += \":zip %s\t%s/%s\"\n" % (filepath, BLD_HW_TARGET_PREFIX, relpath))
-                    out.write("\tBLD_INF_RULES.prj_exports += \":zip %s\t%s/%s\"\n" % (filepath, BLD_EMU_TARGET_PREFIX, relpath))
-    out.write("} else {\n")
-    out.write("\tisEmpty(QMAKE_UNZIP):QMAKE_UNZIP = unzip -u -o\n")
-
-    if settingsfile_exists:
-        # installing theme settings file
-        settingsPath = posixpath.join(INPUT_DIR,THEME_SETTINGS_FILE)
-        out.write("\t%s.path += $$(HB_THEMES_DIR)/themes\n" % THEME_COMMON)
-        out.write("\t%s.files += %s\n" % (THEME_COMMON, settingsPath))
-        out.write("\tINSTALLS += %s\n" % THEME_COMMON)
-
-    for name, theme in themes.iteritems():
-        for path, files in theme.files.iteritems():
-            target = make_target(path)
-            relpath = os.path.relpath(path, INPUT_DIR).replace("\\", "/")
-            out.write("\t%s.CONFIG += no_build\n" % target)
-            out.write("\t%s.path += $$(HB_THEMES_DIR)/themes/%s\n" % (target, relpath))
-            out.write("\t%s.files += %s\n" % (target, " ".join(files)))
-            out.write("\tINSTALLS += %s\n" % target)
-        for path, archives in theme.archives.iteritems():
-            target = make_target(path)
-            relpath = os.path.relpath(path, INPUT_DIR).replace("\\", "/")
-            out.write("\t%s_zip.CONFIG += no_build\n" % target)
-            out.write("\t%s_zip.path += $$(HB_THEMES_DIR)/themes/%s\n" % (target, relpath))
-            if ARCHIVES:
-                out.write("\t%s_zip.files += %s\n" % (target, " ".join(archives)))
-            else:
-                commands = []
-                for archive in archives:
-                    commands.append("$$QMAKE_UNZIP %s -d $$(HB_THEMES_DIR)/themes/%s" % (archive, relpath))
-                out.write("\t%s_zip.commands += %s\n" % (target, " && ".join(commands)))
-                out.write("\t%s_zip.uninstall += -$(DEL_FILE) $$(HB_THEMES_DIR)/themes/%s/*\n" % (target, relpath))
-            out.write("\tINSTALLS += %s_zip\n" % target)
-    out.write("}\n")
-    out.close()
-
-
-def write_common_iby(path):
-    global VERBOSE, IBY_SOURCE_PREFIX, IBY_TARGET_PREFIX, OUTPUT_DIR, INPUT_DIR 
-    global THEME_COMMON, THEME_SETTINGS_FILE
-
-    # Create iby file for theme.theme if it is there
-    theme_theme = posixpath.join(INPUT_DIR,THEME_SETTINGS_FILE)
-    if os.path.isfile(theme_theme):
-        if VERBOSE:
-            print "Writing:  %s.iby" % THEME_COMMON
-        ibypath = posixpath.join(OUTPUT_DIR, THEME_COMMON + ".iby")
-        outpath = os.path.dirname(ibypath)
-        if not os.path.exists(outpath):
-            os.makedirs(outpath)
-        out = open(ibypath, "w")
-        out.write("#ifndef __%s_IBY__\n" % THEME_COMMON.upper())
-        out.write("#define __%s_IBY__\n" % THEME_COMMON.upper())
-        out.write("\n")
-        out.write("#include <bldvariant.hrh>\n")
-        out.write("\n")
-        out.write("data=%s/%s\t%s/%s\n" % (IBY_SOURCE_PREFIX, THEME_SETTINGS_FILE, IBY_TARGET_PREFIX, THEME_SETTINGS_FILE))
-        out.write("\n")
-        out.write("#endif __%s_IBY__\n" % THEME_COMMON.upper())
-        return True
-
-    # theme common iby not written, return false
-    return False
-
-# ============================================================================
-# main()
-# ============================================================================
-def main():
-    global VERBOSE, ARCHIVES, INPUT_DIR, OUTPUT_DIR, INCLUDE, EXCLUDE, SYMBIAN, NAME, NVG
-    global IBY_SOURCE_PREFIX, IBY_TARGET_PREFIX
-    global BLD_HW_TARGET_PREFIX, BLD_EMU_TARGET_PREFIX, BLD_TARGET_PREFIXES
-
-    parser = OptionParser()
-    (options, args) = parser.parse_args()
-
-    if options.verbose != None:
-        VERBOSE = options.verbose
-    if options.symbian != None:
-        SYMBIAN = options.symbian
-    if options.nvg != None:
-        NVG = options.nvg
-    if options.name != None:
-        NAME = options.name
-    if options.archives != None:
-        ARCHIVES = options.archives
-    if options.include != None:
-        INCLUDE = options.include
-    if options.exclude != None:
-        EXCLUDE = options.exclude
-    if options.input != None:
-        INPUT_DIR = options.input
-    if options.output != None:
-        OUTPUT_DIR = options.output
-    if options.ibysourceprefix != None:
-        IBY_SOURCE_PREFIX = options.ibysourceprefix
-    if options.ibytargetprefix != None:
-        IBY_TARGET_PREFIX = options.ibytargetprefix
-    if options.bldhwtargetprefix != None:
-        BLD_HW_TARGET_PREFIX = options.bldhwtargetprefix
-    if options.bldemutargetprefix != None:
-        BLD_EMU_TARGET_PREFIX = options.bldemutargetprefix
-    if options.bldtargetprefixes != None:
-        BLD_TARGET_PREFIXES = options.bldtargetprefixes
-
-    settingsfile_exists = write_common_iby(INPUT_DIR)
-
-    themes = lookup_themes(INPUT_DIR)
-    for name, theme in themes.iteritems():
-        theme.initialize()
-        if SYMBIAN and NVG:
-            theme.encode()
-        if VERBOSE:
-            print "Writing:  %s/hbcolorgroup.css" % name
-        theme.write_css(posixpath.join(OUTPUT_DIR, "style/%s/variables/color/hbcolorgroup.css" % name))
-        if VERBOSE:
-            print "Writing:  %s.iby" % name
-        theme.write_iby(posixpath.join(OUTPUT_DIR, "%s.iby" % name))
-
-    if SYMBIAN:
-        prefixes = [BLD_HW_TARGET_PREFIX, BLD_EMU_TARGET_PREFIX]
-        prefixes += BLD_TARGET_PREFIXES
-    else:
-        prefixes = [posixpath.join(os.environ["HB_THEMES_DIR"], "themes")]
-
-    if VERBOSE:
-        print "Writing:  %s.pri" % NAME
-    write_pri(posixpath.join(OUTPUT_DIR, "%s.pri" % NAME), themes, prefixes, settingsfile_exists)
-    if VERBOSE:
-        print "Writing:  %s.txt" % NAME
-    write_txt(posixpath.join(OUTPUT_DIR, "%s.txt" % NAME), themes, prefixes)
-
-    return EXIT_STATUS
-
-if __name__ == "__main__":
-    sys.exit(main())
Binary file centralrepository/20022E82.txt has changed
Binary file confml/confml/CI_hbtheme.confml has changed
Binary file confml/confml/hbtheme.confml has changed
Binary file confml/implml/hbtheme.crml has changed
Binary file confml/implml/hbtheme_20022e82.crml has changed
--- a/makeindex.mk	Wed Jun 23 18:49:37 2010 +0300
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,38 +0,0 @@
-# ============================================================================
-#  Name        : makeindex.mk
-#  Part of     : Hb
-#  Description : Hb make index wrapper
-#  Version     : %version: 5 %
-#
-#  Copyright (c) 2008-2010 Nokia.  All rights reserved.
-#  This material, including documentation and any related computer
-#  programs, is protected by copyright controlled by Nokia.  All
-#  rights are reserved.  Copying, including reproducing, storing,
-#  adapting or translating, any or all of this material requires the
-#  prior written consent of Nokia.  This material also contains
-#  confidential information which may not be disclosed to others
-#  without the prior written consent of Nokia.
-# ============================================================================
-
-MAKE = make
-
-MAKMAKE :
-
-RESOURCE :
-	-$(MAKE) index
-
-SAVESPACE :
-
-BLD :
-
-FREEZE :
-
-LIB :
-
-CLEANLIB :
-
-FINAL :
-
-CLEAN :
-
-RELEASABLES :
--- a/platformthemes.pro	Wed Jun 23 18:49:37 2010 +0300
+++ b/platformthemes.pro	Tue Jul 06 14:53:09 2010 +0300
@@ -18,6 +18,12 @@
 
 NAME = platformthemes
 TEMPLATE = subdirs
+EXCLUDE += --exclude \"*.orig\"
+EXCLUDE += --exclude \"*/distribution.policy.s60\"
+
+# ============================================================================
+# determine HB_THEMES_DIR
+# ============================================================================
 !symbian {
     HB_THEMES_DIR = $$(HB_THEMES_DIR)
     isEmpty(HB_THEMES_DIR) {
@@ -26,59 +32,137 @@
         error(HB_THEMES_DIR environment variable is not set. ($$ENV_HELP))
     }
 } else {
-    ARGS += --symbian
-    nvg:ARGS += --nvg
-    no_nvg:ARGS += --no-nvg
+    HB_THEMES_DIR = $${EPOCROOT}epoc32/data/z/resource/hb
 }
-ARGS += -v --input $$IN_PWD/src --output $$OUT_PWD/src --name $$NAME
-ARGS += --exclude \"*distribution.policy.s60\"
-ARGS += --exclude \"*.orig\"
-!system(python $$IN_PWD/bin/sync.py $$ARGS) {
-    error(*** bin/sync.py reported an error. Stop.)
+HB_THEMES_DIR = $$HB_THEMES_DIR/themes
+
+win32:!win32-g++ {
+    unixstyle = false
+} else:symbian:isEmpty(QMAKE_SH) {
+    unixstyle = false
+} else:win32-g++:isEmpty(QMAKE_SH) {
+    unixstyle = false
+} else {
+    unixstyle = true
 }
 
+# ============================================================================
+# extract archives
+# ============================================================================
+ARGS = --input src --output $$OUT_PWD/tmp/src $$EXCLUDE
+!system(python bin/extract.py $$ARGS) {
+    error(*** bin/extract.py reported an error. Stop.)
+}
+
+# ============================================================================
+# convert svg->nvg
+# ============================================================================
+symbian {
+    nvg|!no_nvg {
+        ARGS = --input $$OUT_PWD/tmp/src/icons
+        !system(python bin/svg2nvg.py $$ARGS) {
+            error(*** bin/svg2nvg.py reported an error. Stop.)
+        }
+    }
+}
+
+# ============================================================================
+# theme indexing target
+# ============================================================================
 THEMEINDEXER = hbthemeindexer
 !symbian {
-    win32:!win32-g++ {
-        unixstyle = false
-    } else:win32-g++:isEmpty(QMAKE_SH) {
-        unixstyle = false
-    } else:symbian {
-        unixstyle = false
-    } else {
-        unixstyle = true
-    }
-
     $$unixstyle {
         DEVNULL = /dev/null
     } else {
         DEVNULL = nul
     }
+    !system($$THEMEINDEXER > $$DEVNULL 2>&1) {
+        error(\'$$THEMEINDEXER\' must be in PATH.)
+    }
+}
+ARGS = -s $$OUT_PWD/tmp/src -t $$OUT_PWD/tmp
+!system($$THEMEINDEXER $$ARGS) {
+    error(*** $$THEMEINDEXER reported an error. Stop.)
+}
 
-    !system($$THEMEINDEXER > $$DEVNULL 2>&1) {
-        error('hbthemeindexer' must be in PATH.)
+index.path = $$(HB_THEMES_DIR)/themes
+index.files = $$OUT_PWD/tmp/*.themeindex
+INSTALLS += index
+QMAKE_CLEAN += $$OUT_PWD/tmp/*.themeindex
+
+# ============================================================================
+# generate installs.pri
+# ============================================================================
+ARGS = --input $$OUT_PWD/tmp/src --output $$OUT_PWD/tmp $$EXCLUDE
+!system(python bin/installs.py $$ARGS) {
+    error(*** bin/installs.py reported an error. Stop.)
+}
+isEmpty(QMAKE_UNZIP):QMAKE_UNZIP = unzip -u -o
+include($$OUT_PWD/tmp/installs.pri)
+QMAKE_DISTCLEAN += $$OUT_PWD/tmp/installs.pri
+
+# ============================================================================
+# generate rom files
+# ============================================================================
+symbian {
+    ARGS = --input $$OUT_PWD/tmp/src --output $$OUT_PWD/tmp $$EXCLUDE
+    !system(python bin/rom.py $$ARGS) {
+        error(*** bin/rom.py reported an error. Stop.)
+    }
+    QMAKE_CLEAN += $$OUT_PWD/tmp/*.iby
+}
+
+# ============================================================================
+# installs/exports
+# ============================================================================
+symbian {
+
+    # theme exports
+    exists(src/theme.theme) {
+        BLD_INF_RULES.prj_exports += "src/theme.theme $${EPOCROOT}epoc32/data/z/resource/hb/themes/"
+        BLD_INF_RULES.prj_exports += "src/theme.theme $${EPOCROOT}epoc32/winscw/c/resource/hb/themes/"
+    }
+    exists(rom/theme.theme.iby) {
+        BLD_INF_RULES.prj_exports += "rom/theme.theme.iby $$CORE_MW_LAYER_IBY_EXPORT_PATH(theme.theme.iby)"
+    }
+
+    # params: <files> <target>
+    defineTest(exportThemeFiles) {
+        files = $$1
+        target = $$2
+        for(file, files) {
+            # strip possible drive letter
+            file = $$split(file, :)
+            file = $$last(file)
+            BLD_INF_RULES.prj_exports += "$$file $$target"
+        }
+        export(BLD_INF_RULES.prj_exports)
+        return(true)
+    }
+    exportThemeFiles($$files($$OUT_PWD/tmp/*.iby), $$CORE_MW_LAYER_IBY_EXPORT_PATH())
+    exportThemeFiles($$files($$OUT_PWD/tmp/*.themeindex), $${EPOCROOT}epoc32/data/z/resource/hb/themes/)
+    exportThemeFiles($$files($$OUT_PWD/tmp/*.themeindex), $${EPOCROOT}epoc32/winscw/c/resource/hb/themes/)
+
+    # configuration files - exporting removed from platformthemes
+#    BLD_INF_RULES.prj_exports += "$$section(PWD, ":", 1)/confml/confml/hbtheme.confml            MW_LAYER_CONFML(hbtheme.confml)
+#    BLD_INF_RULES.prj_exports += "$$section(PWD, ":", 1)/confml/implml/hbtheme_20022e82.crml     MW_LAYER_CRML(hbtheme_20022e82.crml)
+#    BLD_INF_RULES.prj_exports += "$$section(PWD, ":", 1)/confml/implml/hbtheme.implml            MW_LAYER_CRML(hbtheme.implml)
+
+} else {
+    exists(src/theme.theme) {
+        theme.theme.path = $$(HB_THEMES_DIR)/themes
+        theme.theme.files += src/theme.theme
+        INSTALLS += theme.theme
     }
 }
 
-*symbian* {
-    BLD_INF_RULES.prj_mmpfiles += "gnumakefile makeindex.mk"
-
-    install.depends = default
+# ============================================================================
+# NOTE: qmake/s60 does not support INSTALLS
+# ============================================================================
+symbian {
+    install.depends += export
     uninstall.depends = cleanexport
     QMAKE_EXTRA_TARGETS += install uninstall
-
-    # central repository - exporting removed from platformthemes
-#    BLD_INF_RULES.prj_exports += "$$section(PWD, ":", 1)/centralrepository/20022E82.txt $${EPOCROOT}epoc32/data/z/private/10202BE9/20022E82.txt"
-#    BLD_INF_RULES.prj_exports += "$$section(PWD, ":", 1)/centralrepository/20022E82.txt $${EPOCROOT}epoc32/release/winscw/udeb/z/private/10202BE9/20022E82.txt"
-#    BLD_INF_RULES.prj_exports += "$$section(PWD, ":", 1)/centralrepository/20022E82.txt $${EPOCROOT}epoc32/release/winscw/urel/z/private/10202BE9/20022E82.txt"
 }
-index.path = .
-index.commands = $$THEMEINDEXER -f $$OUT_PWD/src/$${NAME}.txt
-QMAKE_EXTRA_TARGETS += index
 
 message(Run \'make install\')
-
-include($$OUT_PWD/src/$${NAME}.pri)
-
-# NOTE: must be after .pri include above!
-INSTALLS += index
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rom/theme.theme.iby	Tue Jul 06 14:53:09 2010 +0300
@@ -0,0 +1,8 @@
+#ifndef __THEME_THEME_IBY__
+#define __THEME_THEME_IBY__
+
+#include <bldvariant.hrh>
+
+data=ZRESOURCE/hb/themes/theme.theme	RESOURCE_FILES_DIR/hb/themes/theme.theme
+
+#endif __THEME_THEME_IBY__
Binary file src/animations/sfwhitetheme/animations.zip has changed
Binary file src/effects/sfwhitetheme/applications.zip has changed
Binary file src/effects/sfwhitetheme/effects.zip has changed
Binary file src/effects/sfwhitetheme/widgets.zip has changed
Binary file src/icons/sfblacktheme/scalable/applications.zip has changed
Binary file src/icons/sfblacktheme/scalable/icons.zip has changed
Binary file src/icons/sfblacktheme/scalable/widgets.zip has changed
Binary file src/icons/sfwhitetheme/scalable/applications.zip has changed
Binary file src/icons/sfwhitetheme/scalable/icons.zip has changed
Binary file src/icons/sfwhitetheme/scalable/widgets.zip has changed
--- a/src/style/sfblacktheme/variables/color/hbapplicationcolorgroup.css	Wed Jun 23 18:49:37 2010 +0300
+++ b/src/style/sfblacktheme/variables/color/hbapplicationcolorgroup.css	Tue Jul 06 14:53:09 2010 +0300
@@ -34,8 +34,10 @@
 
 /* Application specific - Home screen */ 
 qtc_hs_list_item_title_normal:#FFFFFF; /* Added 05.02.2010 */
+qtc_hs_list_title2_normal:#FFFFFF;
 qtc_hs_list_item_content_normal:#FFFFFF; /* Added 05.02.2010 */
 qtc_hs_list_item_pressed:#FFFFFF; /* Added 05.02.2010 */
+qtc_hs_list_item_latched:#FFFFFF;
 qtc_hs_list_item_highlight:#FFFFFF; /* Added 05.02.2010 */
 qtc_hs_badge:#FFFFFF;  /* Added 01.03.2010 */
 qtc_hs_cal:#000000; /* Added 18.03.2010 */
@@ -49,7 +51,7 @@
 qtc_radio_tuner_line:#FFFFFF; /* Added 05.02.2010 */
 
 /* Application specific - Multimedia */ 
-qtc_multimedia_trans:#FFFFFF; /* Modified 19.02.2010 */
+qtc_multimedia_trans_normal:#FFFFFF; /* Modified 02.06.2010 */
 qtc_multimedia_trans_pressed:#FFFFFF; /* Added 19.02.2010 */
 qtc_multimedia_trans_disabled:#9B9B9B; /* Added 09.03.2010 */
 
--- a/src/style/sfblacktheme/variables/color/hbwidgetcolorgroup.css	Wed Jun 23 18:49:37 2010 +0300
+++ b/src/style/sfblacktheme/variables/color/hbwidgetcolorgroup.css	Tue Jul 06 14:53:09 2010 +0300
@@ -39,6 +39,7 @@
 qtc_view_link_normal:#33C8FF;
 qtc_view_visited_normal:#B378FF;
 qtc_view_separator_normal:#9B9B9B;
+qtc_view_normal_secondary:#FFFFFF;
 
 /* Main area - View title */
 qtc_viewtitle_normal:#E6E6E6;
@@ -82,8 +83,8 @@
 qtc_combobox_latched:#FFFFFF; /* Added 05.02.2010 */
 
 /* Tumbler */
-qtc_tumbler_normal:#FFFFFF;
-qtc_tumbler_selected:#FFFFFF;
+qtc_tumbler_normal:#3C3C3C;
+qtc_tumbler_selected:#3C3C3C;
 qtc_tumbler_highlight:#FFFFFF;
 
 /* Main area - DataForm */
--- a/src/style/sfwhitetheme/variables/color/hbapplicationcolorgroup.css	Wed Jun 23 18:49:37 2010 +0300
+++ b/src/style/sfwhitetheme/variables/color/hbapplicationcolorgroup.css	Tue Jul 06 14:53:09 2010 +0300
@@ -34,8 +34,10 @@
 
 /* Application specific - Home screen */ 
 qtc_hs_list_item_title_normal:#505050; /* Added 05.02.2010 */
+qtc_hs_list_title2_normal:#3C3C3C;
 qtc_hs_list_item_content_normal:#519FB9; /* Added 05.02.2010 */
 qtc_hs_list_item_pressed:#FFFFFF; /* Added 05.02.2010 */
+qtc_hs_list_item_latched:#FFFFFF;
 qtc_hs_list_item_highlight:#FFFFFF; /* Added 05.02.2010 */
 qtc_hs_badge:#FFFFFF; /* Added 01.03.2010 */
 qtc_hs_cal:#3C3C3C; /* Added 18.03.2010 */
@@ -49,7 +51,7 @@
 qtc_radio_tuner_line:#3C3C3C; /* Added 05.02.2010 */
 
 /* Application specific - Multimedia */ 
-qtc_multimedia_trans:#FFFFFF; /* Modified 19.02.2010 */
+qtc_multimedia_trans_normal:#FFFFFF; /* Modified 02.06.2010 */
 qtc_multimedia_trans_pressed:#FFFFFF; /* Added 19.02.2010 */
 qtc_multimedia_trans_disabled:#787878; /* Added 09.03.2010 */
 
--- a/src/style/sfwhitetheme/variables/color/hbwidgetcolorgroup.css	Wed Jun 23 18:49:37 2010 +0300
+++ b/src/style/sfwhitetheme/variables/color/hbwidgetcolorgroup.css	Tue Jul 06 14:53:09 2010 +0300
@@ -39,6 +39,7 @@
 qtc_view_link_normal:#33C8FF;
 qtc_view_visited_normal:#B378FF;
 qtc_view_separator_normal:#9B9B9B;
+qtc_view_normal_secondary:#FFFFFF;
 
 /* Main area - View title */
 qtc_viewtitle_normal:#3C3C3C;