Builder3/Window.js
[app.Builder.js] / Builder3 / Window.js
index 1c376ed..c08c03a 100644 (file)
@@ -1173,7 +1173,7 @@ Window=new XObject({
                                                                                     },
                                                                             loadFile : function(f) {
                                                                                 //console.dump(f);
-                                                                               // print("LOADFILE");
+                                                                                  print("LOADFILE");
                                                                                         this.el.clear();
                                                                                         this.file = f;
                                                                                         
@@ -1622,8 +1622,20 @@ Window=new XObject({
                                                                     items : [
                                                                         {
                                                                             xtype: Gtk.TreeView,
+                                                                           
                                                                             listeners : {
                                                                                 cursor_changed : function (self) {
+                                                                                    
+                                                                                    var model = this.get('/LeftProjectTree.model');
+                                                                                    
+
+                                                                                    
+                                                                                    if (model.loading) {
+                                                                                        
+                                                                                         
+                                                                                        return;
+                                                                                    }
+                                                                                    print("LOADING IS FALSE");
                                                                                     var ret = {};        
                                                                                     if (this.selection.count_selected_rows() < 1) {
                                                                                         //XN.get('Builder.LeftTree.model').
@@ -1631,8 +1643,7 @@ Window=new XObject({
                                                                                         
                                                                                         return;
                                                                                     }
-                                                                                    var model = this.get('/LeftProjectTree.model');
-                                                                                    //console.log('changed');
+                                                                                     //console.log('changed');
                                                                                     var s = this.selection;
                                                                                     s.get_selected(ret);
                                                                                     var value = ''+ ret.model.get_value(ret.iter, 2).value.get_string();
@@ -1675,6 +1686,7 @@ Window=new XObject({
                                                                                     xtype: Gtk.TreeStore,
                                                                                     pack : "set_model",
                                                                                     id : "model",
+                                                                                     loading : false,
                                                                                     init : function() {
                                                                                         XObject.prototype.init.call(this);
                                                                                       this.el.set_column_types ( 3, [
@@ -1686,20 +1698,26 @@ Window=new XObject({
                                                                                     },
                                                                                     loadProject : function(pr) {
                                                                                          print("LOAD PROJECT");
+                                                                                          var model = this.get('/LeftProjectTree.model');
+                                                                                         model.loading = true;
+                                                                                          
                                                                                         this.el.clear();
                                                                                          if (!pr) {
                                                                                              return;
                                                                                          }
-                                                                                         
+                                                                                      
                                                                                          this.get('/LeftProjectTree').project = pr;
+                                                                                       
                                                                                          this.load(pr.toTree());
+                                                                                    
                                                                                          this.get('/LeftProjectTree.view').el.expand_all();
+                                                                                         model.loading = false;
+                                                                                         
                                                                                     },
                                                                                     load : function(tr,iter) {
                                                                                       //  console.dump(tr);
-                                                                                        var view = this.get('/LeftProjectTree.view')
-                                                                                      
-                                                                                        view.loading = true;
+                                                                                        
+                                                                                       
                                                                                         console.log('Project tree load: ' + tr.length);
                                                                                         var cret = {};
                                                                                         //this.insert(citer,iter,0);
@@ -1720,7 +1738,7 @@ Window=new XObject({
                                                                                             }
                                                                                             
                                                                                         });
-                                                                                        view.loading = false;
+                                                                                         
                                                                                     },
                                                                                     getValue : function(iter, col) {
                                                                                         var gval = ''+ this.el.get_value(iter, col).value.get_string();