Home | Trees | Indices | Help |
|
---|
|
1 # Copyright (C) 2009 Luke Kenneth Casson Leighton <lkcl@lkcl.net> 2 # 3 # Pyjamas Widget Factory. register widgets with this module, 4 # for dynamic use in applications. please observe namespaces. 5 # 6 # * pyjamas.ui namespace is used for widgets in library/pyjamas/ui 7 8 #from __pyjamas__ import doc 9 from pyjamas import log 10 from pyjamas import DOM 11 12 factory = {} 13 1719 return factory[name]2022 fc = DOM.getAttribute(element, 'id') 23 lbr = fc.find("(") 24 klsname = fc[:lbr] 25 txtargs = fc[lbr+1:-1] 26 args = [] 27 kwargs = {} 28 for arg in txtargs.split(','): 29 findeq = arg.find('=') 30 if findeq == -1: 31 args.append(arg) 32 else: 33 k = arg[:findeq] 34 v = arg[findeq+1:] 35 if ((v[0] == "'" and v[-1] == "'") or 36 (v[0] == '"' and v[-1] == '"')): 37 # string - strip quotes 38 v = v[1:-1] 39 else: 40 # assume it's an int 41 v = int(v) 42 kwargs[k] = v 43 44 kwargs['Element'] = element 45 return lookupClass(klsname)(*args, **kwargs)46 49 #try: 50 # ns = doc().namespaces.item("pyjs") 51 #except: 52 # doc().namespaces.add("pyjsinit", "urn:schemas-pyjs-org:pyjs") 53 #doc().createStyleSheet().cssText = "v\\:*{behavior:url(#default#VML);}" 54
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Wed Jun 16 12:42:36 2010 | http://epydoc.sourceforge.net |