OLD | NEW |
| (Empty) |
1 #!/usr/bin/env python | |
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
3 # Use of this source code is governed by a BSD-style license that can be | |
4 # found in the LICENSE file. | |
5 | |
6 '''Container nodes that don't have any logic. | |
7 ''' | |
8 | |
9 | |
10 from grit.node import base | |
11 from grit.node import include | |
12 from grit.node import structure | |
13 from grit.node import message | |
14 from grit.node import io | |
15 from grit.node import misc | |
16 | |
17 | |
18 class GroupingNode(base.Node): | |
19 '''Base class for all the grouping elements (<structures>, <includes>, | |
20 <messages> and <identifiers>).''' | |
21 def DefaultAttributes(self): | |
22 return { | |
23 'first_id' : '', | |
24 'comment' : '', | |
25 'fallback_to_english' : 'false', | |
26 'fallback_to_low_resolution' : 'false', | |
27 } | |
28 | |
29 | |
30 class IncludesNode(GroupingNode): | |
31 '''The <includes> element.''' | |
32 def _IsValidChild(self, child): | |
33 return isinstance(child, (include.IncludeNode, misc.IfNode, misc.PartNode)) | |
34 | |
35 | |
36 class MessagesNode(GroupingNode): | |
37 '''The <messages> element.''' | |
38 def _IsValidChild(self, child): | |
39 return isinstance(child, (message.MessageNode, misc.IfNode, misc.PartNode)) | |
40 | |
41 | |
42 class StructuresNode(GroupingNode): | |
43 '''The <structures> element.''' | |
44 def _IsValidChild(self, child): | |
45 return isinstance(child, (structure.StructureNode, | |
46 misc.IfNode, misc.PartNode)) | |
47 | |
48 | |
49 class TranslationsNode(base.Node): | |
50 '''The <translations> element.''' | |
51 def _IsValidChild(self, child): | |
52 return isinstance(child, (io.FileNode, misc.IfNode, misc.PartNode)) | |
53 | |
54 | |
55 class OutputsNode(base.Node): | |
56 '''The <outputs> element.''' | |
57 def _IsValidChild(self, child): | |
58 return isinstance(child, (io.OutputNode, misc.IfNode, misc.PartNode)) | |
59 | |
60 | |
61 class IdentifiersNode(GroupingNode): | |
62 '''The <identifiers> element.''' | |
63 def _IsValidChild(self, child): | |
64 return isinstance(child, misc.IdentifierNode) | |
OLD | NEW |