diff options
author | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2017-03-23 17:39:53 +0300 |
---|---|---|
committer | r.kuznetsov <r.kuznetsov@corp.mail.ru> | 2017-03-24 10:50:00 +0300 |
commit | 3bcb803b554991ce886642ce73d83f5797ef6fa0 (patch) | |
tree | 5ca1773e57f1e4a9e28b1dca7ee37b1382d99867 /tools/python | |
parent | 08ffb4a0ad83b4f28bf4f5993cc4d19094ad3254 (diff) |
Added styles overrides
Diffstat (limited to 'tools/python')
-rwxr-xr-x | tools/python/generate_styles_override.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/tools/python/generate_styles_override.py b/tools/python/generate_styles_override.py new file mode 100755 index 0000000000..4cf542ff8e --- /dev/null +++ b/tools/python/generate_styles_override.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python + +import sys +import os +import shutil + + +def copy_style_file(style_path, drules_suffix, target_path): + if not os.path.exists(style_path): + print('Path {0} is not found'.format(style_path)) + return + + drules_proto_path = os.path.join(style_path, 'drules_proto.bin') + if not os.path.exists(drules_proto_path): + print('Path {0} is not found'.format(drules_proto_path)) + return + shutil.copyfile(drules_proto_path, os.path.join(target_path, 'drules_proto' + drules_suffix + '.bin')) + + for density in ['6plus', 'hdpi', 'mdpi', 'xhdpi', 'xxhdpi']: + res_path = os.path.join(style_path, 'resources-' + density) + if os.path.exists(res_path): + shutil.copytree(res_path, os.path.join(target_path, 'resources-' + density + drules_suffix)) + + +if len(sys.argv) < 2: + print('Usage: {0} <path_to_omim/data/styles> [<target_path>]'.format(sys.argv[0])) + sys.exit() + +path_to_styles = sys.argv[1] +if not os.path.isdir(path_to_styles): + print('Invalid path to styles folder') + sys.exit() + +output_name = os.path.join('' if len(sys.argv) < 3 else sys.argv[2], 'styles') +if os.path.exists(output_name): + shutil.rmtree(output_name) +os.makedirs(output_name) + +paths = ['clear/style-clear', 'clear/style-night', 'vehicle/style-clear', 'vehicle/style-night'] +suffixes = ['_clear', '_dark', '_vehicle_clear', '_vehicle_dark'] + +for i in range(0, len(paths)): + copy_style_file(os.path.join(path_to_styles, paths[i], 'out'), suffixes[i], output_name) |