From: Alan Knowles Date: Thu, 14 Oct 2010 09:26:07 +0000 (+0800) Subject: Sample/Window.bjs X-Git-Url: http://git.roojs.org/?p=app.Builder.js;a=commitdiff_plain;h=001a080d9e597f08f7442c2f4e502ba2673e1d95 Sample/Window.bjs --- diff --git a/Sample/Window.bjs b/Sample/Window.bjs index 8abd6703e..918cc81f7 100644 --- a/Sample/Window.bjs +++ b/Sample/Window.bjs @@ -880,7 +880,7 @@ "pack": "add", "xtype": "WebView", "|init": "function() {\n XObject.prototype.init.call(this);\n // this may not work!?\n var settings = this.el.get_settings();\n settings.enable_developer_extras = true;\n \n // this was an attempt to change the url perms.. did not work..\n // settings.enable_file_access_from_file_uris = true;\n // settings.enable_offline_web_application_cache - true;\n // settings.enable_universal_access_from_file_uris = true;\n var _this = this;\n \n // init inspector..\n this.el.get_inspector().signal.inspect_web_view.connect(function(wi, pg) {\n _this.get('/BottomPane.inspector').el.show();\n return _this.get('/BottomPane.inspector').el;\n \n });\n \n // FIXME - base url of script..\n // we need it so some of the database features work.\n this.el.load_html_string( \"Render not ready\" , \n //fixme - should be a config option!\n // or should we catch stuff and fix it up..\n 'http://localhost/app.Builder/'\n );\n \n \n //this.el.open('file:///' + __script_path__ + '/../builder.html');\n \n Gtk.drag_dest_set\n (\n this.el, /* widget that will accept a drop */\n Gtk.DestDefaults.MOTION | Gtk.DestDefaults.HIGHLIGHT,\n null, /* lists of target to support */\n 0, /* size of list */\n Gdk.DragAction.COPY /* what to do with data after dropped */\n );\n \n // print(\"RB: TARGETS : \" + LeftTree.atoms[\"STRING\"]);\n Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);\n \n GLib.timeout_add_seconds(0, 1, function() {\n // print(\"run refresh?\");\n _this.runRefresh(); \n return true;\n });\n \n \n}\n", - "|renderJS": "function(data) {\n\n // this is the public redraw c\n this.refreshRequired = true;\n}\n", + "|renderJS": "function(data) {\n\n // this is the public redraw call..\n \n this.refreshRequired = true;\n}\n", "|runRefresh": "function() \n{\n // this is run every 2 seconds from the init..\n\n \n \n if (!this.refreshRequired) {\n // print(\"no refresh required\");\n return;\n }\n\n if (this.lastRedraw) {\n // do not redraw if last redraw was less that 5 seconds ago.\n if (((new Date()) - this.lastRedraw) < 5000) {\n return;\n }\n }\n \n \n \n \n if (!this.get('/Window.LeftTree').getActiveFile()) {\n return;\n }\n this.refreshRequired = false;\n // print(\"HTML RENDERING\");\n \n this.get('/BottomPane').el.show();\n this.get('/BottomPane').el.set_current_page(2);// webkit inspector\n\n \n var js = this.get('/LeftTree.model').toJS();\n if (!js || !js.length) {\n print(\"no data\");\n return;\n }\n var data = js[0];\n \n \n var project = this.get('/Window.LeftTree').getActiveFile().project;\n //print (project.fn);\n // set it to non-empty.\n project.runhtml = project.runhtml || '';\n project.runhtml = project.runhtml.length ? project.runhtml : ''; \n \n\n this.runhtml = this.runhtml || '';\n \n if (project.runhtml != this.runhtml) {\n // then we need to reload the browser using\n // load_html_string..\n \n // then trigger a redraw once it's loaded..\n this.pendingRedraw = true;\n var runhtml = ''+ \"\\n\" ;\n \n this.runhtml = project.runhtml;\n // need to modify paths\n \n \n \n var html = imports.File.File.read(__script_path__ + '/../builder.html');\n html = html.replace('', runhtml + this.runhtml + '');\n print(\"LOAD HTML \" + html);\n this.el.load_html_string( html , \n //fixme - should be a config option!\n 'http://localhost/app.Builder/'\n );\n \n // should trigger load_finished! - which in truns shoudl set refresh Required;\n return;\n \n }\n \n \n this.renderedData = data;\n var str = JSON.stringify(data) ;\n \n if (!this.ready) {\n console.log('not loaded yet');\n }\n this.lastRedraw = new Date();\n\n this.el.execute_script(\"Builder.render(\" + JSON.stringify(data) + \");\");\n print( \"before render\" + this.lastRedraw);\n print( \"after render\" + (new Date()));\n \n}\n", "|xns": "WebKit" }