Git Product home page Git Product logo

Comments (4)

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
This approach of setting the target platform on the root node earlier seems to 
make things work:

Index: grit/grd_reader.py
===================================================================
--- grit/grd_reader.py  (revision 140)
+++ grit/grd_reader.py  (working copy)
@@ -24,7 +24,8 @@


 class GrdContentHandler(xml.sax.handler.ContentHandler):
-  def __init__(self, stop_after, debug, dir, defines, tags_to_ignore):
+  def __init__(self, stop_after, debug, dir, defines, tags_to_ignore,
+               target_platform):
     # Invariant of data:
     # 'root' is the root of the parse tree being created, or None if we haven't
     # parsed out any elements.
@@ -39,6 +40,7 @@
     self.defines = defines
     self.tags_to_ignore = tags_to_ignore or set()
     self.ignore_depth = 0
+    self.target_platform = target_platform

   def startElement(self, name, attrs):
     if self.ignore_depth or name in self.tags_to_ignore:
@@ -61,6 +63,9 @@
     else:
       assert self.root is None
       self.root = node
+      if isinstance(self.root, misc.GritNode):
+        if self.target_platform:
+          self.root.SetTargetPlatform(self.target_platform)
       node.StartParsing(name, None)
       if self.defines:
         node.SetDefines(self.defines)
@@ -175,7 +180,8 @@
     dir = util.dirname(filename_or_stream)

   handler = GrdContentHandler(stop_after=stop_after, debug=debug, dir=dir,
-                              defines=defines, tags_to_ignore=tags_to_ignore)
+                              defines=defines, tags_to_ignore=tags_to_ignore,
+                              target_platform=target_platform)
   try:
     xml.sax.parse(filename_or_stream, handler)
   except StopParsingException:
@@ -195,8 +201,6 @@
     handler.root.SetOwnDir(dir)

   if isinstance(handler.root, misc.GritNode):
-    if target_platform:
-      handler.root.SetTargetPlatform(target_platform)
     if first_ids_file:
       # Make the path to the first_ids_file relative to the grd file,
       # unless it begins with GRIT_DIR.

Original comment by [email protected] on 26 Dec 2013 at 3:55

from grit-i18n.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024

Original comment by [email protected] on 26 Dec 2013 at 3:58

from grit-i18n.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024

Original comment by [email protected] on 27 Dec 2013 at 2:33

  • Changed state: Started

from grit-i18n.

GoogleCodeExporter avatar GoogleCodeExporter commented on September 2, 2024
Fixed by r141.

Original comment by [email protected] on 27 Dec 2013 at 2:42

  • Changed state: Fixed

from grit-i18n.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.