X-Git-Url: http://git.roojs.org/?p=app.Builder.js;a=blobdiff_plain;f=src%2FBuilder4%2FDialogPluginWebkit.bjs;h=39c559e000e3648021869ffaf103035ef57da7bb;hp=eb2da58b6a06e633ba7bd82704c9348abf846987;hb=HEAD;hpb=5efdce9c729258e49a729dc15b85e980476eb48b diff --git a/src/Builder4/DialogPluginWebkit.bjs b/src/Builder4/DialogPluginWebkit.bjs index eb2da58b6..39c559e00 100644 --- a/src/Builder4/DialogPluginWebkit.bjs +++ b/src/Builder4/DialogPluginWebkit.bjs @@ -5,10 +5,11 @@ "path" : "/home/alan/gitlive/app.Builder.js/src/Builder4/DialogPluginWebkit.bjs", "permname" : "", "modOrder" : "", + "build_module" : "builder", "items" : [ { "listeners" : { - "delete_event" : "(self, event) => {\n this.el.hide();\n return true; \n //test \n}\n " + "delete_event" : "(self, event) => {\n this.el.hide();\n return true; \n //test \n} \n " }, "string tmpjs" : "", "id" : "DialogPluginWebkit", @@ -16,16 +17,19 @@ "gint default_height" : 500, "gboolean deletable" : true, "xtype" : "Dialog", - "| string show" : " (Gtk.Window ?parent, string text) {// JsRender.Node node) {\n \n if (parent != null) {\n this.el.set_transient_for(parent);\n this.el.modal = true;\n }\n \n \n var runhtml = \"\\n\" ;\n\n // fix to make sure they are the same..\n \n // need to modify paths\n\n string inhtml;\n \n GLib.FileUtils.get_contents(\n BuilderApplication.configDirectory() + \"/resources/roo.builder.html\"\n , out inhtml);\n \n \n // fetch the json from the database...\n \n //print(runhtml);\n \n var html = inhtml.replace(\"\", runhtml + // + this.runhtml + \n \"\" + \n // \"\" + \n // \"\" + \n \n \"\");\n //print(\"LOAD HTML \" + html);\n \n //var rootURL = _this.file.project.rootURL;\n \n \n \n this.webview.el.load_html( html , \n //fixme - should be a config option!\n \"xhttp://localhost/app.Builder.js/\"\n );\n \n \n \n this.el.show_all();\n var ret = \"\";\n while (true) {\n var response_id = this.el.run();\n if (response_id < 1) {\n this.el.hide();\n return \"\";\n }\n // keep showing...?\n break;\n }\n \n // now we save it..\n this.el.hide();\n \n return ret;\n \n \n \n}\n", + "| string show" : " (Gtk.Window ?parent, Project.Project project, string cls, string tbl) {// JsRender.Node node) {\n \n if (parent != null) {\n this.el.set_transient_for(parent);\n this.el.modal = true;\n }\n this.result_json = \"\";\n var db = project.roo_database;\n \n \n this.el.show_all();\n var ret = \"\";\n while (true) {\n \n var runhtml = \"\\n\" ;\n\n print(runhtml);\n // fix to make sure they are the same..\n \n // need to modify paths\n\n string inhtml;\n try {\n GLib.FileUtils.get_contents(\n BuilderApplication.configDirectory() + \"/resources/roo.builder.html\"\n , out inhtml);\n \n } catch (Error e) {\n inhtml = \"\";\n }\n // fetch the json from the database...\n \n //print(runhtml);\n \n var html = inhtml.replace(\"\", runhtml + // + this.runhtml + \n \"\" + \n \n \n \"\");\n //print(\"LOAD HTML \" + html);\n \n //var rootURL = _this.file.project.rootURL;\n \n \n \n this.webview.el.load_html( html , \n //fixme - should be a config option!\n \"xhttp://localhost/app.Builder.js/\"\n );\n \n \n \n \n var response_id = this.el.run();\n \n if (response_id == 1) { // OK...\n var loop = new MainLoop();\n // run toBJS to get the data... (calls back into alert handler)\n _this.result_json = \"\";\n this.webview.el.run_javascript.begin(\"Editor.\" + cls + \".panel.toBJS();\", null, (obj, res) => {\n try {\n this.webview.el.run_javascript.end(res);\n } catch(Error e) {\n \n }\n loop.quit();\n });\n loop.run();\n ret = _this.result_json;\n \n \n // print(\"LOOP END?\");\n // try and get the resopse...\n break;\n }\n if (response_id < 1) {\n this.el.hide();\n return \"\";\n }\n // keep showing...?\n continue;\n }\n \n // now we save it..\n this.el.hide();\n \n return ret;\n \n \n \n}\n", + "| bool has_plugin" : "(string cls) {\n\n return GLib.FileUtils.test(\n BuilderApplication.configDirectory() + \"/resources/Editors/Editor.\" + cls + \".js\",\n GLib.FileTest.IS_REGULAR\n );\n \n\n\n}\n", "$ xns" : "Gtk", - "gint default_width" : 500, + "gint default_width" : 750, "gboolean modal" : true, + "string result_json" : "", "items" : [ { - "xtype" : "VBox", + "xtype" : "Box", "$ pack" : "get_content_area().add", "gboolean homogeneous" : false, "$ xns" : "Gtk", + "Gtk.Orientation orientation" : "Gtk.Orientation.VERTICAL", "items" : [ { "* init" : " this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n", @@ -36,7 +40,7 @@ "items" : [ { "listeners" : { - "script_dialog" : " (dialog) => {\n if (this.el == null) {\n return true;\n }\n \n var msg = dialog.get_message();\n if (msg.length < 4) {\n return false;\n }\n if (msg.substring(0,4) != \"IPC:\") {\n return false;\n }\n var ar = msg.split(\":\", 3);\n if (ar.length < 3) {\n return false;\n }\n print(\"CMD: %s\\n\",ar[1]);\n print(\"ARGS: %s\\n\",ar[2]);\n switch(ar[1]) {\n case \"SAVEHTML\":\n print(\"%sw\",ar[2]);\n // _this.file.saveHTML(ar[2]);\n return true;\n default:\n return false;\n }\n \n}" + "script_dialog" : " (dialog) => {\n if (this.el == null) {\n return true;\n }\n \n var msg = dialog.get_message();\n if (msg.length < 4) {\n return false;\n }\n if (msg.substring(0,4) != \"IPC:\") {\n return false;\n }\n var ar = msg.split(\":\", 3);\n if (ar.length < 3) {\n return false;\n }\n print(\"CMD: %s\\n\",ar[1]);\n print(\"ARGS: %s\\n\",ar[2]);\n switch(ar[1]) {\n \n case \"SAVEHTML\":\n // print(\"%sw\",ar[2]);\n // _this.file.saveHTML(ar[2]);\n return true;\n \n case \"OUT\":\n _this.result_json = ar[2];\n return true;\n \n default:\n return true;\n }\n \n}" }, "id" : "webview", "* init" : " {\n // this may not work!?\n var settings = this.el.get_settings();\n settings.enable_write_console_messages_to_stdout = true;\n \n var fs= new FakeServer(this.el);\n fs.ref();\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 \n \n \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( \"Render not ready\" , \n //fixme - should be a config option!\n // or should we catch stuff and fix it up..\n \"xhttp://localhost/app.Builder/\"\n );\n \n \n \n \n}\n", @@ -49,9 +53,15 @@ ] }, { - "label" : "Cancel", + "label" : "Reload", "xtype" : "Button", + "* pack" : "add_action_widget,3", + "$ xns" : "Gtk" + }, + { + "label" : "Cancel", "* pack" : "add_action_widget,0", + "xtype" : "Button", "$ xns" : "Gtk" }, {