Final User interface tweaks to basic commit code (shows dialogs while it does stuff)
[gitlive] / FixBug.bjs
1 {
2     "id": "file-gtk-1",
3     "name": "FixBug",
4     "parent": "",
5     "title": false,
6     "path": "/home/alan/gitlive/gitlive/FixBug.bjs",
7     "items": [
8         {
9             "listeners": {
10                 "destroy_event": "function (self, event) {\n     this.el.hide();\n                return false;\n}",
11                 "response": "function (self, id) {\n  // hide\n     if (id < 1) {\n        this.el.hide();\n        return;\n    }\n    if (typeof(this.get('bug').getValue()) != 'object') {\n        print(\"ERROR\");\n        return;\n    }\n \n    this.el.hide();\n        \n    //var val = this.get('bug').getValue();\n     //   Seed.print(val);\n}"
12             },
13             "border_width": 3,
14             "default_height": 400,
15             "default_width": 600,
16             "title": "Select Active Bug",
17             "xtype": "Dialog",
18             "|deletable": true,
19             "|modal": true,
20             "|show": "function(c) {\n    \n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    /*[ 'xtype'  ].forEach(function(k) {\n        _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);\n    });\n\t// shouild set path..\n    */\n\n    \n    this.el.show_all();\n    this.get('/ok_button').el.set_sensitive(false);\n    \n    // block until we return.\n    var run_ret = this.el.run();\n    if (run_ret < 1 ) {\n        return false;\n    }\n    print(\"RUN RETURN : \" + run_ret);\n    \n    //print(JSON.stringify(this.get('bug').getValue()));\n    return this.get('bug').getValue();\n    //this.success = c.success;\n}\n",
21             "|xns": "Gtk",
22             "items": [
23                 {
24                     "|xns": "Gtk",
25                     "xtype": "VBox",
26                     "|pack": " function(p,e) {\n            p.el.get_content_area().add(e.el)\n        }\n",
27                     "items": [
28                         {
29                             "|xns": "Gtk",
30                             "xtype": "HBox",
31                             "pack": "pack_start,false,true,3",
32                             "items": [
33                                 {
34                                     "label": "Select Active Bug:",
35                                     "pack": "pack_start,false,true,3",
36                                     "xtype": "Label",
37                                     "|xns": "Gtk"
38                                 },
39                                 {
40                                     "listeners": {
41                                         "changed": "function (self) {\n    var d = this.getValue();\n    this.get('/view').load(d.description);\n      this.get('/ok_button').el.set_sensitive(true);\n}"
42                                     },
43                                     "id": "bug",
44                                     "pack": "pack_end,true,true,3",
45                                     "xtype": "ComboBox",
46                                     "|getValue": "function() {\n     var ix = this.el.get_active();\n    if (ix < 0 ) {\n        return '';\n    }\n    return this.get('model').data[ix];\n}\n",
47                                     "|init": "function() {\n    XObject.prototype.init.call(this);\n  this.el.add_attribute(this.items[0].el , 'markup', 1 );  \n}\n",
48                                     "|setValue": "function(v)\n                {\n                    var el = this.el;\n                    el.set_active(-1);\n                    this.get('model').data.forEach(function(n, ix) {\n                        if (v == n.xtype) {\n                            el.set_active(ix);\n                            return false;\n                        }\n                    });\n                }",
49                                     "|xns": "Gtk",
50                                     "items": [
51                                         {
52                                             "|xns": "Gtk",
53                                             "xtype": "CellRendererText",
54                                             "pack": "pack_start"
55                                         },
56                                         {
57                                             "id": "model",
58                                             "pack": "set_model",
59                                             "xtype": "ListStore",
60                                             "|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        var Tickets = imports.Tickets.Tickets;\n        \n        this.data = Tickets.fetchBugs(\"http://www.roojs.com/mtrack/index.php/Gitlive/web.hex\");\n/*        this.data = [\n            { xtype: 'Roo', desc : \"Roo Project\" },\n            { xtype: 'Gtk', desc : \"Gtk Project\" },    \n            //{ xtype: 'JS', desc : \"Javascript Class\" }\n        ]\n  */      \n        this.loadData(this.data);\n                                \n}\n",
61                                             "|loadData": "function (data) {\n                                            \n            var iter = new Gtk.TreeIter();\n            var el = this.el;\n            data.forEach(function(p) {\n                \n                el.append(iter);\n                \n                 \n                el.set_value(iter, 0, p.id);\n                el.set_value(iter, 1, '#' + p.id + ' - ' + p.summary );\n                \n            });\n              \n                                     \n}\n",
62                                             "|xns": "Gtk"
63                                         }
64                                     ]
65                                 }
66                             ]
67                         },
68                         {
69                             "|xns": "Gtk",
70                             "xtype": "ScrolledWindow",
71                             "pack": "add",
72                             "id": "RightEditor",
73                             "items": [
74                                 {
75                                     "editable": false,
76                                     "id": "view",
77                                     "indent_width": 4,
78                                     "pack": "add",
79                                     "xtype": "TextView",
80                                     "|auto_indent": true,
81                                     "|init": "function() {\n    XObject.prototype.init.call(this);\n     var description = Pango.Font.description_from_string(\"monospace\")\n    description.set_size(8000);\n    this.el.modify_font(description);\n\n}\n",
82                                     "|load": "function(str) {\n\n// show the help page for the active node..\n \n\n\n \n    this.el.get_buffer().set_text(str, str.length);\n \n    \n     var buf = this.el.get_buffer();\n     \n     \n    \n}",
83                                     "|show_line_numbers": true,
84                                     "|xns": "Gtk",
85                                     "items": [
86                                         {
87                                             "listeners": {
88                                                 "changed": "function (self) {\n    /*\n    var s = new Gtk.TextIter();\n    var e = new Gtk.TextIter();\n    this.el.get_start_iter(s);\n    this.el.get_end_iter(e);\n    var str = this.el.get_text(s,e,true);\n    try {\n        Seed.check_syntax('var e = ' + str);\n    } catch (e) {\n        this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n            red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC\n           }));\n        //print(\"SYNTAX ERROR IN EDITOR\");   \n        //print(e);\n        //console.dump(e);\n        return;\n    }\n    this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n            red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF\n           }));\n    \n     this.get('/LeftPanel.model').changed(  str , false);\n     */\n}"
89                                             },
90                                             "pack": "set_buffer",
91                                             "xtype": "Buffer",
92                                             "|xns": "GtkSource"
93                                         }
94                                     ]
95                                 }
96                             ]
97                         }
98                     ]
99                 },
100                 {
101                     "label": "Cancel",
102                     "pack": "add_action_widget,0",
103                     "xtype": "Button",
104                     "|xns": "Gtk",
105                     "listeners": {}
106                 },
107                 {
108                     "id": "ok_button",
109                     "label": "OK",
110                     "pack": "add_action_widget,1",
111                     "xtype": "Button",
112                     "|xns": "Gtk"
113                 }
114             ]
115         }
116     ],
117     "permname": "",
118     "modOrder": ""
119 }