-
Notifications
You must be signed in to change notification settings - Fork 0
/
popup.py
96 lines (68 loc) · 2.25 KB
/
popup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
"""shortcuts for invoking popup windows"""
def _draw(draw=None):
if draw is None:
# def draw(self, ui, context):
def draw(self, context):
pass
return draw
# -------------------------------------------------------------------------
# region: Returns None
def popover(context, draw_menu=None, *args, **kargs):
"""
Small narrow popup window, similar to the redo panel\\
kargs:
ui_units_x=0, keymap=None
"""
wm = context.window_manager
d = popup._draw(draw_menu)
wm.popover(d, *args, **kargs)
return {'CANCELLED'}
def menu(context, draw_menu=None, **kargs):
"""
Basic menu with no items (designed for single-column)\\
kargs:
title="", icon='NONE'
"""
d = popup._draw(draw_menu)
context.window_manager.popup_menu(d, **kargs)
return {'CANCELLED'}
def pie(context, event, draw_menu=None, **kargs):
"""
kargs:
title="", icon='NONE'
"""
d = popup._draw(draw_menu)
context.window_manager.popup_menu_pie(event, d, **kargs)
return {'CANCELLED'}
# endregion
# -------------------------------------------------------------------------
# -------------------------------------------------------------------------
# region: Returns exit set
def invoke_confirm(context, operator, event):
"""Confirm Only (gives a single menu button)"""
return context.window_manager.invoke_confirm(operator, event)
def invoke_confirm_ok(context, self, **kargs):
"""
Does not run until clicking Ok\\
kargs:
width=554, height=247):
"""
return context.window_manager.invoke_props_dialog(self, **kargs)
def invoke_popup(context, self, **kargs):
"""
Display Only\\
kargs:
width=554
# height=247 deprecated in 2.83
Menu default width = 174
"""
return context.window_manager.invoke_popup(self, **kargs)
def invoke_props(context, self, event):
"""No customizable scale"""
return context.window_manager.invoke_props_popup(self, event)
def invoke_search(context, self):
"""little menu to search properties"""
return context.window_manager.invoke_search_popup(self)
# endregion
# -------------------------------------------------------------------------
popup = type('', (), globals())