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)
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)
def _loaded(self): #print "loaded" if self.already_initialised: return self.already_initialised = True self._addWindowEventListener("unload", self.on_unload_callback) from __pyjamas__ import pygwt_processMetas, set_main_frame set_main_frame(self) (pth, app) = os.path.split(self.application) if self.appdir: pth = os.path.abspath(self.appdir) sys.path.append(pth)
def __init__(self, filename, width, height): self._listeners = [] self.app = QApplication(sys.argv) self.win = QMainWindow() self.win.resize(width, height) self.browser = QWebView(_win) filename = os.path.abspath(filename) self.browser.setUrl(QUrl(filename)) filename = filename.split("?")[0] path, path = os.path.split(filename) self.browser.setHtml(open(filename).read(), QUrl.fromLocalFile(filename)) self.win.setCentralWidget(self.browser) self.win.show() from __pyjamas__ import pygwt_processMetas, set_main_frame from __pyjamas__ import set_gtk_module set_main_frame(self)
def __init__(self, filename, width, height): self._listeners = [] self.app = QApplication(sys.argv) self.win = QMainWindow() self.win.resize(width, height) self.browser = QWebView(_win) filename = os.path.abspath(filename) self.browser.setUrl(QUrl(filename)) filename = filename.split("?")[0] path, path = os.path.split(filename) self.browser.setHtml( open(filename).read(), QUrl.fromLocalFile(filename)) self.win.setCentralWidget(self.browser) self.win.show() from __pyjamas__ import pygwt_processMetas, set_main_frame from __pyjamas__ import set_gtk_module set_main_frame(self)
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)
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)
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)
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()