Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(161)

Unified Diff: ui/gfx/vector_icons/aggregate_vector_icons.py

Issue 1270783005: V1 of material design find in page bar (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: suffixual f Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gfx/vector_icon_types.h ('k') | ui/gfx/vector_icons/find_close.icon » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..72fbc11cc935891429ad50d5af4dcd4165131706 100644
--- a/ui/gfx/vector_icons/aggregate_vector_icons.py
+++ b/ui/gfx/vector_icons/aggregate_vector_icons.py
@@ -29,9 +29,13 @@ def AggregateVectorIcons(working_directory, output_cc, output_h):
for line in header_template_contents:
if not "TEMPLATE_PLACEHOLDER" in line:
output_header.write(line)
- else:
- for icon_path in icon_list:
- (icon_name, extension) = os.path.splitext(os.path.basename(icon_path))
+ continue
+
+ 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))
+ (icon_name, scale_factor) = os.path.splitext(icon_name)
+ if not scale_factor:
output_header.write(" {},\n".format(icon_name.upper()))
output_header.close()
@@ -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(icon_name)
+ 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()
« no previous file with comments | « ui/gfx/vector_icon_types.h ('k') | ui/gfx/vector_icons/find_close.icon » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698