OLD | NEW |
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 |
| 5 import mojo.bindings.reflection as _reflection |
4 {% if imports %} | 6 {% if imports %} |
5 | 7 |
6 {% for import in imports %} | 8 {% for import in imports %} |
7 import {{import.python_module}} | 9 import {{import.python_module}} |
8 {% endfor %} | 10 {% endfor %} |
9 {% endif %} | 11 {% endif %} |
10 {#--- Constants #} | 12 {#--- Constants #} |
11 {% if module.constants %} | 13 {% if module.constants %} |
12 | 14 |
13 {% for constant in module.constants %} | 15 {% for constant in module.constants %} |
14 {{constant|name}} = {{constant.value|expression_to_text}} | 16 {{constant|name}} = {{constant.value|expression_to_text}} |
15 {% endfor %} | 17 {% endfor %} |
16 {% endif %} | 18 {% endif %} |
| 19 {% for enum in module.enums %} |
| 20 |
| 21 class {{enum.name}}(object): |
| 22 __metaclass__ = _reflection.MojoEnumType |
| 23 VALUES = [ |
| 24 {% for field in enum.fields %} |
| 25 ('{{field.name}}', {{field.computed_value}}), |
| 26 {% endfor %} |
| 27 ] |
| 28 {% endfor %} |
OLD | NEW |