示例#1
0
def ajax_import(url, namespace=None, names=None):
    setCompilerOptions("noDebug")
    if __imported__.has_key(url):
        module = __imported__[url]
    else:
        req = load(url, None, None, False)
        module = None
        name_getter = []
        if names is None:
            names = []
        for name in names:
            name_getter.append("$pyjs$moduleObject['%s'] = %s;" % (name, name))

        script = """(function ( ) {
$pyjs$moduleObject={};
%s;
%s
return $pyjs$moduleObject;
})();""" % (req.responseText, "\n".join(name_getter))
        try:
            module = eval(script)
        except:
            e = sys.exc_info()
            raise AjaxError("Error in %s: %s" % (url, e.message))
        __imported__[url] = module
    inject(module, namespace, names)
示例#2
0
文件: dynamic.py 项目: Afey/pyjs
def ajax_import(url, namespace=None, names=None):
    setCompilerOptions("noDebug")
    if __imported__.has_key(url):
        module = __imported__[url]
    else:
        req = load(url, None, None, False)
        module = None
        name_getter = []
        if names is None:
            names = []
        for name in names:
            name_getter.append("$pyjs$moduleObject['%s'] = %s;" % (name, name))

        script = """(function ( ) {
$pyjs$moduleObject={};
%s;
%s
return $pyjs$moduleObject;
})();""" % (req.responseText, "\n".join(name_getter))
        try:
            module = eval(script)
        except:
            e = sys.exc_info()
            raise AjaxError("Error in %s: %s" % (url, e.message))
        __imported__[url] = module
    inject(module, namespace, names)
示例#3
0
 def callFlash(self, functionName, arguments=[]):
     """
     @param functionName: Methodname of ExternalInterface
     @param arguments: List with arguments of ExternalInterfaces method
     
     @return: return value of ExternalInterfaces method
     """
     movieElement = self.getMovieElement()
     if not movieElement:
         return None
     try:
         returnString = movieElement.CallFunction('<invoke name="%s" returntype="javascript">%s</invoke>' % (functionName, 
                                                                                                             self.flashArgumentsToXML(arguments, 0)))
         returnValue = ''
         if returnString:
             if returnString != 'undefined':
                 returnValue = eval(returnString)
     except:
         log.writebr('Call to '+functionName+' failed')
     return returnValue
示例#4
0
 def callFlash(self, functionName, arguments=[]):
     """
     @param functionName: Methodname of ExternalInterface
     @param arguments: List with arguments of ExternalInterfaces method
     
     @return: return value of ExternalInterfaces method
     """
     movieElement = self.getMovieElement()
     if not movieElement:
         return None
     try:
         returnString = movieElement.CallFunction('<invoke name="%s" returntype="javascript">%s</invoke>' % (functionName, 
                                                                                                             self.flashArgumentsToXML(arguments, 0)))
         returnValue = ''
         if returnString:
             if returnString != 'undefined':
                 returnValue = eval(returnString)
     except:
         log.writebr('Call to '+functionName+' failed')
     return returnValue
示例#5
0
文件: dynamic.py 项目: Afey/pyjs
 def onload_fn():
     wnd().status = ('Loaded ' + url)
     if not onload is None:
         eval(onload)
     return True
示例#6
0
文件: dynamic.py 项目: Afey/pyjs
def eval(str):
    from __javascript__ import eval
    return eval(str)
示例#7
0
 def onload_fn():
     wnd.status = ('Loaded ' + url)
     if not onload is None:
         eval(onload)
     return True
示例#8
0
def eval(str):
    from __javascript__ import eval
    return eval(str)