__pyjamas__.py :  » Ajax » pyjamas » src » library » Python Open Source

Home
Python Open Source
1.3.1.2 Python
2.Ajax
3.Aspect Oriented
4.Blog
5.Build
6.Business Application
7.Chart Report
8.Content Management Systems
9.Cryptographic
10.Database
11.Development
12.Editor
13.Email
14.ERP
15.Game 2D 3D
16.GIS
17.GUI
18.IDE
19.Installer
20.IRC
21.Issue Tracker
22.Language Interface
23.Log
24.Math
25.Media Sound Audio
26.Mobile
27.Network
28.Parser
29.PDF
30.Project Management
31.RSS
32.Search
33.Security
34.Template Engines
35.Test
36.UML
37.USB Serial
38.Web Frameworks
39.Web Server
40.Web Services
41.Web Unit
42.Wiki
43.Windows
44.XML
Python Open Source » Ajax » pyjamas 
pyjamas » src » library » __pyjamas__.py
# This is the gtk-dependent __pyjamas__ module.
# In javascript this module is not needed, any imports of this module
# are removed by the translator.

""" This module interfaces between PyWebkitGTK and the Pyjamas API,
    to get applications kick-started.
"""
import sys
from traceback import print_stack

main_frame = None
gtk_module = None

def noSourceTracking(*args):
    pass

def unescape(str):
    s = s.replace("&", "&")
    s = s.replace("&lt;", "<")
    s = s.replace("&gt;", ">")
    s = s.replace("&quot;", '"')
    return s

def set_gtk_module(m):
    global gtk_module
    gtk_module = m

def get_gtk_module():
    global gtk_module
    return gtk_module

def set_main_frame(frame):
    print "set_main_frame", frame
    global main_frame
    main_frame = frame
    from pyjamas import DOM
    # ok - now the main frame has been set we can initialise the
    # signal handlers etc.
    DOM.init()

def get_main_frame():
    return main_frame

def doc():
    return main_frame.getDomDocument() 

def wnd():
    return main_frame.getDomWindow() 

def JS(code):
    """ try to avoid using this function, it will only give you grief
        right now...
    """
    ctx = main_frame.gjs_get_global_context()
    try:
        return ctx.eval(code)
    except:
        print "code", code
        print_stack()

pygwt_moduleNames = []

def pygwt_processMetas():
    from pyjamas import DOM
    metas = doc().getElementsByTagName("meta")
    for i in range(metas.length):
        meta = metas.item(i)
        name = DOM.getAttribute(meta, "name")
        if name == "pygwt:module":
            content = DOM.getAttribute(meta, "content")
            if content:
                pygwt_moduleNames.append(content)
    return pygwt_moduleNames

class console:

    @staticmethod
    def error(msg):
        print "TODO CONSOLE:", msg

def debugger():
    pass

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.