tabs to spaces, remove trailing white space. (apart of pep8)
[blender-staging.git] / release / scripts / ui / buttons_data_text.py
1
2 import bpy
3
4 class DataButtonsPanel(bpy.types.Panel):
5     bl_space_type = 'PROPERTIES'
6     bl_region_type = 'WINDOW'
7     bl_context = "data"
8
9     def poll(self, context):
10         return (context.object and context.object.type == 'TEXT' and context.curve)
11
12 class DATA_PT_context_text(DataButtonsPanel):
13     bl_label = ""
14     bl_show_header = False
15
16     def draw(self, context):
17         layout = self.layout
18
19         ob = context.object
20         curve = context.curve
21         space = context.space_data
22
23         split = layout.split(percentage=0.65)
24
25         if ob:
26             split.template_ID(ob, "data")
27             split.itemS()
28         elif curve:
29             split.template_ID(space, "pin_id")
30             split.itemS()
31
32 class DATA_PT_shape_text(DataButtonsPanel):
33     bl_label = "Shape Text"
34
35     def draw(self, context):
36         layout = self.layout
37
38         ob = context.object
39         curve = context.curve
40         space = context.space_data
41
42         split = layout.split()
43
44         col = split.column()
45         col.itemL(text="Caps:")
46         row = col.row()
47         row .itemR(curve, "front")
48         row .itemR(curve, "back")
49         # col = split.column()
50         col.itemL(text="Textures:")
51         col.itemR(curve, "uv_orco")
52         col.itemR(curve, "auto_texspace")
53
54         col = split.column()
55         col.itemL(text="Resolution:")
56         sub = col.column(align=True)
57         sub.itemR(curve, "resolution_u", text="Preview")
58         sub.itemR(curve, "render_resolution_u", text="Render")
59
60         # resolution_v is not used for text
61
62         sub = col.column(align=True)
63         col.itemL(text="Display:")
64         col.itemR(curve, "fast", text="Fast Editing")
65
66 class DATA_PT_geometry_text(DataButtonsPanel):
67     bl_label = "Geometry"
68
69     def draw(self, context):
70         layout = self.layout
71
72         curve = context.curve
73
74         split = layout.split()
75
76         col = split.column()
77         col.itemL(text="Modification:")
78         col.itemR(curve, "width")
79         col.itemR(curve, "extrude")
80         col.itemL(text="Taper Object:")
81         col.itemR(curve, "taper_object", text="")
82
83         col = split.column()
84         col.itemL(text="Bevel:")
85         col.itemR(curve, "bevel_depth", text="Depth")
86         col.itemR(curve, "bevel_resolution", text="Resolution")
87         col.itemL(text="Bevel Object:")
88         col.itemR(curve, "bevel_object", text="")
89
90 class DATA_PT_font(DataButtonsPanel):
91     bl_label = "Font"
92
93     def draw(self, context):
94         layout = self.layout
95
96         text = context.curve
97         char = context.curve.edit_format
98
99         layout.itemR(text, "font")
100
101         row = layout.row()
102         row.itemR(text, "text_size", text="Size")
103         row.itemR(text, "shear")
104
105         split = layout.split()
106
107         col = split.column()
108         col.itemL(text="Object Font:")
109         col.itemR(text, "family", text="")
110
111         col = split.column()
112         col.itemL(text="Text on Curve:")
113         col.itemR(text, "text_on_curve", text="")
114
115         split = layout.split()
116
117         col = split.column()
118         col.itemL(text="Character:")
119         col.itemR(char, "bold")
120         col.itemR(char, "italic")
121         col.itemR(char, "underline")
122 #               col.itemR(char, "style")
123 #               col.itemR(char, "wrap")
124
125         col = split.column(align=True)
126         col.itemL(text="Underline:")
127         col.itemR(text, "ul_position", text="Position")
128         col.itemR(text, "ul_height", text="Thickness")
129
130 class DATA_PT_paragraph(DataButtonsPanel):
131     bl_label = "Paragraph"
132
133     def draw(self, context):
134         layout = self.layout
135
136         text = context.curve
137
138         layout.itemL(text="Align:")
139         layout.itemR(text, "spacemode", expand=True)
140
141         split = layout.split()
142
143         col = split.column(align=True)
144         col.itemL(text="Spacing:")
145         col.itemR(text, "spacing", text="Character")
146         col.itemR(text, "word_spacing", text="Word")
147         col.itemR(text, "line_dist", text="Line")
148
149         col = split.column(align=True)
150         col.itemL(text="Offset:")
151         col.itemR(text, "offset_x", text="X")
152         col.itemR(text, "offset_y", text="Y")
153
154 class DATA_PT_textboxes(DataButtonsPanel):
155     bl_label = "Text Boxes"
156
157     def draw(self, context):
158         layout = self.layout
159
160         text = context.curve
161
162         for box in text.textboxes:
163             split = layout.box().split()
164
165             col = split.column(align=True)
166             col.itemL(text="Dimensions:")
167             col.itemR(box, "width", text="Width")
168             col.itemR(box, "height", text="Height")
169
170             col = split.column(align=True)
171             col.itemL(text="Offset:")
172             col.itemR(box, "x", text="X")
173             col.itemR(box, "y", text="Y")
174
175 bpy.types.register(DATA_PT_context_text)
176 bpy.types.register(DATA_PT_shape_text)
177 bpy.types.register(DATA_PT_geometry_text)
178 bpy.types.register(DATA_PT_font)
179 bpy.types.register(DATA_PT_paragraph)
180 bpy.types.register(DATA_PT_textboxes)