Index: ui/gfx/vector_icons/aggregate_vector_icons.py |
diff --git a/ui/gfx/vector_icons/aggregate_vector_icons.py b/ui/gfx/vector_icons/aggregate_vector_icons.py |
index ba6d603d9b35f61292bc18c66d42cf47b31c2497..923ebf5eb0ebc12e29d1555149da952317bfdd1d 100644 |
--- a/ui/gfx/vector_icons/aggregate_vector_icons.py |
+++ b/ui/gfx/vector_icons/aggregate_vector_icons.py |
@@ -31,8 +31,12 @@ def AggregateVectorIcons(working_directory, output_cc, output_h): |
output_header.write(line) |
Justin Donnelly
2015/08/05 14:32:49
How about a continue here to match the new structu
Evan Stade
2015/08/05 19:04:25
Done.
|
else: |
for icon_path in icon_list: |
+ # The icon name should be of the format "foo.icon" or "foo.1x.icon". |
(icon_name, extension) = os.path.splitext(os.path.basename(icon_path)) |
- output_header.write(" {},\n".format(icon_name.upper())) |
+ (icon_name, scale_factor) = os.path.splitext( |
+ os.path.basename(icon_name)) |
Justin Donnelly
2015/08/05 14:32:49
You don't need os.path.basename here, you already
Evan Stade
2015/08/05 19:04:25
Done.
|
+ if not scale_factor: |
+ output_header.write(" {},\n".format(icon_name.upper())) |
output_header.close() |
input_cc_template = open( |
@@ -43,14 +47,21 @@ def AggregateVectorIcons(working_directory, output_cc, output_h): |
for line in cc_template_contents: |
if not "TEMPLATE_PLACEHOLDER" in line: |
output_cc.write(line) |
- else: |
- for icon_path in icon_list: |
- (icon_name, extension) = os.path.splitext(os.path.basename(icon_path)) |
- icon_file = open(icon_path) |
- vector_commands = "".join(icon_file.readlines()) |
- icon_file.close() |
- output_cc.write("ICON_TEMPLATE({}, {})\n".format(icon_name.upper(), |
- vector_commands)) |
+ continue; |
+ |
+ for icon_path in icon_list: |
+ (icon_name, extension) = os.path.splitext(os.path.basename(icon_path)) |
+ (icon_name, scale_factor) = os.path.splitext(os.path.basename(icon_name)) |
Justin Donnelly
2015/08/05 14:32:49
Ditto
Evan Stade
2015/08/05 19:04:25
Done.
|
+ assert not scale_factor or scale_factor == ".1x" |
+ if (("1X" in line and scale_factor != ".1x") or |
+ (not "1X" in line and scale_factor == ".1x")): |
+ continue |
+ |
+ icon_file = open(icon_path) |
+ vector_commands = "".join(icon_file.readlines()) |
+ icon_file.close() |
+ output_cc.write("ICON_TEMPLATE({}, {})\n".format(icon_name.upper(), |
+ vector_commands)) |
output_cc.close() |