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
path: root/doc
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2018-01-28 07:18:33 +0300
committerCampbell Barton <ideasman42@gmail.com>2018-01-28 07:18:33 +0300
commit88174bd22c8798fa5038a3b8d5192e052bfe673e (patch)
tree728c5654cf0fb879027b774d5b4bf964ffe543ec /doc
parent7aaede920fd1376fc06edd45c73403f2084a64bc (diff)
parent3c852ba0741f794a697f95073b04921e9ff94039 (diff)
Merge branch 'master' into blender2.8
Diffstat (limited to 'doc')
-rw-r--r--doc/python_api/examples/bpy.types.Operator.6.py38
1 files changed, 38 insertions, 0 deletions
diff --git a/doc/python_api/examples/bpy.types.Operator.6.py b/doc/python_api/examples/bpy.types.Operator.6.py
new file mode 100644
index 00000000000..d32a7d5fd4a
--- /dev/null
+++ b/doc/python_api/examples/bpy.types.Operator.6.py
@@ -0,0 +1,38 @@
+"""
+Enum Search Popup
++++++++++++++++++
+
+You may want to have an operator prompt the user to select an item
+from a search field, this can be done using :class:`bpy.types.Operator.invoke_search_popup`.
+"""
+import bpy
+from bpy.props import EnumProperty
+
+
+class SearchEnumOperator(bpy.types.Operator):
+ bl_idname = "object.search_enum_operator"
+ bl_label = "Search Enum Operator"
+ bl_property = "my_search"
+
+ my_search = EnumProperty(
+ name="My Search",
+ items=(
+ ('FOO', "Foo", ""),
+ ('BAR', "Bar", ""),
+ ('BAZ', "Baz", ""),
+ ),
+ )
+
+ def execute(self, context):
+ self.report({'INFO'}, "Selected:" + self.my_search)
+ return {'FINISHED'}
+
+ def invoke(self, context, event):
+ context.window_manager.invoke_search_popup(self)
+ return {'RUNNING_MODAL'}
+
+
+bpy.utils.register_class(SearchEnumOperator)
+
+# test call
+bpy.ops.object.search_enum_operator('INVOKE_DEFAULT')