[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54957] trunk/blender/release/scripts/ modules/bl_i18n_utils: More tweaks ( gaining about ten seconds for each po in update branches process!).

Bastien Montagne montagne29 at wanadoo.fr
Fri Mar 1 15:28:39 CET 2013


Revision: 54957
          http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54957
Author:   mont29
Date:     2013-03-01 14:28:38 +0000 (Fri, 01 Mar 2013)
Log Message:
-----------
More tweaks (gaining about ten seconds for each po in update branches process!).

Modified Paths:
--------------
    trunk/blender/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
    trunk/blender/release/scripts/modules/bl_i18n_utils/utils.py

Modified: trunk/blender/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
===================================================================
--- trunk/blender/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py	2013-03-01 14:06:20 UTC (rev 54956)
+++ trunk/blender/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py	2013-03-01 14:28:38 UTC (rev 54957)
@@ -788,9 +788,7 @@
     dump_src_messages(msgs, reports, settings)
 
     # Get strings from addons' categories.
-    print("foo, bar", bpy.types.WindowManager.addon_filter[1]['items'](bpy.context.window_manager, bpy.context))
     for uid, label, tip in bpy.types.WindowManager.addon_filter[1]['items'](bpy.context.window_manager, bpy.context):
-        print(uid, label, tip)
         process_msg(msgs, settings.DEFAULT_CONTEXT, label, "Addons' categories", reports, None, settings)
         if tip:
             process_msg(msgs, settings.DEFAULT_CONTEXT, tip, "Addons' categories", reports, None, settings)

Modified: trunk/blender/release/scripts/modules/bl_i18n_utils/utils.py
===================================================================
--- trunk/blender/release/scripts/modules/bl_i18n_utils/utils.py	2013-03-01 14:06:20 UTC (rev 54956)
+++ trunk/blender/release/scripts/modules/bl_i18n_utils/utils.py	2013-03-01 14:28:38 UTC (rev 54957)
@@ -29,6 +29,7 @@
 import struct
 import sys
 import tempfile
+#import time
 
 from bl_i18n_utils import settings, rtl_utils
 
@@ -257,15 +258,23 @@
     @classmethod
     def do_escape(cls, txt):
         """Replace some chars by their escaped versions!"""
-        txt = txt.replace("\n", "\\n").replace("\t", "\\t")
-        txt = cls._esc_quotes.sub(r'\1\"', txt)
+        if "\n" in txt:
+            txt = txt.replace("\n", r"\n")
+        if "\t" in txt:
+            txt.replace("\t", r"\t")
+        if '"' in txt:
+            txt = cls._esc_quotes.sub(r'\1\"', txt)
         return txt
 
     @classmethod
     def do_unescape(cls, txt):
         """Replace escaped chars by real ones!"""
-        txt = txt.replace("\\n", "\n").replace("\\t", "\t")
-        txt = cls._unesc_quotes.sub(r'\1"', txt)
+        if r"\n" in txt:
+            txt = txt.replace(r"\n", "\n")
+        if r"\t" in txt:
+            txt = txt.replace(r"\t", "\t")
+        if r'\"' in txt:
+            txt = cls._unesc_quotes.sub(r'\1"', txt)
         return txt
 
     def escape(self, do_all=False):
@@ -277,8 +286,6 @@
         names = self._esc_names_all if do_all else self._esc_names
         for name in names:
             setattr(self, name, [self.do_unescape(l) for l in getattr(self, name)])
-            if None in getattr(self, name):
-                print(getattr(self, name))
 
 
 class I18nMessages:




More information about the Bf-blender-cvs mailing list