Пример #1
0
def generateProperty(name, config, members, method):
    if not method in ["get", "is"]:
        return

    # print "Generate %s for %s" % (method, name)

    code = "function(){"

    if "inheritable" in config:
        code += 'if(this.$$inherit_' + name + '!==undefined)'
        code += 'return this.$$inherit_' + name + ';'
        code += 'else '

    code += 'if(this.$$user_' + name + '!==undefined)'
    code += 'return this.$$user_' + name + ';'

    if "themeable" in config:
        code += 'else if(this.$$theme_' + name + '!==undefined)'
        code += 'return this.$$theme_' + name + ';'

    if not "init" in config and "deferredInit" in config:
        code += 'else if(this.$$init_' + name + '!==undefined)'
        code += 'return this.$$init_' + name + ';'

    code += 'else '

    if "init" in config:
        code += 'return this.$$init_' + name + ';'
    else:
        code += 'return null;'

    code += "}"

    func = treeutil.compileString(code)
    pair = treeutil.createPair(method + name[0].upper() + name[1:], func)

    members.addChild(pair)
Пример #2
0
def generateProperty(name, config, members, method):
    if not method in ["get", "is"]:
        return
    
    # print "Generate %s for %s" % (method, name)
    
    code = "function(){"
    
    if "inheritable" in config:
        code += 'if(this.$$inherit_' + name + '!==undefined)'
        code += 'return this.$$inherit_' + name + ';'
        code += 'else '

    code += 'if(this.$$user_' + name + '!==undefined)'
    code += 'return this.$$user_' + name + ';'

    if "themeable" in config:
        code += 'else if(this.$$theme_' + name + '!==undefined)'
        code += 'return this.$$theme_' + name + ';'

    if not "init" in config and "deferredInit" in config:
        code += 'else if(this.$$init_' + name + '!==undefined)'
        code += 'return this.$$init_' + name + ';'

    code += 'else '

    if "init" in config:
        code += 'return this.$$init_' + name + ';'
    else:
        code += 'return null;'
        
    code += "}"

    func = treeutil.compileString(code)
    pair = treeutil.createPair(method + name[0].upper() + name[1:], func)
    
    members.addChild(pair)
Пример #3
0
def generateProperty(name, config, members, method):
    if not method in ["get", "is"]:
        return

    # print "Generate %s for %s" % (method, name)

    code = "function(){"

    if config.has_key("inheritable"):
        code += "if(this.$$inherit_" + name + "!==undefined)"
        code += "return this.$$inherit_" + name + ";"
        code += "else "

    code += "if(this.$$user_" + name + "!==undefined)"
    code += "return this.$$user_" + name + ";"

    if config.has_key("themeable"):
        code += "else if(this.$$theme_" + name + "!==undefined)"
        code += "return this.$$theme_" + name + ";"

    if not config.has_key("init") and config.has_key("deferredInit"):
        code += "else if(this.$$init_" + name + "!==undefined)"
        code += "return this.$$init_" + name + ";"

    code += "else "

    if config.has_key("init"):
        code += "return this.$$init_" + name + ";"
    else:
        code += "return null;"

    code += "}"

    func = treeutil.compileString(code)
    pair = treeutil.createPair(method + name[0].upper() + name[1:], func)

    members.addChild(pair)