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:
Diffstat (limited to 'doc/python_api/examples')
-rw-r--r--doc/python_api/examples/bpy.app.translations.py59
-rw-r--r--doc/python_api/examples/bpy.types.Operator.5.py15
2 files changed, 67 insertions, 7 deletions
diff --git a/doc/python_api/examples/bpy.app.translations.py b/doc/python_api/examples/bpy.app.translations.py
index e41623d2885..4256147ef31 100644
--- a/doc/python_api/examples/bpy.app.translations.py
+++ b/doc/python_api/examples/bpy.app.translations.py
@@ -32,3 +32,62 @@ Module References
-----------------
"""
+
+import bpy
+
+# This block can be automatically generated by UI translations addon, which also handles conversion with PO format.
+# See also https://wiki.blender.org/index.php/Dev:Doc/Process/Translate_Blender#Translating_non-official_addons
+# It can (should) also be put in a different, specific py file.
+
+# ##### BEGIN AUTOGENERATED I18N SECTION #####
+# NOTE: You can safely move around this auto-generated block (with the begin/end markers!),
+# and edit the translations by hand.
+# Just carefully respect the format of the tuple!
+
+# Tuple of tuples ((msgctxt, msgid), (sources, gen_comments), (lang, translation, (is_fuzzy, comments)), ...)
+translations_tuple = (
+ (("*", ""),
+ ((), ()),
+ ("fr_FR", "Project-Id-Version: Copy Settings 0.1.5 (r0)\nReport-Msgid-Bugs-To: \nPOT-Creation-Date: 2013-04-18 15:27:45.563524\nPO-Revision-Date: 2013-04-18 15:38+0100\nLast-Translator: Bastien Montagne <montagne29@wanadoo.fr>\nLanguage-Team: LANGUAGE <LL@li.org>\nLanguage: __POT__\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n",
+ (False,
+ ("Blender's translation file (po format).",
+ "Copyright (C) 2013 The Blender Foundation.",
+ "This file is distributed under the same license as the Blender package.",
+ "FIRST AUTHOR <EMAIL@ADDRESS>, YEAR."))),
+ ),
+ (("Operator", "Render: Copy Settings"),
+ (("bpy.types.SCENE_OT_render_copy_settings",),
+ ()),
+ ("fr_FR", "Rendu : copier réglages",
+ (False, ())),
+ ),
+ (("*", "Copy render settings from current scene to others"),
+ (("bpy.types.SCENE_OT_render_copy_settings",),
+ ()),
+ ("fr_FR", "Copier les réglages de rendu depuis la scène courante vers d’autres",
+ (False, ())),
+ ),
+ # ... etc, all messages from your addon.
+)
+
+translations_dict = {}
+for msg in translations_tuple:
+ key = msg[0]
+ for lang, trans, (is_fuzzy, comments) in msg[2:]:
+ if trans and not is_fuzzy:
+ translations_dict.setdefault(lang, {})[key] = trans
+
+# ##### END AUTOGENERATED I18N SECTION #####
+
+# Define remaining addon (operators, UI...) here.
+
+def register():
+ # Usual operator/UI/etc. registration...
+
+ bpy.app.translations.register(__name__, translations_dict)
+
+
+def unregister():
+ bpy.app.translations.unregister(__name__)
+
+ # Usual operator/UI/etc. unregistration...
diff --git a/doc/python_api/examples/bpy.types.Operator.5.py b/doc/python_api/examples/bpy.types.Operator.5.py
index 310eeceadf3..c1a49a756a0 100644
--- a/doc/python_api/examples/bpy.types.Operator.5.py
+++ b/doc/python_api/examples/bpy.types.Operator.5.py
@@ -2,13 +2,14 @@
Modal Execution
+++++++++++++++
-This operator defines a :class:`Operator.modal` function which running,
-handling events until it returns ``{'FINISHED'}`` or ``{'CANCELLED'}``.
-
-Grab, Rotate, Scale and Fly-Mode are examples of modal operators.
-They are especially useful for interactive tools,
-your operator can have its own state where keys toggle options as the operator
-runs.
+This operator defines a :class:`Operator.modal` function that will keep being
+run to handle events until it returns ``{'FINISHED'}`` or ``{'CANCELLED'}``.
+
+Modal operators run every time a new event is detected, such as a mouse click
+or key press. Conversely, when no new events are detected, the modal operator
+will not run. Modal operators are especially useful for interactive tools, an
+operator can have its own state where keys toggle options as the operator runs.
+Grab, Rotate, Scale, and Fly-Mode are examples of modal operators.
:class:`Operator.invoke` is used to initialize the operator as being by
returning ``{'RUNNING_MODAL'}``, initializing the modal loop.