Final User interface tweaks to basic commit code (shows dialogs while it does stuff)
[gitlive] / FixBug.js
index 7f8b82c..6b8357f 100644 (file)
--- a/FixBug.js
+++ b/FixBug.js
@@ -20,25 +20,25 @@ FixBug=new XObject({
         },
         response : function (self, id) {
           // hide
-         if (id < 1) {
+             if (id < 1) {
                 this.el.hide();
                 return;
             }
-            if (!this.get('bug').getValue().length) {
+            if (typeof(this.get('bug').getValue()) != 'object') {
                 print("ERROR");
-                    return;
-                }
+                return;
+            }
          
-                this.el.hide();
+            this.el.hide();
                 
-                var val = this.get('bug').getValue();
-                Seed.print(val);
+            //var val = this.get('bug').getValue();
+             //   Seed.print(val);
         }
     },
     border_width : 3,
-    default_height : 150,
+    default_height : 400,
     default_width : 600,
-    title : "Project Properties",
+    title : "Select Active Bug",
     deletable : true,
     modal : true,
     show : function(c) {
@@ -52,7 +52,20 @@ FixBug=new XObject({
         });
        // shouild set path..
         */
+    
+        
         this.el.show_all();
+        this.get('/ok_button').el.set_sensitive(false);
+        
+        // block until we return.
+        var run_ret = this.el.run();
+        if (run_ret < 1 ) {
+            return false;
+        }
+        print("RUN RETURN : " + run_ret);
+        
+        //print(JSON.stringify(this.get('bug').getValue()));
+        return this.get('bug').getValue();
         //this.success = c.success;
     },
     items : [
@@ -73,14 +86,21 @@ FixBug=new XObject({
                         },
                         {
                             xtype: Gtk.ComboBox,
+                            listeners : {
+                                changed : function (self) {
+                                    var d = this.getValue();
+                                    this.get('/view').load(d.description);
+                                      this.get('/ok_button').el.set_sensitive(true);
+                                }
+                            },
                             id : "bug",
                             pack : "pack_end,true,true,3",
                             getValue : function() {
                                  var ix = this.el.get_active();
-                                        if (ix < 0 ) {
-                                            return '';
-                                        }
-                                        return this.get('model').data[ix].xtype;
+                                if (ix < 0 ) {
+                                    return '';
+                                }
+                                return this.get('model').data[ix];
                             },
                             init : function() {
                                 XObject.prototype.init.call(this);
@@ -137,7 +157,7 @@ FixBug=new XObject({
                                                     
                                                      
                                                     el.set_value(iter, 0, p.id);
-                                                    el.set_value(iter, 1, '#' + p.id + ' - ' + p.summmary );
+                                                    el.set_value(iter, 1, '#' + p.id + ' - ' + p.summary );
                                                     
                                                 });
                                                   
@@ -147,18 +167,90 @@ FixBug=new XObject({
                             ]
                         }
                     ]
+                },
+                {
+                    xtype: Gtk.ScrolledWindow,
+                    pack : "add",
+                    id : "RightEditor",
+                    items : [
+                        {
+                            xtype: Gtk.TextView,
+                            editable : false,
+                            id : "view",
+                            indent_width : 4,
+                            pack : "add",
+                            auto_indent : true,
+                            init : function() {
+                                XObject.prototype.init.call(this);
+                                 var description = Pango.Font.description_from_string("monospace")
+                                description.set_size(8000);
+                                this.el.modify_font(description);
+                            
+                            },
+                            load : function(str) {
+                            
+                            // show the help page for the active node..
+                             
+                            
+                            
+                             
+                                this.el.get_buffer().set_text(str, str.length);
+                             
+                                
+                                 var buf = this.el.get_buffer();
+                                 
+                                 
+                                
+                            },
+                            show_line_numbers : true,
+                            items : [
+                                {
+                                    xtype: GtkSource.Buffer,
+                                    listeners : {
+                                        changed : function (self) {
+                                            /*
+                                            var s = new Gtk.TextIter();
+                                            var e = new Gtk.TextIter();
+                                            this.el.get_start_iter(s);
+                                            this.el.get_end_iter(e);
+                                            var str = this.el.get_text(s,e,true);
+                                            try {
+                                                Seed.check_syntax('var e = ' + str);
+                                            } catch (e) {
+                                                this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+                                                    red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
+                                                   }));
+                                                //print("SYNTAX ERROR IN EDITOR");   
+                                                //print(e);
+                                                //console.dump(e);
+                                                return;
+                                            }
+                                            this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+                                                    red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
+                                                   }));
+                                            
+                                             this.get('/LeftPanel.model').changed(  str , false);
+                                             */
+                                        }
+                                    },
+                                    pack : "set_buffer"
+                                }
+                            ]
+                        }
+                    ]
                 }
             ]
         },
         {
             xtype: Gtk.Button,
-            pack : "add_action_widget,1",
-            label : "OK"
+            label : "Cancel",
+            pack : "add_action_widget,0"
         },
         {
             xtype: Gtk.Button,
-            pack : "add_action_widget,0",
-            label : "Cancel"
+            id : "ok_button",
+            label : "OK",
+            pack : "add_action_widget,1"
         }
     ]
 });