From cba181b5f6c20a1bc577aea17fa47c89b2f7c430 Mon Sep 17 00:00:00 2001 From: Alan Knowles Date: Mon, 7 Jun 2010 14:58:44 +0800 Subject: [PATCH] Builder/Window.js --- Builder/Window.js | 841 +++++++++++++++++++++------------------------- 1 file changed, 389 insertions(+), 452 deletions(-) diff --git a/Builder/Window.js b/Builder/Window.js index 7c61ee935..35c2e2296 100644 --- a/Builder/Window.js +++ b/Builder/Window.js @@ -402,27 +402,41 @@ Window=new XObject({ items : [ { xtype: Gtk.ScrolledWindow, + id : "LeftTree", pack : "add", - shadow_type : Gtk.ShadowType.IN, - init : function() { - XObject.prototype.init.call(this); - this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) + getActiveElement : function() { // return path to actie node. + + var path = this.getActivePath(); + if (!path) { + return false; + } + var iter = new Gtk.TreeIter(); + this.get('model').el.get_iter_from_string(iter, path); + + var value = new GObject.Value(''); + this.get('model').el.get_value(iter, 2, value); + + return JSON.parse(value.value); + }, + getActiveFile : function() { + return this.get('model').file; + }, + getActivePath : function() { + var model = this.get('model'); + var view = this.get('view'); + if (view.selection.count_selected_rows() < 1) { + return false; + } + var iter = new Gtk.TreeIter(); + + view.selection.get_selected(model.el, iter); + return model.el.get_path(iter).to_string(); }, - id : "LeftTree", getPaleteProvider : function() { var model = this.get('model'); var pm = imports.Builder.Provider.ProjectManager.ProjectManager; return pm.getPalete(model.file.getType()); }, - renderView : function() { - var render = this.getRenderer(); - var model = this.get('model'); - if (render) { - render.renderJS(model.toJS(false,true)[0]); - } else { - print("NO RENDER JS METHOD?"); - } - }, getRenderer : function() { switch( this.getActiveFile().getType()) { @@ -433,34 +447,20 @@ Window=new XObject({ } }, - getActivePath : function() { + init : function() { + XObject.prototype.init.call(this); + this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) + }, + renderView : function() { + var render = this.getRenderer(); var model = this.get('model'); - var view = this.get('view'); - if (view.selection.count_selected_rows() < 1) { - return false; + if (render) { + render.renderJS(model.toJS(false,true)[0]); + } else { + print("NO RENDER JS METHOD?"); } - var iter = new Gtk.TreeIter(); - - view.selection.get_selected(model.el, iter); - return model.el.get_path(iter).to_string(); - }, - getActiveFile : function() { - return this.get('model').file; - }, - getActiveElement : function() { - - var path = this.getActivePath(); - if (!path) { - return false; - } - var iter = new Gtk.TreeIter(); - this.get('model').el.get_iter_from_string(iter, path); - - var value = new GObject.Value(''); - this.get('model').el.get_value(iter, 2, value); - - return JSON.parse(value.value); }, + shadow_type : Gtk.ShadowType.IN, items : [ { xtype: Gtk.TreeView, @@ -785,17 +785,10 @@ Window=new XObject({ items : [ { xtype: Gtk.TreeStore, - pack : "set_model", - id : "model", - init : function() { - XObject.prototype.init.call(this); - this.el.set_column_types ( 3, [ - GObject.TYPE_STRING, // title - GObject.TYPE_STRING, // tip - GObject.TYPE_STRING // source.. - ] ); - }, activePath : false, + currentTree : false, + id : "model", + pack : "set_model", changed : function(n, refresh) { print("MODEL CHANGED CALLED" + this.activePath); if (this.activePath) { @@ -830,149 +823,28 @@ Window=new XObject({ } }, - loadFile : function(f) { - //console.dump(f); - this.el.clear(); - this.file = f; - - if (!f) { - console.log('missing file'); - return; - } - - // load the file if not loaded.. - if (f.items === false) { - var _this = this; - f.loadItems(function() { - _this.loadFile(f); - }); - return; - - } - this.get('/Window').setTitle(f.project.getName() + ' - ' + f.name); - - if (f.items.length && typeof(f.items[0]) == 'string') { - - this.get('/RightEditor').el.show(); - this.get('/RightEditor.view').load( f.items[0]); - return; - } - print("LOAD"); - //console.dump(f.items); - this.load(f.items); - this.get('/LeftTree.view').el.expand_all(); - - if (!f.items.length) { - // single item.. - - this.get('/Window.leftvpaned').el.set_position(80); - // select first... - this.get('/LeftTree.view').el.set_cursor( - new Gtk.TreePath.from_string('0'), null, false); - - - } else { - this.get('/Window.leftvpaned').el.set_position(200); - } - - - //print("hide right editior"); - this.get('/RightEditor').el.hide(); - //print("set current tree"); - this.currentTree = this.toJS(false, false)[0]; - //console.dump(this.currentTree); - this.currentTree = this.currentTree || { items: [] }; - this.get('/LeftTree').renderView(); - //console.dump(this.map); - //var RightPalete = imports.Builder.RightPalete.RightPalete; - var pm = this.get('/RightPalete.model'); - // set up provider.. - - this.get('/RightPalete').provider = this.get('/LeftTree').getPaleteProvider(); - - if (!this.get('/RightPalete').provider) { - print ("********* PALETE PROVIDER MISSING?!!"); - } - this.get('/LeftTree').renderView(); - - pm.load( this.get('/LeftTree').getPaleteProvider().gatherList(this.listAllTypes())); - - - - this.get('/Window.view-notebook').el.set_current_page( - this.get('/LeftTree.model').file.getType()== 'Roo' ? 0 : -1); - - }, - findDropNode : function(treepath_str, targets) { - - // this is used by the dragdrop code in the roo version AFAIR.. + deleteSelected : function() { + this.get('/LeftTree.view').blockChanges = true; + var old_iter = new Gtk.TreeIter(); + var s = this.get('/LeftTree.view').selection; + s.get_selected(this.el, old_iter); + var path = this.el.get_path(old_iter).to_string(); - var path = treepath_str.replace(/^builder-/, ''); - // treemap is depreciated... - should really check if model has any entries.. + this.activePath= false; + s.unselect_all(); - if (!this.el.iter_n_children(null)) { - print("NO KEYS"); - return [ '', Gtk.TreeViewDropPosition.INTO_OR_AFTER]; - } - print("FIND treepath: " + path); - //console.dump(this.treemap); - - if (!treepath_str.match(/^builder-/)) { - return []; // nothing! - } - if (targets === true) { - return [ path ]; - } - return this.findDropNodeByPath(path,targets) - }, - findDropNodeByPath : function(treepath_str, targets, pref) { - var path = treepath_str + ''; // dupe it.. - pref = typeof(pref) == 'undefined' ? Gtk.TreeViewDropPosition.INTO_OR_AFTER : pref; - var last = false; - //console.dump(this.treemap); - while (path.length) { - print("LOOKING FOR PATH: " + path); - var node_data = this.singleNodeToJS(path); - if (node_data === false) { - print("node not found"); - return []; - } - - var xname = this.get('/LeftTree.model').file.guessName(node_data); - var match = false; - var prop = ''; - targets.forEach(function(tg) { - if (match) { - return;; - } - if ((tg == xname) ) { - match = tg; - } - if (tg.indexOf(xname +':') === 0) { - match = tg; - prop = tg.split(':').pop(); - } - }); - - if (match) { - if (last) { // pref is after/before.. - // then it's after last - if (pref > 1) { - return []; // do not allow.. - } - return [ last, pref , prop]; - - } - return [ path , Gtk.TreeViewDropPosition.INTO_OR_AFTER , prop]; - } - var par = path.split(':'); - last = path; - par.pop(); - path = par.join(':'); - } - - return []; + this.activePath= false; + var iter = new Gtk.TreeIter(); + this.el.get_iter_from_string(iter, path); + this.el.remove(iter); + // rebuild treemap. -- depreciated.!! + this.map = {}; + this.treemap = { }; + //this.toJS(null, true) // does not do anything? + this.activePath= false; + this.changed(false,true); + this.get('/LeftTree.view').blockChanges = false; }, dropNode : function(target_data, node) { print("drop Node"); @@ -1071,53 +943,92 @@ Window=new XObject({ }, - moveNode : function(target_data, action) { - //print("MOVE NODE"); - // console.dump(target_data); - var old_iter = new Gtk.TreeIter(); - var s = this.get('/LeftTree.view').selection; - s.get_selected(this.el, old_iter); - var node = this.nodeToJS(old_iter,false); - //console.dump(node); - - - // needs to drop first, otherwise the target_data - // treepath will be invalid. - - this.dropNode(target_data, node); - if (action & Gdk.DragAction.MOVE) { - // print("REMOVING OLD NODE"); - this.el.remove(old_iter); - + findDropNode : function(treepath_str, targets) { + + // this is used by the dragdrop code in the roo version AFAIR.. + + var path = treepath_str.replace(/^builder-/, ''); + // treemap is depreciated... - should really check if model has any entries.. + + if (!this.el.iter_n_children(null)) { + print("NO KEYS"); + return [ '', Gtk.TreeViewDropPosition.INTO_OR_AFTER]; } + print("FIND treepath: " + path); + //console.dump(this.treemap); - this.activePath= false; - this.changed(false,true); + if (!treepath_str.match(/^builder-/)) { + return []; // nothing! + } + if (targets === true) { + return [ path ]; + } + return this.findDropNodeByPath(path,targets) }, - deleteSelected : function() { - this.get('/LeftTree.view').blockChanges = true; - var old_iter = new Gtk.TreeIter(); - var s = this.get('/LeftTree.view').selection; - s.get_selected(this.el, old_iter); - var path = this.el.get_path(old_iter).to_string(); - - this.activePath= false; - s.unselect_all(); - - this.activePath= false; - var iter = new Gtk.TreeIter(); - this.el.get_iter_from_string(iter, path); - this.el.remove(iter); + findDropNodeByPath : function(treepath_str, targets, pref) { + var path = treepath_str + ''; // dupe it.. + pref = typeof(pref) == 'undefined' ? Gtk.TreeViewDropPosition.INTO_OR_AFTER : pref; + var last = false; + //console.dump(this.treemap); + while (path.length) { + print("LOOKING FOR PATH: " + path); + var node_data = this.singleNodeToJS(path); + if (node_data === false) { + print("node not found"); + return []; + } + + var xname = this.get('/LeftTree.model').file.guessName(node_data); + var match = false; + var prop = ''; + targets.forEach(function(tg) { + if (match) { + return;; + } + if ((tg == xname) ) { + match = tg; + } + if (tg.indexOf(xname +':') === 0) { + match = tg; + prop = tg.split(':').pop(); + } + }); + + if (match) { + if (last) { // pref is after/before.. + // then it's after last + if (pref > 1) { + return []; // do not allow.. + } + return [ last, pref , prop]; + + } + return [ path , Gtk.TreeViewDropPosition.INTO_OR_AFTER , prop]; + } + var par = path.split(':'); + last = path; + par.pop(); + path = par.join(':'); + } + + return []; - // rebuild treemap. -- depreciated.!! - this.map = {}; - this.treemap = { }; - //this.toJS(null, true) // does not do anything? - this.activePath= false; - this.changed(false,true); - this.get('/LeftTree.view').blockChanges = false; }, - currentTree : false, + getIterValue : function (iter, col) { + var gval = new GObject.Value(''); + this.el.get_value(iter, col ,gval); + return gval.value; + + + }, + init : function() { + XObject.prototype.init.call(this); + this.el.set_column_types ( 3, [ + GObject.TYPE_STRING, // title + GObject.TYPE_STRING, // tip + GObject.TYPE_STRING // source.. + ] ); + }, listAllTypes : function() { var s = this.get('/LeftTree.view').selection; print ("LIST ALL TYPES: " + s.count_selected_rows() ); @@ -1163,32 +1074,207 @@ Window=new XObject({ } - addall([this.currentTree]); + addall([this.currentTree]); + + // only if we have nothing, should we add '*top' + if (!ret.length) { + ret = [ '*top' ]; + } + //console.log('all types in tree'); + //console.dump(ret); + + return ret; + + }, + load : function(tr,iter) + { + var citer = new Gtk.TreeIter(); + //this.insert(citer,iter,0); + for(var i =0 ; i < tr.length; i++) { + if (iter) { + this.el.insert(citer,iter,-1); + } else { + this.el.append(citer); + } + + this.el.set_value(citer, 0, [GObject.TYPE_STRING, this.nodeTitle(tr[i]) ]); + this.el.set_value(citer, 1, [GObject.TYPE_STRING, this.nodeTip(tr[i]) ]); + this.el.set_value(citer, 2, [GObject.TYPE_STRING, this.nodeToJSON(tr[i])]); + if (tr[i].items && tr[i].items.length) { + this.load(tr[i].items, citer); + } + } + }, + loadFile : function(f) { + //console.dump(f); + this.el.clear(); + this.file = f; + + if (!f) { + console.log('missing file'); + return; + } + + // load the file if not loaded.. + if (f.items === false) { + var _this = this; + f.loadItems(function() { + _this.loadFile(f); + }); + return; + + } + this.get('/Window').setTitle(f.project.getName() + ' - ' + f.name); + + if (f.items.length && typeof(f.items[0]) == 'string') { + + this.get('/RightEditor').el.show(); + this.get('/RightEditor.view').load( f.items[0]); + return; + } + print("LOAD"); + //console.dump(f.items); + this.load(f.items); + this.get('/LeftTree.view').el.expand_all(); + + if (!f.items.length) { + // single item.. + + this.get('/Window.leftvpaned').el.set_position(80); + // select first... + this.get('/LeftTree.view').el.set_cursor( + new Gtk.TreePath.from_string('0'), null, false); + + + } else { + this.get('/Window.leftvpaned').el.set_position(200); + } + + + //print("hide right editior"); + this.get('/RightEditor').el.hide(); + //print("set current tree"); + this.currentTree = this.toJS(false, false)[0]; + //console.dump(this.currentTree); + this.currentTree = this.currentTree || { items: [] }; + this.get('/LeftTree').renderView(); + //console.dump(this.map); + //var RightPalete = imports.Builder.RightPalete.RightPalete; + var pm = this.get('/RightPalete.model'); + // set up provider.. + + this.get('/RightPalete').provider = this.get('/LeftTree').getPaleteProvider(); + + if (!this.get('/RightPalete').provider) { + print ("********* PALETE PROVIDER MISSING?!!"); + } + this.get('/LeftTree').renderView(); + + pm.load( this.get('/LeftTree').getPaleteProvider().gatherList(this.listAllTypes())); + + + + this.get('/Window.view-notebook').el.set_current_page( + this.get('/LeftTree.model').file.getType()== 'Roo' ? 0 : -1); + + }, + moveNode : function(target_data, action) { + //print("MOVE NODE"); + // console.dump(target_data); + var old_iter = new Gtk.TreeIter(); + var s = this.get('/LeftTree.view').selection; + s.get_selected(this.el, old_iter); + var node = this.nodeToJS(old_iter,false); + //console.dump(node); + + + // needs to drop first, otherwise the target_data + // treepath will be invalid. + + this.dropNode(target_data, node); + if (action & Gdk.DragAction.MOVE) { + // print("REMOVING OLD NODE"); + this.el.remove(old_iter); + + } + + this.activePath= false; + this.changed(false,true); + }, + nodeTip : function(c) { + var ret = this.nodeTitle(c,true); + var funcs = ''; + + + for( var i in c) { + + if (!i.length || i[0] != '|') { + continue; + } + if (i == '|init') { + continue; + } + if (typeof(c[i]) != 'string') { + continue; + } + //print("prop : " + i + ':' + c[i]); + if (!c[i].match(new RegExp('function'))) { + continue; + } + funcs += "\n" + i.substring(1) + ' : ' + c[i].split(/\n/).shift(); + + } + if (funcs.length) { + ret+="\n\nMethods:" + funcs; + } + return ret; + + }, + nodeTitle : function(c, renderfull) { + var txt = []; + c = c || {}; + var sr = (typeof(c['+buildershow']) != 'undefined') && !c['+buildershow'] ? true : false; + if (sr) txt.push(''); + if (typeof(c['*prop']) != 'undefined') { txt.push(c['*prop']+ ':'); } - // only if we have nothing, should we add '*top' - if (!ret.length) { - ret = [ '*top' ]; + if (renderfull && c['|xns']) { + txt.push(c['|xns']); } - //console.log('all types in tree'); - //console.dump(ret); - return ret; - + if (c.xtype) { txt.push(c.xtype); } + if (c.id) { txt.push('[id=' + c.id + ']'); } + if (c.fieldLabel) { txt.push('[' + c.fieldLabel + ']'); } + if (c.boxLabel) { txt.push('[' + c.boxLabel + ']'); } + + + if (c.layout) { txt.push('' + c.layout + ''); } + if (c.title) { txt.push('' + c.title + ''); } + if (c.label) { txt.push('' + c.label+ ''); } + if (c.header) { txt.push('' + c.header + ''); } + if (c.legend) { txt.push('' + c.legend + ''); } + if (c.text) { txt.push('' + c.text + ''); } + if (c.name) { txt.push('' + c.name+ ''); } + if (c.region) { txt.push('(' + c.region + ')'); } + if (c.dataIndex) { txt.push('[' + c.dataIndex+ ']'); } + + // for flat classes... + if (typeof(c['*class']) != 'undefined') { txt.push('' + c['*class']+ ''); } + if (typeof(c['*extends']) != 'undefined') { txt.push(': ' + c['*extends']+ ''); } + + + if (sr) txt.push(''); + return (txt.length == 0 ? "Element" : txt.join(" ")); }, - singleNodeToJS : function (treepath) - { - var iter = new Gtk.TreeIter(); - if (!this.el.get_iter(iter, new Gtk.TreePath.from_string(treepath))) { - return false; - } - - var iv = this.getIterValue(iter, 2); - - return JSON.parse(iv); - - }, - nodeToJS : function (iter, with_id) + nodeToJS : function (treepath, with_id) { + + var iter = treepath; // API used to be iter here.. + if (typeof(iter) == 'string') { + iter = new Gtk.TreeIter(); + if (!this.el.get_iter(iter, new Gtk.TreePath.from_string(treepath))) { + return false; + } + } var par = new Gtk.TreeIter(); var iv = this.getIterValue(iter, 2); // print("IV" + iv); @@ -1216,10 +1302,38 @@ Window=new XObject({ } return k; }, - toJS : function(iter, with_id) + nodeToJSON : function(c) { + var o = {} + for (var i in c) { + if (i == 'items') { + continue; + } + o[i] = c[i]; + } + return JSON.stringify(o); + }, + singleNodeToJS : function (treepath) + { + var iter = new Gtk.TreeIter(); + if (!this.el.get_iter(iter, new Gtk.TreePath.from_string(treepath))) { + return false; + } + + var iv = this.getIterValue(iter, 2); + + return JSON.parse(iv); + + }, + toJS : function(treepath, with_id) { //Seed.print("WITHID: "+ with_id); - + var iter = treepath; // API used to be iter here.. + if (typeof(iter) == 'string') { + iter = new Gtk.TreeIter(); + if (!this.el.get_iter(iter, new Gtk.TreePath.from_string(treepath))) { + return false; + } + } var first = false; if (!iter) { @@ -1249,106 +1363,6 @@ Window=new XObject({ // convert the list into a json string.. - }, - getIterValue : function (iter, col) { - var gval = new GObject.Value(''); - this.el.get_value(iter, col ,gval); - return gval.value; - - - }, - nodeTitle : function(c, renderfull) { - var txt = []; - c = c || {}; - var sr = (typeof(c['+buildershow']) != 'undefined') && !c['+buildershow'] ? true : false; - if (sr) txt.push(''); - if (typeof(c['*prop']) != 'undefined') { txt.push(c['*prop']+ ':'); } - - if (renderfull && c['|xns']) { - txt.push(c['|xns']); - } - - if (c.xtype) { txt.push(c.xtype); } - if (c.id) { txt.push('[id=' + c.id + ']'); } - if (c.fieldLabel) { txt.push('[' + c.fieldLabel + ']'); } - if (c.boxLabel) { txt.push('[' + c.boxLabel + ']'); } - - - if (c.layout) { txt.push('' + c.layout + ''); } - if (c.title) { txt.push('' + c.title + ''); } - if (c.label) { txt.push('' + c.label+ ''); } - if (c.header) { txt.push('' + c.header + ''); } - if (c.legend) { txt.push('' + c.legend + ''); } - if (c.text) { txt.push('' + c.text + ''); } - if (c.name) { txt.push('' + c.name+ ''); } - if (c.region) { txt.push('(' + c.region + ')'); } - if (c.dataIndex) { txt.push('[' + c.dataIndex+ ']'); } - - // for flat classes... - if (typeof(c['*class']) != 'undefined') { txt.push('' + c['*class']+ ''); } - if (typeof(c['*extends']) != 'undefined') { txt.push(': ' + c['*extends']+ ''); } - - - if (sr) txt.push(''); - return (txt.length == 0 ? "Element" : txt.join(" ")); - }, - nodeToJSON : function(c) { - var o = {} - for (var i in c) { - if (i == 'items') { - continue; - } - o[i] = c[i]; - } - return JSON.stringify(o); - }, - load : function(tr,iter) - { - var citer = new Gtk.TreeIter(); - //this.insert(citer,iter,0); - for(var i =0 ; i < tr.length; i++) { - if (iter) { - this.el.insert(citer,iter,-1); - } else { - this.el.append(citer); - } - - this.el.set_value(citer, 0, [GObject.TYPE_STRING, this.nodeTitle(tr[i]) ]); - this.el.set_value(citer, 1, [GObject.TYPE_STRING, this.nodeTip(tr[i]) ]); - this.el.set_value(citer, 2, [GObject.TYPE_STRING, this.nodeToJSON(tr[i])]); - if (tr[i].items && tr[i].items.length) { - this.load(tr[i].items, citer); - } - } - }, - nodeTip : function(c) { - var ret = this.nodeTitle(c,true); - var funcs = ''; - - - for( var i in c) { - - if (!i.length || i[0] != '|') { - continue; - } - if (i == '|init') { - continue; - } - if (typeof(c[i]) != 'string') { - continue; - } - //print("prop : " + i + ':' + c[i]); - if (!c[i].match(new RegExp('function'))) { - continue; - } - funcs += "\n" + i.substring(1) + ' : ' + c[i].split(/\n/).shift(); - - } - if (funcs.length) { - ret+="\n\nMethods:" + funcs; - } - return ret; - } }, { @@ -1382,6 +1396,23 @@ Window=new XObject({ this.get('/LeftTree.model').deleteSelected(); } } + }, + { + xtype: Gtk.MenuItem, + listeners : { + activate : function (self) { + + var tree = this.get('/LeftTree'); + var model = this.get('/LeftTree.model'); + var el = tree.getActivePath(); + print(el); + var js = model.toJS(el, false); + print(JSON.stringify(js[0], null,4)); + + } + }, + label : "Save as Template", + pack : "add" } ] } @@ -2697,100 +2728,6 @@ Window=new XObject({ }, items : [ - { - xtype: Gtk.HBox, - pack : "pack_start,false,true,0", - items : [ - { - xtype: Gtk.Button, - pack : "pack_start,false,false,0", - label : "Redraw", - listeners : { - button_press_event : function (self, event) { - var js = this.get('/LeftTree.model').toJS(); - if (js && js[0]) { - this.get('/RightBrowser.view').renderJS(js[0]); - } - return false; - } - } - }, - { - xtype: Gtk.Button, - listeners : { - button_press_event : function (self, event) { - this.get('/RooProjectProperties').show(); - return false; - } - }, - label : "Set extra HTML in renderer", - pack : "pack_start,false,false,0" - }, - { - xtype: Gtk.Button, - listeners : { - button_press_event : function (self, event) - { - /* Firefox testing for debugging.. - - we can create a /tmp directory, and put. - builder.html, builder.html.js, link roojs1 - add at the end of builder.html Roo.onload(function() { - */ - if (!this.get('/Window.LeftTree').getActiveFile()) { - return; - } - - var js = this.get('/LeftTree.model').toJS(); - if (!js || !js[0]) { - return; - } - var project = this.get('/Window.LeftTree').getActiveFile().project; - //print (project.fn); - - project.runhtml = project.runhtml || ''; - - - var File = imports.File.File; - - var target = "/tmp/firetest"; // fixme.. - if (!File.isDirectory(target)) { - File.mkdir(target); - } - File.copy(__script_path__ + '/../builder.html.js', target+ '/builder.html.js', Gio.FileCopyFlags.OVERWRITE); - if (!File.exists( target+ '/roojs1')) { - File.link( target+ '/roojs1', __script_path__ + '/../roojs1'); - } - - - - var html = imports.File.File.read(__script_path__ + '/../builder.html'); - html = html.replace('', project.runhtml + ''); - - - var jsstr = JSON.stringify(js[0]); - - var runbuilder = ''; - - html = html.replace('', runbuilder + ''); - - File.write( target+ '/builder.html', html); - - this.get('/Terminal').feed("RUN DIR:" + target); - - this.get('/Terminal').el.fork_command( null , [], [], target - , false,false,false); - var cmd = "firefox file://" + target + "/builder.html \n"; - this.get('/Terminal').el.feed_child(cmd, cmd.length); - return false; - } - }, - label : "Test in Firefox", - pack : "pack_start,false,false,0" - } - ] - }, { xtype: Gtk.ScrolledWindow, pack : "add", @@ -3050,9 +2987,7 @@ Window=new XObject({ renderJS : function(data, withDebug) { this.highlightWidget = false; - if (!data) { - return; - } + this.withDebug = false; if (this.renderedEl) { @@ -3060,7 +2995,9 @@ Window=new XObject({ this.renderedEl.destroy(); this.renderedEl = false; } - + if (!data) { + return; + } var tree = this.get('/LeftTree.model').toJS(false,true)[0]; // in theory tree is actually window.. try { -- 2.39.2