Changeset View
Changeset View
Standalone View
Standalone View
release/scripts/startup/bl_ui/space_userpref.py
| # SPDX-License-Identifier: GPL-2.0-or-later | # SPDX-License-Identifier: GPL-2.0-or-later | ||||
| import bpy | import bpy | ||||
| from bpy.types import ( | from bpy.types import ( | ||||
| Header, | Header, | ||||
| Menu, | Menu, | ||||
| Panel, | Panel, | ||||
| ) | ) | ||||
| from bpy.app.translations import ( | from bpy.app.translations import ( | ||||
| contexts as i18n_contexts, | contexts as i18n_contexts, | ||||
| pgettext_iface as iface_, | pgettext_iface as iface_, | ||||
| pgettext_tip as tip_, | |||||
| ) | ) | ||||
| # ----------------------------------------------------------------------------- | # ----------------------------------------------------------------------------- | ||||
| # Main Header | # Main Header | ||||
| class USERPREF_HT_header(Header): | class USERPREF_HT_header(Header): | ||||
| bl_space_type = 'PREFERENCES' | bl_space_type = 'PREFERENCES' | ||||
| ▲ Show 20 Lines • Show All 1,903 Lines • ▼ Show 20 Lines | def draw(self, context): | ||||
| (filter == info["category"]) or | (filter == info["category"]) or | ||||
| (filter == "User" and (mod.__file__.startswith(addon_user_dirs))) | (filter == "User" and (mod.__file__.startswith(addon_user_dirs))) | ||||
| ) | ) | ||||
| if show_enabled_only: | if show_enabled_only: | ||||
| is_visible = is_visible and is_enabled | is_visible = is_visible and is_enabled | ||||
| if is_visible: | if is_visible: | ||||
| if search and not ( | if search and not ( | ||||
| (search in info["name"].lower()) or | (search in info["name"].lower() or | ||||
| search in iface_(info["name"]).lower()) or | |||||
| (info["author"] and (search in info["author"].lower())) or | (info["author"] and (search in info["author"].lower())) or | ||||
| ((filter == "All") and (search in info["category"].lower())) | ((filter == "All") and (search in info["category"].lower() or | ||||
| search in iface_(info["category"]).lower())) | |||||
| ): | ): | ||||
| continue | continue | ||||
| # Addon UI Code | # Addon UI Code | ||||
| col_box = col.column() | col_box = col.column() | ||||
| box = col_box.box() | box = col_box.box() | ||||
| colsub = box.column() | colsub = box.column() | ||||
| row = colsub.row(align=True) | row = colsub.row(align=True) | ||||
| row.operator( | row.operator( | ||||
| "preferences.addon_expand", | "preferences.addon_expand", | ||||
| icon='DISCLOSURE_TRI_DOWN' if info["show_expanded"] else 'DISCLOSURE_TRI_RIGHT', | icon='DISCLOSURE_TRI_DOWN' if info["show_expanded"] else 'DISCLOSURE_TRI_RIGHT', | ||||
| emboss=False, | emboss=False, | ||||
| ).module = module_name | ).module = module_name | ||||
| row.operator( | row.operator( | ||||
| "preferences.addon_disable" if is_enabled else "preferences.addon_enable", | "preferences.addon_disable" if is_enabled else "preferences.addon_enable", | ||||
| icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', text="", | icon='CHECKBOX_HLT' if is_enabled else 'CHECKBOX_DEHLT', text="", | ||||
| emboss=False, | emboss=False, | ||||
| ).module = module_name | ).module = module_name | ||||
| sub = row.row() | sub = row.row() | ||||
| sub.active = is_enabled | sub.active = is_enabled | ||||
| sub.label(text="%s: %s" % (info["category"], info["name"])) | sub.label(text=iface_("%s: %s") % (iface_(info["category"]), iface_(info["name"]))) | ||||
mont29: not sure there is much point in translating that one? | |||||
pioverfourAuthorUnsubmitted Done Inline ActionsAre you talking about the whole line, or just the "%s: %s" bit? If the whole line, then I believe most add-ons need to have their name translated, except if they have an original / fancy / brand name. And the category is already translated in the Enum, so it makes sense to translate it here as well. But maybe as a tip_, though, not sure… If the %s bit, it’s not strictly needed but it was already extracted here and in several other places anyway. It allows changing the punctuation, which is more correct (and pleasing) in French and possibly other languages (well, that’s dubious but who knows!). pioverfour: Are you talking about the whole line, or just the `"%s: %s"` bit?
If the whole line, then I… | |||||
mont29Unsubmitted Not Done Inline ActionsWas talking about the "%s: %s" part yes, but fair enough. mont29: Was talking about the `"%s: %s"` part yes, but fair enough. | |||||
| if info["warning"]: | if info["warning"]: | ||||
| sub.label(icon='ERROR') | sub.label(icon='ERROR') | ||||
| # icon showing support level. | # icon showing support level. | ||||
| sub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION')) | sub.label(icon=self._support_icon_mapping.get(info["support"], 'QUESTION')) | ||||
| # Expanded UI (only if additional info is available) | # Expanded UI (only if additional info is available) | ||||
| if info["show_expanded"]: | if info["show_expanded"]: | ||||
| if info["description"]: | if info["description"]: | ||||
| split = colsub.row().split(factor=0.15) | split = colsub.row().split(factor=0.15) | ||||
| split.label(text="Description:") | split.label(text="Description:") | ||||
| split.label(text=info["description"]) | split.label(text=tip_(info["description"])) | ||||
| if info["location"]: | if info["location"]: | ||||
| split = colsub.row().split(factor=0.15) | split = colsub.row().split(factor=0.15) | ||||
| split.label(text="Location:") | split.label(text="Location:") | ||||
| split.label(text=info["location"]) | split.label(text=tip_(info["location"])) | ||||
| if mod: | if mod: | ||||
| split = colsub.row().split(factor=0.15) | split = colsub.row().split(factor=0.15) | ||||
| split.label(text="File:") | split.label(text="File:") | ||||
| split.label(text=mod.__file__, translate=False) | split.label(text=mod.__file__, translate=False) | ||||
| if info["author"]: | if info["author"]: | ||||
| split = colsub.row().split(factor=0.15) | split = colsub.row().split(factor=0.15) | ||||
| split.label(text="Author:") | split.label(text="Author:") | ||||
| split.label(text=info["author"], translate=False) | split.label(text=info["author"], translate=False) | ||||
| ▲ Show 20 Lines • Show All 449 Lines • Show Last 20 Lines | |||||
not sure there is much point in translating that one?