Cleanup: spelling in comments, strings (make check_spelling_*)

Also replace some triple-quoted non-doc-string strings with commented
blocks in examples.
This commit is contained in:
Campbell Barton
2025-05-06 00:18:39 +00:00
parent b47332c40d
commit fd6ac498b0
17 changed files with 44 additions and 39 deletions

View File

@@ -12,7 +12,7 @@ Introduction
To add translations to your Python script, you must define a dictionary formatted like that:
``{locale: {msg_key: msg_translation, ...}, ...}`` where:
- locale is either a lang iso code (e.g. ``fr``), a lang+country code (e.g. ``pt_BR``),
- locale is either a lang ISO code (e.g. ``fr``), a lang+country code (e.g. ``pt_BR``),
a lang+variant code (e.g. ``sr@latin``), or a full code (e.g. ``uz_UZ@cyrilic``).
- msg_key is a tuple (context, org message) - use, as much as possible, the predefined :const:`contexts`.
- msg_translation is the translated message in given language!

View File

@@ -26,14 +26,14 @@ import bpy
class CurveTextImport(bpy.types.Operator):
""" Test importer that creates a text object from a .txt file """
"""
Test importer that creates a text object from a text file.
"""
bl_idname = "curve.text_import"
bl_label = "Import a text file as text object"
"""
This Operator supports import one .txt file at the time, we need the
following filepath property that the file handler will use to set file path data.
"""
# This Operator supports import one `.txt` file at the time, we need the
# following file-path property that the file handler will use to set file path data.
filepath: bpy.props.StringProperty(subtype='FILE_PATH', options={'SKIP_SAVE'})
@classmethod
@@ -41,7 +41,7 @@ class CurveTextImport(bpy.types.Operator):
return (context.area and context.area.type == "VIEW_3D")
def execute(self, context):
""" Calls to this Operator can set unfiltered filepaths, ensure the file extension is .txt. """
# Calls to this Operator can set unfiltered file-paths, ensure the file extension is `.txt`.
if not self.filepath or not self.filepath.endswith(".txt"):
return {'CANCELLED'}
@@ -52,13 +52,11 @@ class CurveTextImport(bpy.types.Operator):
bpy.context.scene.collection.objects.link(text_object)
return {'FINISHED'}
"""
By default the file handler invokes the operator with the filepath property set.
In this example if this property is set the operator is executed, if not the
file select window is invoked.
This depends on setting ``options={'SKIP_SAVE'}`` to the property options to avoid
to reuse filepath data between operator calls.
"""
# By default the file handler invokes the operator with the file-path property set.
# In this example if this property is set the operator is executed, if not the
# file select window is invoked.
# This depends on setting `options={'SKIP_SAVE'}` to the property options to avoid
# to reuse file-path data between operator calls.
def invoke(self, context, event):
if self.filepath:

View File

@@ -108,7 +108,7 @@ class MESH_UL_vgroups_slow(bpy.types.UIList):
def filter_items_empty_vgroups(self, context, vgroups):
# This helper function checks vgroups to find out whether they are empty, and what's their average weights.
# TODO: This should be RNA helper actually (a vgroup prop like "raw_data: ((vidx, vweight), etc.)").
# TODO: This should be RNA helper actually (a vgroup prop like `"raw_data: ((vidx, vweight), etc.)"`).
# Too slow for Python!
obj_data = context.active_object.data
ret = {vg.index: [True, 0.0] for vg in vgroups}
@@ -131,7 +131,7 @@ class MESH_UL_vgroups_slow(bpy.types.UIList):
ret[vg.group][0] = False
ret[vg.group][1] += vg.weight * fact
elif hasattr(obj_data, "points"): # Lattice data
# XXX no access to lattice editdata?
# XXX: no access to lattice edit-data?
fact = 1 / len(obj_data.points)
for v in obj_data.points:
for vg in v.groups:
@@ -142,11 +142,11 @@ class MESH_UL_vgroups_slow(bpy.types.UIList):
def filter_items(self, context, data, propname):
# This function gets the collection property (as the usual tuple (data, propname)), and must return two lists:
# * The first one is for filtering, it must contain 32bit integers were self.bitflag_filter_item marks the
# matching item as filtered (i.e. to be shown). The upper 16 bits (including self.bitflag_filter_item) are
# matching item as filtered (i.e. to be shown). The upper 16 bits (including `self.bitflag_filter_item`) are
# reserved for internal use, the lower 16 bits are free for custom use. Here we use the first bit to mark
# VGROUP_EMPTY.
# * The second one is for reordering, it must return a list containing the new indices of the items (which
# gives us a mapping org_idx -> new_idx).
# gives us a mapping `org_idx -> new_idx`).
# Please note that the default UI_UL_list defines helper functions for common tasks (see its doc for more info).
# If you do not make filtering and/or ordering, return empty list(s) (this will be more efficient than
# returning full lists doing nothing!).