From 9541c5d224d60885d0e3c0f0fbf6ed5dceae13cf Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Thu, 5 Aug 2010 09:28:00 +0800 Subject: [PATCH] Sample/Window.bjs --- Sample/Window.bjs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Sample/Window.bjs b/Sample/Window.bjs index e61c8b966..78f443d13 100644 --- a/Sample/Window.bjs +++ b/Sample/Window.bjs @@ -853,7 +853,7 @@ "id": "view", "pack": "add", "xtype": "WebView", - "|runRefresh": "function() \n{\n // this is run every 2 seconds from the init..\n \n if (!this.refreshRequired) {\n print(\"no refresh required\");\n return;\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 view!\n\n \n var js = this.get('/LeftTree.model').toJS();\n if (!js || !js.length) {\n return;\n \t}\n \tdata = 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://www.akbkhome.com/e/'\n );\n \n // should trigger load_finished! - which in truns shoudl set refresh Required;\n return;\n \n }\n \n this.pendingRedraw = false; // needed any more?\n return;\n \n this.renderedData = data;\n var str = JSON.stringify(data) ;\n \n if (!this.ready) {\n console.log('not loaded yet');\n }\n \n this.el.execute_script(\"Builder.render(\" + JSON.stringify(data) + \");\");\n \n}\n", + "|runRefresh": "function() \n{\n // this is run every 2 seconds from the init..\n \n if (!this.refreshRequired) {\n print(\"no refresh required\");\n return;\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 view!\n\n \n var js = this.get('/LeftTree.model').toJS();\n if (!js || !js.length) {\n return;\n \t}\n \tdata = 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://www.akbkhome.com/e/'\n );\n \n // should trigger load_finished! - which in truns shoudl set refresh Required;\n return;\n \n }\n \n this.pendingRedraw = false; // needed any more?\n return;\n \n this.renderedData = data;\n var str = JSON.stringify(data) ;\n \n if (!this.ready) {\n console.log('not loaded yet');\n }\n \n this.el.execute_script(\"Builder.render(\" + JSON.stringify(data) + \");\");\n \n}\n", "|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 'http://www.akbkhome.com/e/'\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, 2, function() {\n print(\"run refresh?\");\n _this.runRefresh(); \n return true;\n });\n \n \n}\n", "|renderJS": "function(data) {\n this.refreshRequired = true;\n}\n", "|xns": "WebKit" -- 2.39.2