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 531c4e15c6a055442227c6307e065eecd0aa8426..830ee03f1729ea7ad3ba15e1981535656d6d8a9c 100644 |
--- a/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
+++ b/mojo/public/tools/bindings/generators/python_templates/module.py.tmpl |
@@ -1,6 +1,8 @@ |
# 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. |
+ |
+import mojo.bindings.reflection as _reflection |
{% if imports %} |
{% for import in imports %} |
@@ -14,3 +16,17 @@ import {{import.python_module}} |
{{constant|name}} = {{constant.value|expression_to_text}} |
{% endfor %} |
{% endif %} |
+{% for enum in module.enums %} |
+ |
+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 %} |
+ ] |
+{% endfor %} |