FixBug.bjs
authorAlan Knowles <alan@akbkhome.com>
Sun, 16 Dec 2012 08:48:35 +0000 (16:48 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sun, 16 Dec 2012 08:48:35 +0000 (16:48 +0800)
FixBug.js

FixBug.bjs
FixBug.js

index fc419a7..9e792b1 100644 (file)
                                                     ]
                                                 }
                                             ]
+                                        },
+                                        {
+                                            "pack": "add",
+                                            "width_request": 400,
+                                            "xtype": "VBox",
+                                            "|xns": "Gtk",
+                                            "items": [
+                                                {
+                                                    "pack": "pack_start,false,true,3",
+                                                    "xtype": "HBox",
+                                                    "|xns": "Gtk",
+                                                    "items": [
+                                                        {
+                                                            "listeners": {
+                                                                "clicked": "function (self) {\n \n}"
+                                                            },
+                                                            "label": "Next/Back",
+                                                            "pack": "pack_end,false,true,3",
+                                                            "xtype": "Button",
+                                                            "|use_stock": "true",
+                                                            "|xns": "Gtk"
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    "pack": "pack_end,true,true,3",
+                                                    "xtype": "ScrolledWindow",
+                                                    "|shadow_type": "Gtk.ShadowType.IN",
+                                                    "|xns": "Gtk",
+                                                    "items": [
+                                                        {
+                                                            "|fixed_height_mode": "true",
+                                                            "id": "ticket-view",
+                                                            "pack": "add",
+                                                            "xtype": "TreeView",
+                                                            "|can_focus": "true",
+                                                            "|headers_visible": "false",
+                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    var description = new Pango.FontDescription.c_new();\n    description.set_size(10000);\n    this.el.modify_font(description);\n\n    this.selection = this.el.get_selection();\n    this.selection.set_mode( Gtk.SelectionMode.SINGLE);\n    var _t = this;\n\n    // is this really needed??\n    this.selection.signal['changed'].connect(function() {\n        print('selection changed');\n    \n\n    });\n\n}\n",
+                                                            "|xns": "Gtk",
+                                                            "items": [
+                                                                {
+                                                                    "id": "ticket-store",
+                                                                    "pack": "set_model",
+                                                                    "xtype": "ListStore",
+                                                                    "|columns": "  [\n        GObject.TYPE_STRING, // title \n        GObject.TYPE_STRING, // tip\n        GObject.TYPE_STRING // source..\n] ",
+                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n\n    this.el.set_column_types ( 2, [\n        GObject.TYPE_STRING,  // real key\n        GObject.TYPE_STRING // real type\n        \n        \n    ] );\n\n\n    \n    // var t = this;\n    //imports.Projects.Projects.fetch(  function(res) { \n    //    t.loadData(res);\n   // });\n        \n                                \n}\n",
+                                                                    "|loadData": "function (data) {\n        print(\"loading data\");\n                                    \n    var el = this.el;\n    this.el.clear();\n    data.forEach(function(p) {\n        var ret = {};\n        el.append(ret);\n       //print(\"ADD \" + p.name);\n         \n        el.set_value(ret.iter, 0, p.id);\n        el.set_value(ret.iter, 1,   '<b>#' + p.id + '</b>' + \n            '[' + p.status_name + '] <b>'   + p.summary  + \"</b>\\n\"  +\n             '<span color=\"#666\">' + p.description.split(\"\\n\").slice(0,3).join(\"\\n\") +\n             '</span>'\n             \n              );\n        \n    });\n              \n                                     \n}\n",
+                                                                    "|reload": "function() {\n \n    var active_id = this.get('/project-select').el.get_active();\n     \n    var project_id = this.get('/project-select').raw_data[active_id].id;\n    \n    var _t = this;\n    \n    imports.Tasks.Tasks.query({\n        project_id : project_id,\n        'query[filter]' : 'me'\n    }, function(res) { \n        print(JSON.stringify(res,null,4));\n        _t.loadData(res);\n    });\n     \n    \n}\n",
+                                                                    "|xns": "Gtk"
+                                                                },
+                                                                {
+                                                                    "pack": "append_column",
+                                                                    "xtype": "TreeViewColumn",
+                                                                    "|sizing": "Gtk.TreeViewColumnSizing.FIXED",
+                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 1 );\n}\n",
+                                                                    "|xns": "Gtk",
+                                                                    "items": [
+                                                                        {
+                                                                            "pack": "pack_start",
+                                                                            "xtype": "CellRendererText",
+                                                                            "|xns": "Gtk"
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
                                         }
                                     ]
                                 }
index c9b5580..41e90ea 100644 (file)
--- a/FixBug.js
+++ b/FixBug.js
@@ -589,6 +589,149 @@ FixBug=new XObject({
                                             ]
                                         }
                                     ]
+                                },
+                                {
+                                    xtype: Gtk.VBox,
+                                    pack : "add",
+                                    width_request : 400,
+                                    items : [
+                                        {
+                                            xtype: Gtk.HBox,
+                                            pack : "pack_start,false,true,3",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.Button,
+                                                    listeners : {
+                                                        clicked : function (self) {
+                                                         
+                                                        }
+                                                    },
+                                                    label : "Next/Back",
+                                                    pack : "pack_end,false,true,3",
+                                                    use_stock : true
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.ScrolledWindow,
+                                            pack : "pack_end,true,true,3",
+                                            shadow_type : Gtk.ShadowType.IN,
+                                            items : [
+                                                {
+                                                    xtype: Gtk.TreeView,
+                                                    fixed_height_mode : true,
+                                                    id : "ticket-view",
+                                                    pack : "add",
+                                                    can_focus : true,
+                                                    headers_visible : false,
+                                                    init : function() {
+                                                        XObject.prototype.init.call(this);
+                                                        var description = new Pango.FontDescription.c_new();
+                                                        description.set_size(10000);
+                                                        this.el.modify_font(description);
+                                                    
+                                                        this.selection = this.el.get_selection();
+                                                        this.selection.set_mode( Gtk.SelectionMode.SINGLE);
+                                                        var _t = this;
+                                                    
+                                                        // is this really needed??
+                                                        this.selection.signal['changed'].connect(function() {
+                                                            print('selection changed');
+                                                        
+                                                    
+                                                        });
+                                                    
+                                                    },
+                                                    items : [
+                                                        {
+                                                            xtype: Gtk.ListStore,
+                                                            id : "ticket-store",
+                                                            pack : "set_model",
+                                                            columns : [
+                                                                    GObject.TYPE_STRING, // title 
+                                                                    GObject.TYPE_STRING, // tip
+                                                                    GObject.TYPE_STRING // source..
+                                                            ],
+                                                            init : function() {
+                                                                XObject.prototype.init.call(this);
+                                                            
+                                                                this.el.set_column_types ( 2, [
+                                                                    GObject.TYPE_STRING,  // real key
+                                                                    GObject.TYPE_STRING // real type
+                                                                    
+                                                                    
+                                                                ] );
+                                                            
+                                                            
+                                                                
+                                                                // var t = this;
+                                                                //imports.Projects.Projects.fetch(  function(res) { 
+                                                                //    t.loadData(res);
+                                                               // });
+                                                                    
+                                                                                            
+                                                            },
+                                                            loadData : function (data) {
+                                                                    print("loading data");
+                                                                                                
+                                                                var el = this.el;
+                                                                this.el.clear();
+                                                                data.forEach(function(p) {
+                                                                    var ret = {};
+                                                                    el.append(ret);
+                                                                   //print("ADD " + p.name);
+                                                                     
+                                                                    el.set_value(ret.iter, 0, p.id);
+                                                                    el.set_value(ret.iter, 1,   '<b>#' + p.id + '</b>' + 
+                                                                        '[' + p.status_name + '] <b>'   + p.summary  + "</b>\n"  +
+                                                                         '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
+                                                                         '</span>'
+                                                                         
+                                                                          );
+                                                                    
+                                                                });
+                                                                          
+                                                                                                 
+                                                            },
+                                                            reload : function() {
+                                                             
+                                                                var active_id = this.get('/project-select').el.get_active();
+                                                                 
+                                                                var project_id = this.get('/project-select').raw_data[active_id].id;
+                                                                
+                                                                var _t = this;
+                                                                
+                                                                imports.Tasks.Tasks.query({
+                                                                    project_id : project_id,
+                                                                    'query[filter]' : 'me'
+                                                                }, function(res) { 
+                                                                    print(JSON.stringify(res,null,4));
+                                                                    _t.loadData(res);
+                                                                });
+                                                                 
+                                                                
+                                                            }
+                                                        },
+                                                        {
+                                                            xtype: Gtk.TreeViewColumn,
+                                                            pack : "append_column",
+                                                            sizing : Gtk.TreeViewColumnSizing.FIXED,
+                                                            init : function() {
+                                                                XObject.prototype.init.call(this);
+                                                                this.el.add_attribute(this.items[0].el , 'markup', 1 );
+                                                            },
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.CellRendererText,
+                                                                    pack : "pack_start"
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
                                 }
                             ]
                         }