diff options
author | Campbell Barton <ideasman42@gmail.com> | 2018-04-26 08:39:15 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2018-04-26 08:39:15 +0300 |
commit | 3e2edb160f32737038f99c9d2962161633b93f05 (patch) | |
tree | 1dd8123ee791ede9666d48ffd07e9c6c2eb37582 | |
parent | 37ca6ef7d86c78c135b1bdbc468bf6c04ce63994 (diff) |
UI: update tool docstring
Also assert on invalid tool definitions.
-rw-r--r-- | release/scripts/startup/bl_ui/space_toolsystem_common.py | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/release/scripts/startup/bl_ui/space_toolsystem_common.py b/release/scripts/startup/bl_ui/space_toolsystem_common.py index 4b0577729bd..b7f50eb1d77 100644 --- a/release/scripts/startup/bl_ui/space_toolsystem_common.py +++ b/release/scripts/startup/bl_ui/space_toolsystem_common.py @@ -41,13 +41,15 @@ class ToolSelectPanelHelper: - tools_from_context(context): Returns tools available in this context. - Each tool is a triplet: - ``(tool_name, manipulator_group_idname, keymap_actions)`` + Each tool is a dict: + ``(text=tool_name, icon=icon_name, widget=manipulator_group_idname, keymap=keymap_actions)`` For a separator in the toolbar, use ``None``. Where: ``tool_name`` is the name to display in the interface. + ``icon_name`` + is the name of the icon to use (found in ``release/datafiles/icons``). ``manipulator_group_idname`` is an optional manipulator group to activate when the tool is set. ``keymap_actions`` @@ -96,6 +98,9 @@ class ToolSelectPanelHelper: @classmethod def _tool_vars_from_def(cls, item): + # For now be strict about whats in this dict + # prevent accidental adding unknown keys. + assert(len(item) == 4) text = item["text"] icon_name = item["icon"] mp_idname = item["widget"] |