Exemplo n.º 1
0
    def init_app(self):
        # TODO: ideally, this should be done by hooking body with an "onLoad".

        from __pyjamas__ import pygwt_processMetas, set_main_frame
        from __pyjamas__ import set_gtk_module
        set_gtk_module(None)

        #main_frame = self._browser.get_main_frame()
        main_frame = self
        main_frame._callbacks = []
        #main_frame.gobject_wrap = pywebkit.gobject_wrap
        main_frame.platform = 'webkit'
        set_main_frame(main_frame)
Exemplo n.º 2
0
    def init_app(self):
        # TODO: ideally, this should be done by hooking body with an "onLoad".

        from __pyjamas__ import pygwt_processMetas, set_main_frame
        from __pyjamas__ import set_gtk_module
        set_gtk_module(None)

        #main_frame = self._browser.get_main_frame()
        main_frame = self
        main_frame._callbacks = []
        #main_frame.gobject_wrap = pywebkit.gobject_wrap
        main_frame.platform = 'webkit'
        set_main_frame(main_frame)
Exemplo n.º 3
0
    def init_app(self):
        # TODO: ideally, this should be done by hooking body with an "onLoad".

        from __pyjamas__ import pygwt_processMetas, set_main_frame
        from __pyjamas__ import set_gtk_module

        set_gtk_module(gtk)

        main_frame = self
        main_frame._callbacks = []
        # main_frame.gobject_wrap = pywebkit.gobject_wrap
        main_frame.platform = "webkit"
        main_frame.getUri = self.getUri
        main_frame.EventTarget = pywebkit.EventTarget

        set_main_frame(main_frame)
Exemplo n.º 4
0
    def init_app(self):
        # TODO: ideally, this should be done by hooking body with an "onLoad".

        from __pyjamas__ import pygwt_processMetas, set_main_frame
        from __pyjamas__ import set_gtk_module
        set_gtk_module(gtk)

        main_frame = self._browser.getMainFrame()
        main_frame._callbacks = []
        main_frame.gobject_wrap = webkit.gobject_wrap
        main_frame.platform = 'webkit'
        main_frame.addEventListener = addEventListener
        main_frame.getUri = self.getUri
        main_frame.getDomDocument = new.instancemethod(getDomDocument, main_frame)
        main_frame._addXMLHttpRequestEventListener = addXMLHttpRequestEventListener
        main_frame._addWindowEventListener = new.instancemethod(addWindowEventListener, main_frame)
        main_frame._alert = new.instancemethod(_alert, main_frame)
        main_frame.mash_attrib = mash_attrib
        set_main_frame(main_frame)
Exemplo n.º 5
0
Arquivo: hula.py Projeto: Afey/pyjs
    def _loaded(self, progress_listener):

        print "loaded"

        if self.already_initialised:
            return
        self.already_initialised = True

        dw = self.get_dom_window()
        doc = dw.document

        from __pyjamas__ import pygwt_processMetas, set_main_frame
        from __pyjamas__ import set_gtk_module
        set_main_frame(self)
        set_gtk_module(gtk)

        (pth, app) = os.path.split(self.application)
        if self.appdir:
            pth = os.path.abspath(self.appdir)
        sys.path.append(pth)
Exemplo n.º 6
0
    def _loaded(self, progress_listener):

        print "loaded"

        if self.already_initialised:
            return
        self.already_initialised = True

        dw = self.get_dom_window()
        doc = dw.document

        from __pyjamas__ import pygwt_processMetas, set_main_frame
        from __pyjamas__ import set_gtk_module
        set_main_frame(self)
        set_gtk_module(gtk)

        (pth, app) = os.path.split(self.application)
        if self.appdir:
            pth = os.path.abspath(self.appdir)
        sys.path.append(pth)
Exemplo n.º 7
0
    def init_app(self):
        # TODO: ideally, this should be done by hooking body with an "onLoad".

        from __pyjamas__ import pygwt_processMetas, set_main_frame
        from __pyjamas__ import set_gtk_module
        set_gtk_module(gtk)

        main_frame = self._browser.getMainFrame()
        main_frame._callbacks = []
        main_frame.gobject_wrap = webkit.gobject_wrap
        main_frame.platform = 'webkit'
        main_frame.addEventListener = addEventListener
        main_frame.getUri = self.getUri
        main_frame.getDomDocument = new.instancemethod(getDomDocument,
                                                       main_frame)
        main_frame._addXMLHttpRequestEventListener = addXMLHttpRequestEventListener
        main_frame._addWindowEventListener = new.instancemethod(
            addWindowEventListener, main_frame)
        main_frame._alert = new.instancemethod(_alert, main_frame)
        main_frame.mash_attrib = mash_attrib
        set_main_frame(main_frame)
Exemplo n.º 8
0
    def _frame_loaded_cb(self, view, frame):
        #TODO: multiple apps should be simple to implement
        if frame is not view.get_main_frame():
            logger.debug('sub-frame: %s', frame)
            return

        self._doc = self._view.get_dom_document()
        self._wnd = self._doc.get_default_view()
        self._doc.__dict__['ctx'] = self
        self._wnd.__dict__['ctx'] = self

        # GITimer: ready the listener
        view.execute_script(r'''
            (function(wnd, doc, uujs, uugi, undefined){
                wnd.addEventListener(uujs, function(e){
                    var buf = e.relatedTarget;
                    var evt = doc.createEvent('Event');
                    evt.initEvent(uugi, 0, 0);
                    buf.data = wnd[buf.data](function(){
                        buf.dispatchEvent(evt);
                    }, e.detail);
                });
            })(window, document, %r, %r);
            ''' % (GITimer.UUID, GITimer.UUID[::-1]))

        #TODO: redundant? incompat with poly-frame/reload!
        import __pyjamas__
        __pyjamas__.set_gtk_module(Gtk)
        __pyjamas__.set_main_frame(self)

        #TODO: made this work ... and skip bootstrap.js
        #for m in __pyjamas__.pygwt_processMetas():
        #    minst = module_load(m)
        #    minst.onModuleLoad()

        # return control to setup()
        Gtk.main_quit()
Exemplo n.º 9
0
    def _frame_loaded_cb(self, view, frame):
        #TODO: multiple apps should be simple to implement
        if frame is not view.get_main_frame():
            logger.debug('sub-frame: %s', frame)
            return

        self._doc = self._view.get_dom_document()
        self._wnd = self._doc.get_default_view()
        self._doc.__dict__['ctx'] = self
        self._wnd.__dict__['ctx'] = self

        # GITimer: ready the listener
        view.execute_script(r'''
            (function(wnd, doc, uujs, uugi, undefined){
                wnd.addEventListener(uujs, function(e){
                    var buf = e.relatedTarget;
                    var evt = doc.createEvent('Event');
                    evt.initEvent(uugi, 0, 0);
                    buf.data = wnd[buf.data](function(){
                        buf.dispatchEvent(evt);
                    }, e.detail);
                });
            })(window, document, %r, %r);
            ''' % (GITimer.UUID, GITimer.UUID[::-1]))

        #TODO: redundant? incompat with poly-frame/reload!
        import __pyjamas__
        __pyjamas__.set_gtk_module(Gtk)
        __pyjamas__.set_main_frame(self)

        #TODO: made this work ... and skip bootstrap.js
        #for m in __pyjamas__.pygwt_processMetas():
        #    minst = module_load(m)
        #    minst.onModuleLoad()

        # return control to setup()
        Gtk.main_quit()