1 <?xml version="1.0" encoding="UTF-8"?>
7 <filename>button_bottom.png</filename>
8 <name>button_bottom_png</name>
12 <filename>button_left_bottom.png</filename>
13 <name>button_left_bottom_png</name>
17 <filename>button_left.png</filename>
18 <name>button_left_png</name>
22 <filename>button_left_top.png</filename>
23 <name>button_left_top_png</name>
27 <filename>button.png</filename>
28 <name>button_png</name>
32 <filename>button_right_bottom.png</filename>
33 <name>button_right_bottom_png</name>
37 <filename>button_right.png</filename>
38 <name>button_right_png</name>
42 <filename>button_right_top.png</filename>
43 <name>button_right_top_png</name>
47 <filename>button_top.png</filename>
48 <name>button_top_png</name>
52 <filename>button_bottom_pressed.png</filename>
53 <name>button_bottom_pressed_png</name>
57 <filename>button_left_bottom_pressed.png</filename>
58 <name>button_left_bottom_pressed_png</name>
62 <filename>button_left_pressed.png</filename>
63 <name>button_left_pressed_png</name>
67 <filename>button_left_top_pressed.png</filename>
68 <name>button_left_top_pressed_png</name>
72 <filename>button_right_bottom_pressed.png</filename>
73 <name>button_right_bottom_pressed_png</name>
77 <filename>button_right_pressed.png</filename>
78 <name>button_right_pressed_png</name>
82 <filename>button_right_top_pressed.png</filename>
83 <name>button_right_top_pressed_png</name>
87 <filename>button_top_pressed.png</filename>
88 <name>button_top_pressed_png</name>
92 <filename>button_center.png</filename>
93 <name>button_center_png</name>
97 <filename>textbox_bottom.png</filename>
98 <name>textbox_bottom_png</name>
102 <filename>textbox_left_bottom.png</filename>
103 <name>textbox_left_bottom_png</name>
107 <filename>textbox_left.png</filename>
108 <name>textbox_left_png</name>
112 <filename>textbox_left_top.png</filename>
113 <name>textbox_left_top_png</name>
117 <filename>textbox_right_bottom.png</filename>
118 <name>textbox_right_bottom_png</name>
122 <filename>textbox_right.png</filename>
123 <name>textbox_right_png</name>
127 <filename>textbox_right_top.png</filename>
128 <name>textbox_right_top_png</name>
132 <filename>textbox_top.png</filename>
133 <name>textbox_top_png</name>
137 <filename>textbox_center.png</filename>
138 <name>textbox_center_png</name>
147 <parameter name="width" default="kill" type="int" />
148 <parameter name="height" default="kill" type="int" />
149 <parameter name="text" default="" />
152 <name>label_text</name>
153 <type>text:direct</type>
154 <source>text</source>
156 <position>0, 0</position>
157 <size>width, height</size>
166 <parameter name="width" default="kill" type="int" />
167 <parameter name="height" default="kill" type="int" />
168 <parameter name="text" default="" />
171 <name>button_center</name>
173 <source>button_center_png</source>
176 <position>button_left_top_png.get_width(), button_left_top_png.get_height()</position>
177 <size>width - (button_right_top_png.get_width() + button_left_top_png.get_width()), height - (button_right_bottom_png.get_height() + button_right_top_png.get_height())</size>
181 <name>button_text</name>
183 <source>text</source>
186 <position>[(width / 2) - (button_text.get_width() / 2), (height / 2) - (button_text.get_height() / 2)]</position>
187 <size>width, height</size>
191 <name>button_left_top</name>
193 <source>button_left_top_png</source>
196 <position>0, 0</position>
197 <size>button_left_top_png.get_width(), button_left_top_png.get_height()</size>
201 <name>button_top</name>
203 <source>button_top_png</source>
206 <position>button_left_top_png.get_width(), 0</position>
207 <size>width - (button_left_top_png.get_width() + button_right_top_png.get_width()), button_top_png.get_height()</size>
211 <name>button_right_top</name>
213 <source>button_right_top_png</source>
216 <position>width - button_right_top_png.get_width(), 0</position>
217 <size>button_right_top_png.get_width(), button_right_top_png.get_height()</size>
221 <name>button_right</name>
223 <source>button_right_png</source>
226 <position>width - button_right_png.get_width(), button_right_top_png.get_height()</position>
227 <size>button_right_png.get_width(), height - (button_right_top_png.get_height() + button_right_bottom_png.get_height())</size>
231 <name>button_right_bottom</name>
233 <source>button_right_bottom_png</source>
236 <position>width - button_right_bottom_png.get_width(), height - button_right_bottom_png.get_height()</position>
237 <size>button_right_bottom_png.get_width(), button_right_bottom_png.get_height()</size>
241 <name>button_bottom</name>
243 <source>button_bottom_png</source>
246 <position>button_left_top_png.get_width(), height - button_bottom_png.get_height()</position>
247 <size>width - (button_left_top_png.get_width() + button_right_top_png.get_width()), button_bottom_png.get_height()</size>
251 <name>button_left_bottom</name>
253 <source>button_left_bottom_png</source>
256 <position>0, height - button_left_bottom_png.get_height()</position>
257 <size>button_left_bottom_png.get_width(), button_left_top_png.get_height()</size>
261 <name>button_left</name>
263 <source>button_left_png</source>
266 <position>0, button_left_top_png.get_height()</position>
267 <size>button_left_png.get_width(), height - (button_left_top_png.get_height() + button_left_bottom_png.get_height())</size>
271 <on_event>MOUSEBUTTONUP</on_event>
273 <do>self.setPart('button_bottom', 'button_bottom_png')
274 self.setPart('button_left_bottom', 'button_left_bottom_png')
275 self.setPart('button_left', 'button_left_png')
276 self.setPart('button_left_top', 'button_left_top_png')
277 self.setPart('button_right_bottom', 'button_right_bottom_png')
278 self.setPart('button_right', 'button_right_png')
279 self.setPart('button_right_top', 'button_right_top_png')
280 self.setPart('button_top', 'button_top_png')
281 self.raiseEvent('BUTTON_CLICKED', {})</do>
286 <on_event>MOUSEBUTTONDOWN</on_event>
288 <do>self.setPart('button_bottom', 'button_bottom_pressed_png')
289 self.setPart('button_left_bottom', 'button_left_bottom_pressed_png')
290 self.setPart('button_left', 'button_left_pressed_png')
291 self.setPart('button_left_top', 'button_left_top_pressed_png')
292 self.setPart('button_right_bottom', 'button_right_bottom_pressed_png')
293 self.setPart('button_right', 'button_right_pressed_png')
294 self.setPart('button_right_top', 'button_right_top_pressed_png')
295 self.setPart('button_top', 'button_top_pressed_png')
306 <parameter name="width" default="kill" type="int" />
307 <parameter name="height" default="25" type="int" />
308 <parameter name="text" default="" />
310 <parameter name="render_text" default=" " />
312 <parameter name="insertion_mark" default="|" />
313 <parameter name="insertion_position" default="0" type="int" />
315 <parameter name="text_left" type="int" default="2" />
316 <parameter name="text_top" type="int" default="2" />
319 <name>contents</name>
321 <source>render_text</source>
323 <position>textbox_left_top_png.get_width() + self.params['parameters']['text_left'], textbox_left_top_png.get_height() + self.params['parameters']['text_top']</position>
324 <size>width, height</size>
327 width - (textbox_left_top_png.get_width() + textbox_right_top_png.get_width() + 4), height - (textbox_left_top_png.get_height() + textbox_right_top_png.get_height() + 4)
332 <name>textbox_left_top</name>
334 <source>textbox_left_top_png</source>
336 <position>0, 0</position>
337 <size>textbox_left_top_png.get_width() , textbox_left_top_png.get_height()</size>
342 <name>textbox_top</name>
344 <source>textbox_top_png</source>
346 <position>textbox_left_top_png.get_width(), 0</position>
347 <size>width - (textbox_left_top_png.get_width() + textbox_right_top_png.get_width()), textbox_top_png.get_height()</size>
351 <name>textbox_right_top</name>
353 <source>textbox_right_top_png</source>
355 <position>width - textbox_right_top_png.get_width(), 0</position>
356 <size>textbox_right_top_png.get_width(), textbox_right_top_png.get_height()</size>
360 <name>textbox_right</name>
362 <source>textbox_right_png</source>
364 <position>width - textbox_right_png.get_width(), textbox_right_top_png.get_height()</position>
365 <size>textbox_right_png.get_width(), height - (textbox_right_top_png.get_height() + textbox_right_bottom_png.get_height())</size>
369 <name>textbox_right_bottom</name>
371 <source>textbox_right_bottom_png</source>
373 <position>width - textbox_right_bottom_png.get_width(), height - textbox_right_bottom_png.get_height()</position>
374 <size>textbox_right_bottom_png.get_width(), textbox_right_bottom_png.get_height()</size>
378 <name>textbox_bottom</name>
380 <source>textbox_bottom_png</source>
382 <position>textbox_left_top_png.get_width(), height - textbox_bottom_png.get_height()</position>
383 <size>width - (textbox_left_top_png.get_width() + textbox_right_top_png.get_width()), textbox_bottom_png.get_height()</size>
387 <name>textbox_left_bottom</name>
389 <source>textbox_left_bottom_png</source>
391 <position>0, height - textbox_left_bottom_png.get_height()</position>
392 <size>textbox_left_bottom_png.get_width(), textbox_left_top_png.get_height()</size>
396 <name>textbox_left</name>
398 <source>textbox_left_png</source>
400 <position>0, textbox_left_top_png.get_height()</position>
401 <size>textbox_left_png.get_width(), height - (textbox_left_top_png.get_height() + textbox_left_bottom_png.get_height())</size>
405 <name>textbox_center</name>
407 <source>textbox_center_png</source>
409 <position>textbox_left_top_png.get_width(), textbox_left_top_png.get_height()</position>
410 <size>width - textbox_right_top_png.get_width() , height - textbox_right_bottom_png.get_height() - 1</size>
415 <on_event>KEYDOWN</on_event>
419 letter = the_event['data']['unicode']
420 the_number = the_event['data']['key']
421 key_mod = the_event['data']['mod']
423 cur_pos = self.params['parameters']['insertion_position']
425 temp_array = array.array('u', self.params['parameters']['text'].decode())
430 temp_array.pop(cur_pos)
435 if the_number == 127:
436 if cur_pos + 1 != len(temp_array):
438 temp_array.pop(cur_pos + 1)
440 if letter in letters or letter in punctuation or letter in digits or letter == ' ':
441 if the_number == 308 or the_number == 303 or the_number == 277 or the_number == 300 or the_number == 302:
444 elif the_number >= 300 and the_number <= 314:
447 elif the_number >= 282 and the_number <= 293:
450 elif the_number == 274 or the_number == 273 or the_number == 9:
453 elif the_number == 276:
459 elif the_number == 275:
460 if cur_pos == len(temp_array) - 1:
465 elif len(temp_array) == 0:
466 temp_array.append(letter.decode())
469 elif cur_pos == 0 and not len(temp_array):
470 temp_array.append(letter.decode())
473 elif len(temp_array) - 1 == cur_pos:
474 temp_array.append(letter.decode())
478 temp_array.insert(cur_pos + 1, letter.decode())
481 self.params['parameters']['insertion_position'] = cur_pos
482 self.params['parameters']['text'] = temp_array.tounicode()
483 temp_array.insert(self.params['parameters']['insertion_position'] + 1, self.params['parameters']['insertion_mark'])
485 prerender = self.the_gui_system.the_font.size(temp_array.tounicode().encode())
486 width = self.params['parameters']['width']
488 if width < prerender[0]:
490 ratio_text = float(cur_pos) / float(len(temp_array))
492 if ratio_text > (width / prerender[0]):
493 self.params['parameters']['text_left'] = (ratio_text * width) - (ratio_text * prerender[0])
495 self.params['parameters']['text_left'] = 2
497 self.params['parameters']['render_text'] = temp_array.tounicode().encode()
499 self.raiseEvent('KEYDOWN', the_event['data'])
507 <on_event>KEYSTILLDOWN</on_event>
510 #self.event(the_event)
512 #print "debug", the_event['data']
514 self.event({'type': 'KEYDOWN', 'data': the_event['data']})