comparison tools/svg2code.py @ 296:2e97e8082d83

* Fix the symbol definition code which does not assume the id is the same as the mbname. * Add appleTV style list demo. We need to add animation latter. It is staic for now.
author wycc
date Sun, 01 Feb 2009 16:28:28 +0800
parents 5c066380a84e
children 1b69da2494e9
comparison
equal deleted inserted replaced
295:2469f8d23658 296:2e97e8082d83
360 def deco(obj, coord_id, codefo, doc): 360 def deco(obj, coord_id, codefo, doc):
361 if obj.hasAttribute('mbname'): 361 if obj.hasAttribute('mbname'):
362 ## \note mbname declare that this node should be in the 362 ## \note mbname declare that this node should be in the
363 # symbol table. 363 # symbol table.
364 mbname = obj.getAttribute('mbname') 364 mbname = obj.getAttribute('mbname')
365 print >> codefo, 'ADD_SYMBOL([%s])dnl' % (mbname) 365 id = obj.getAttribute('id')
366 print >> codefo, 'ADD_SYMBOL([%s],[%s])dnl' % (id,mbname)
366 pass 367 pass
367 func(obj, coord_id, codefo, doc) 368 func(obj, coord_id, codefo, doc)
368 pass 369 pass
369 return deco 370 return deco
370 371
570 translate_style(text, coord_id, codefo, doc, 'TEXT_') 571 translate_style(text, coord_id, codefo, doc, 'TEXT_')
571 if text.hasAttribute('mbname'): 572 if text.hasAttribute('mbname'):
572 ## \note mbname declare that this node should be in the 573 ## \note mbname declare that this node should be in the
573 # symbol table. 574 # symbol table.
574 mbname = text.getAttribute('mbname') 575 mbname = text.getAttribute('mbname')
575 print >> codefo, 'ADD_SYMBOL([%s])dnl' % (mbname) 576 id = text.getAttribute('id')
577 print >> codefo, 'ADD_SYMBOL([%s],[%s])dnl' % (id,mbname)
576 pass 578 pass
577 pass 579 pass
578 580
579 reo_func = re.compile('([a-zA-Z]+)\\([^\\)]*\\)') 581 reo_func = re.compile('([a-zA-Z]+)\\([^\\)]*\\)')
580 reo_translate = re.compile('translate\\(([-+]?[0-9]+(\\.[0-9]+)?),([-+]?[0-9]+(\\.[0-9]+)?)\\)') 582 reo_translate = re.compile('translate\\(([-+]?[0-9]+(\\.[0-9]+)?),([-+]?[0-9]+(\\.[0-9]+)?)\\)')