-
Notifications
You must be signed in to change notification settings - Fork 6
/
ui.py
60 lines (47 loc) · 1.68 KB
/
ui.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
import bpy
class TEXT_PT_show_update_ui(bpy.types.Panel):
bl_space_type = 'TEXT_EDITOR'
bl_region_type = 'UI'
bl_category = "Text"
bl_label = "Update Script"
@classmethod
def poll(cls, context):
return context.area.spaces.active.type == "TEXT_EDITOR" and context.area.spaces.active.text
def draw(self, context):
layout = self.layout
layout.operator("text.insert_classes")
layout.operator("text.convert_bl_info_to_manifest", icon='COPYDOWN')
layout.prop(context.scene, 'check_27', text='Include Terms From Blender 2.7')
layout.operator("text.update_script_button")
if not hasattr(bpy.types.Scene, 'update_script'):
return
if context.scene.update_script_name != bpy.context.space_data.text.filepath:
return
box = layout.box()
items = context.scene.update_script
for it in items:
cline = it[0]
cname = it[1]
cword = it[2]
csuggestion = it[3]
box = box.column(align=True)
row = box.row(align=True)
row.alignment = 'LEFT'
row.label(text="%4d " % cline)
prop = row.operator(
"text.update_script_jump",
text="%s -> %s" % (cword, csuggestion),
emboss=False)
prop.line = int(cline)
prop.cword = str(cword)
prop.csuggestion = str(csuggestion)
row.label(text="")
classes = (
TEXT_PT_show_update_ui,
)
def register():
for cls in classes:
bpy.utils.register_class(cls)
def unregister():
for cls in classes:
bpy.utils.unregister_class(cls)