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

Side by Side Diff: grit/node/structure.py

Issue 444053003: Respect output_all_resource_defines when generating resource maps. (Closed) Base URL: http://grit-i18n.googlecode.com/svn/trunk/
Patch Set: refactor Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « grit/node/message.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 '''The <structure> element. 6 '''The <structure> element.
7 ''' 7 '''
8 8
9 import os 9 import os
10 import platform 10 import platform
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 325
326 if self.attrs['run_command'] and self.RunCommandOnCurrentPlatform(): 326 if self.attrs['run_command'] and self.RunCommandOnCurrentPlatform():
327 # Run arbitrary commands after translation is complete so that it 327 # Run arbitrary commands after translation is complete so that it
328 # doesn't interfere with what's in translation console. 328 # doesn't interfere with what's in translation console.
329 command = self.attrs['run_command'] % {'filename': filename} 329 command = self.attrs['run_command'] % {'filename': filename}
330 result = os.system(command) 330 result = os.system(command)
331 assert result == 0, '"%s" failed.' % command 331 assert result == 0, '"%s" failed.' % command
332 332
333 return filename 333 return filename
334 334
335 def IsResourceMapSource(self):
336 return True
337
338 def GeneratesResourceMapEntry(self, output_all_resource_defines,
339 is_active_descendant):
340 if output_all_resource_defines:
341 return True
342 return is_active_descendant
343
335 @staticmethod 344 @staticmethod
336 def Construct(parent, name, type, file, encoding='cp1252'): 345 def Construct(parent, name, type, file, encoding='cp1252'):
337 '''Creates a new node which is a child of 'parent', with attributes set 346 '''Creates a new node which is a child of 'parent', with attributes set
338 by parameters of the same name. 347 by parameters of the same name.
339 ''' 348 '''
340 node = StructureNode() 349 node = StructureNode()
341 node.StartParsing('structure', parent) 350 node.StartParsing('structure', parent)
342 node.HandleAttribute('name', name) 351 node.HandleAttribute('name', name)
343 node.HandleAttribute('type', type) 352 node.HandleAttribute('type', type)
344 node.HandleAttribute('file', file) 353 node.HandleAttribute('file', file)
345 node.HandleAttribute('encoding', encoding) 354 node.HandleAttribute('encoding', encoding)
346 node.EndParsing() 355 node.EndParsing()
347 return node 356 return node
348 357
349 def SubstituteMessages(self, substituter): 358 def SubstituteMessages(self, substituter):
350 '''Propagates substitution to gatherer. 359 '''Propagates substitution to gatherer.
351 360
352 Args: 361 Args:
353 substituter: a grit.util.Substituter object. 362 substituter: a grit.util.Substituter object.
354 ''' 363 '''
355 assert hasattr(self, 'gatherer') 364 assert hasattr(self, 'gatherer')
356 if self.ExpandVariables(): 365 if self.ExpandVariables():
357 self.gatherer.SubstituteMessages(substituter) 366 self.gatherer.SubstituteMessages(substituter)
358 367
OLDNEW
« no previous file with comments | « grit/node/message.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698