Index: mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
diff --git a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
index 830ee03f1729ea7ad3ba15e1981535656d6d8a9c..cfceeed493d79e7ff5cd751760757effa467c8ce 100644 |
--- a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
+++ b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
@@ -1,3 +1,4 @@ |
+{% from "module_macros.tmpl" import enum_values %} |
# Copyright 2014 The Chromium Authors. All rights reserved. |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
@@ -18,15 +19,28 @@ import {{import.python_module}} |
{% endif %} |
{% for enum in module.enums %} |
-class {{enum.name}}(object): |
+class {{enum|name}}(object): |
__metaclass__ = _reflection.MojoEnumType |
- VALUES = [ |
-{% for field in enum.fields %} |
-{% if field.value %} |
- ('{{field.name}}', {{field.value|expression_to_text}}), |
-{% else %} |
- '{{field.name}}', |
-{% endif %} |
-{% endfor %} |
- ] |
+ VALUES = {{enum_values(enum)|indent(2)}} |
+{% endfor %} |
+{% for struct in module.structs %} |
+ |
+class {{struct|name}}(object): |
+ __metaclass__ = _reflection.MojoStructType |
+ DESCRIPTOR = { |
+{% if struct.constants %} |
+ 'constants': { |
+{% for constant in struct.constants %} |
+ '{{constant|name}}': {{constant.value|expression_to_text}} |
pkl (ping after 24h if needed)
2014/09/04 18:12:12
missing , at the end?
qsr
2014/09/05 11:55:49
Done.
|
+{% endfor %} |
+ }, |
+{% endif %} |
+{% if struct.enums %} |
+ 'enums': { |
+{% for enum in struct.enums %} |
+ '{{enum|name}}': {{enum_values(enum)|indent(6)}}, |
+{% endfor %} |
+ }, |
+{% endif %} |
+ } |
{% endfor %} |