Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Montagne <montagne29@wanadoo.fr>2018-12-24 00:03:12 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-12-24 00:03:43 +0300
commit59b530ca1810f109c3696814655e427d912ad6b7 (patch)
tree7032778ef0d79601810821949d851ba23f231bb8 /release/scripts/modules/bl_i18n_utils
parent1158b9f73a3d9903657a95736897f570c2cb46ad (diff)
Fix and workaround for i18n messages extraction code.
Diffstat (limited to 'release/scripts/modules/bl_i18n_utils')
-rw-r--r--release/scripts/modules/bl_i18n_utils/bl_extract_messages.py5
-rw-r--r--release/scripts/modules/bl_i18n_utils/settings.py2
-rw-r--r--release/scripts/modules/bl_i18n_utils/utils.py33
3 files changed, 25 insertions, 15 deletions
diff --git a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
index f22675b481f..0285a22a923 100644
--- a/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
+++ b/release/scripts/modules/bl_i18n_utils/bl_extract_messages.py
@@ -379,7 +379,8 @@ def dump_rna_messages(msgs, reports, settings, verbose=False):
km_i18n_context = bpy.app.translations.contexts.id_windowmanager
for lvl in hier:
msgsrc = msgsrc_prev + "." + lvl[1]
- process_msg(msgs, km_i18n_context, lvl[0], msgsrc, reports, None, settings)
+ if isinstance(lvl[0], str): # Can be a function too, now, with tool system...
+ process_msg(msgs, km_i18n_context, lvl[0], msgsrc, reports, None, settings)
if lvl[3]:
walk_keymap_hierarchy(lvl[3], msgsrc)
@@ -987,7 +988,7 @@ def main():
args = parser.parse_args(argv)
settings = settings_i18n.I18nSettings()
- settings.from_json(args.settings)
+ settings.load(args.settings)
if args.output:
settings.FILE_NAME_POT = args.output
diff --git a/release/scripts/modules/bl_i18n_utils/settings.py b/release/scripts/modules/bl_i18n_utils/settings.py
index 230c351d80c..8a0170b86d4 100644
--- a/release/scripts/modules/bl_i18n_utils/settings.py
+++ b/release/scripts/modules/bl_i18n_utils/settings.py
@@ -552,6 +552,8 @@ class I18nSettings:
self.__dict__ = {uid: data for uid, data in globals().items() if not uid.startswith("_")}
if isinstance(fname, str):
if not os.path.isfile(fname):
+ # Assume it is already real JSon string...
+ self.from_json(fname)
return
with open(fname) as f:
self.from_json(f.read())
diff --git a/release/scripts/modules/bl_i18n_utils/utils.py b/release/scripts/modules/bl_i18n_utils/utils.py
index 1db0beabb92..2116e39fd8e 100644
--- a/release/scripts/modules/bl_i18n_utils/utils.py
+++ b/release/scripts/modules/bl_i18n_utils/utils.py
@@ -180,26 +180,33 @@ def enable_addons(addons=None, support=None, disable=False, check_only=False):
prefs = bpy.context.preferences
used_ext = {ext.module for ext in prefs.addons}
+ # XXX TEMP WORKAROUND
+ black_list = {"space_view3d_math_vis",
+ "object_scatter"}
ret = [
mod for mod in addon_utils.modules()
- if ((addons and mod.__name__ in addons) or
- (not addons and addon_utils.module_bl_info(mod)["support"] in support))
+ if (((addons and mod.__name__ in addons) or
+ (not addons and addon_utils.module_bl_info(mod)["support"] in support)) and
+ (mod.__name__ not in black_list))
]
if not check_only:
for mod in ret:
- module_name = mod.__name__
- if disable:
- if module_name not in used_ext:
- continue
- print(" Disabling module ", module_name)
- bpy.ops.wm.addon_disable(module=module_name)
- else:
- if module_name in used_ext:
- continue
- print(" Enabling module ", module_name)
- bpy.ops.wm.addon_enable(module=module_name)
+ try:
+ module_name = mod.__name__
+ if disable:
+ if module_name not in used_ext:
+ continue
+ print(" Disabling module ", module_name)
+ bpy.ops.wm.addon_disable(module=module_name)
+ else:
+ if module_name in used_ext:
+ continue
+ print(" Enabling module ", module_name)
+ bpy.ops.wm.addon_enable(module=module_name)
+ except Exception as e: # XXX TEMP WORKAROUND
+ print(e)
# XXX There are currently some problems with bpy/rna...
# *Very* tricky to solve!