Sample/Window.bjs
authorAlan Knowles <alan@akbkhome.com>
Fri, 11 Jun 2010 05:14:21 +0000 (13:14 +0800)
committerAlan Knowles <alan@akbkhome.com>
Fri, 11 Jun 2010 05:14:21 +0000 (13:14 +0800)
Sample/Window.bjs

index 17b3d3c..e2b0941 100644 (file)
                                                                                             "id": "view",
                                                                                             "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    settings.enable_file_access_from_file_uris = true;\n    settings.enable_offline_web_application_cache \n    settings.enable_universal_access_from_file_uris = true;\n    var _this = this;\n     \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     //create_inspector_cb\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",
+                                                                                            "|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    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    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     //create_inspector_cb\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",
                                                                                             "|renderJS": "function(data) {\n    print(\"HTML RENDERING\");\n     this.get('/BottomPane').el.show();\n    this.get('/BottomPane').el.set_current_page(2);// webkit view!\n    /// prevent looping..\n    //if (this.pendingRedraw) {\n    //   print(\"pending redraw active?!\");\n     //   return;\n    //}\n    \n    \n    if (!this.get('/Window.LeftTree').getActiveFile()) {\n        return;\n    }\n    \n    var project = this.get('/Window.LeftTree').getActiveFile().project;\n    //print (project.fn);\n    \n    project.runhtml  = 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 \n \n        this.runhtml = '<link rel=\"stylesheet\" type=\"text/css\" href=\"file://' + __script_path__ + '/../roojs1/cssX/roojs-all.css\" />'+ \"\\n\" ;\n        this.runhtml += '<script type=\"text/javascript\" src=\"file://' + __script_path__ + '/../roojs1/roojs-debug.js\"></script>'+ \"\\n\" ;\n        this.runhtml += '<script type=\"text/javascript\">' + \"\\n\" ;\n        this.runhtml += 'Ext=Roo; // bc' + \"\\n\" ;\n        this.runhtml += 'Roo.BLANK_IMAGE_URL =  \"file://' + __script_path__ + '/../roojs1/images/gray/s.gif\";'+ \"\\n\" ;\n        this.runhtml += 'Roo.rootURL = \"file://' + __script_path__ + '/../roojs1/\";'+ \"\\n\" ;\n        this.runhtml += '</script>'+ \"\\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('</head>', this.runhtml + '</head>');\n        print(\"LOAD HTML \" + html);\n        this.el.load_html_string( html , \n            //fixme\n            'http://www.akbkhome.com/'\n        );\n        // should trigger load_finished!\n        return;\n    \n    }\n    \n    this.pendingRedraw = false;    \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    //Seed.print(\"RENDER:\" + str);\n    //imports.File.File.write('/tmp/builder.debug.js', \"Builder.render(\" + JSON.stringify(data) + \");\");\n \n    this.el.execute_script(\"Builder.render(\" + JSON.stringify(data) + \");\");\n}\n",
                                                                                             "|xns": "WebKit"
                                                                                         }