Beispiel #1
0
 def wrapper(context, engine):
     args = []
     (fargs, fvarargs, fvarkw, fdefaults) = getargspec(func)
     if len(fargs) and fargs[0] == "self":
         args.append(context.thisObject())
     for i in xrange(context.argumentCount()):
         args.append(context.argument(i))
     try:
         result = func(*args)
     except Exception, e:
         # XXX correct behaviour?
         # http://lists.trolltech.com/qt-interest/2007-06/thread00892-0.html
         return context.throwValue(QScriptValue(engine, str(e)))
Beispiel #2
0
def debugprint(ctx, eng):  #for javascript to print to console
    print ctx.argument(0).toString()
    return QScriptValue(eng, 0)
Beispiel #3
0
 def console_print(context, engine):
     for i in range(context.argumentCount()):
         print context.argument(i).toString(),
     print
     return QScriptValue()