sync
[gitlive] / old_seed_version / FixBug.bjs
diff --git a/old_seed_version/FixBug.bjs b/old_seed_version/FixBug.bjs
new file mode 100644 (file)
index 0000000..f9c4e3b
--- /dev/null
@@ -0,0 +1,335 @@
+{
+    "id": "file-gtk-4",
+    "name": "FixBug",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/gitlive/FixBug.bjs",
+    "items": [
+        {
+            "listeners": {
+                "destroy_event": "function (self, event) {\n     this.el.hide();\n                return false;\n}",
+                "show": "function (self) {\nprint(\"ON SHOW!\");\n\n    this.el.fullscreen();\n    this.el.grab_focus();\n    this.el.set_keep_above(true);\n    \n    this.get('/today-vew').load();\n    \n}"
+            },
+            "border_width": 3,
+            "default_height": 400,
+            "default_width": 1200,
+            "title": "Select Active Bug",
+            "xtype": "Window",
+            "|deletable": "true",
+            "|modal": "true",
+            "|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",
+            "|xns": "Gtk",
+            "items": [
+                {
+                    "pack": "add",
+                    "xtype": "VBox",
+                    "|xns": "Gtk",
+                    "items": [
+                        {
+                            "pack": "pack_start,false,true,3",
+                            "xtype": "HBox",
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "label": "On this project:",
+                                    "xtype": "Label",
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "listeners": {
+                                        "changed": "function (self) {\n    print(\"store: active id = \" + this.el.get_active_id());\n    this.get('/ticket-store').reload();\n    \n    \n}"
+                                    },
+                                    "id": "project-select",
+                                    "xtype": "ComboBox",
+                                    "|init": "function() {\n     this.el = new Gtk.ComboBox.with_entry();\n                                \n                                \n    this.model  = new XObject(this.model);\n    this.model.init();\n    this.el.set_model(this.model.el);\n    this.el.set_entry_text_column (0);\n    XObject.prototype.init.call(this);\n    \n     var t = this;\n    imports.Projects.Projects.fetch(  function(res) { \n         t.load(res);\n    });\n}\n",
+                                    "|load": "function(tr) {\n      this.model.el.clear();\n      this.raw_data = tr;                     \n         for(var i =0 ; i < tr.length; i++) {\n            var ret = {  };\n            this.model.el.append(ret);\n            //print(JSON.stringify(ret,null,4));\n           \n            this.model.el.set_value(ret.iter, 0, '' + tr[i].code + \" - \" + tr[i].name );\n            this.model.el.set_value(ret.iter, 1, '' + tr[i].id  );\n     \n            \n        }     \n        \n}\n",
+                                    "|xns": "Gtk",
+                                    "items": [
+                                        {
+                                            "*prop": "model",
+                                            "id": "project-store",
+                                            "xtype": "ListStore",
+                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_column_types ( 3, [\n           GObject.TYPE_STRING, // file  \n          GObject.TYPE_STRING, // added\n          GObject.TYPE_STRING, // removed\n      ] );\n}\n",
+                                            "|xns": "Gtk"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "listeners": {
+                                        "button_press_event": "function (self, event) {\n \n    FixBug.el.hide();\n}"
+                                    },
+                                    "height_request": 90,
+                                    "label": "Not working on Project",
+                                    "pack": "add",
+                                    "xtype": "Button",
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "listeners": {
+                                        "button_press_event": "function (self, event) {\n\n   FixBug.el.hide();\n}"
+                                    },
+                                    "id": "ok_button",
+                                    "label": "Working on Selected Ticket",
+                                    "pack": "add",
+                                    "xtype": "Button",
+                                    "|xns": "Gtk"
+                                }
+                            ]
+                        },
+                        {
+                            "pack": "pack_end,true,true,3",
+                            "xtype": "HPaned",
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "pack": "add",
+                                    "width_request": 400,
+                                    "xtype": "VBox",
+                                    "|xns": "Gtk",
+                                    "items": [
+                                        {
+                                            "pack": "pack_start,false,true,3",
+                                            "xtype": "HBox",
+                                            "|xns": "Gtk",
+                                            "items": [
+                                                {
+                                                    "listeners": {
+                                                        "key_release_event": "function (self, event) {\n    if (event.key.keyval == Gdk.KEY_Return) {;\n        // same code as button press..\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 str = this.get('/search-entry').el.get_text();\n        \n        print(str);\n        \n        var _t = this;\n        \n        imports.Tasks.Tasks.query({\n            project_id : project_id,\n            'query[filter]' : 'me',\n            'query[search]' : str\n        }, function(res) { \n           // print(JSON.stringify(res,null,4));\n            _t.get('/ticket-store').loadData(res);\n        });\n    }\n    return true;\n}"
+                                                    },
+                                                    "id": "search-entry",
+                                                    "pack": "pack_start,true,true,3",
+                                                    "xtype": "Entry",
+                                                    "|xns": "Gtk"
+                                                },
+                                                {
+                                                    "listeners": {
+                                                        "clicked": "function (self) {\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 str = this.get('/search-entry').el.get_text();\n    \n    print(str);\n    \n    var _t = this;\n    \n    imports.Tasks.Tasks.query({\n        project_id : project_id,\n        'query[filter]' : 'me',\n        'query[search]' : str\n    }, function(res) { \n       // print(JSON.stringify(res,null,4));\n        _t.get('/ticket-store').loadData(res);\n    });\n}"
+                                                    },
+                                                    "label": "Search",
+                                                    "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": [
+                                                {
+                                                    "listeners": {
+                                                        "cursor_changed": "function (self) {\n    \n    var ret = {};\n    this.selection.get_selected(ret);\n\n    // var val = \"\";\n    var value = ''+ret.model.get_value(ret.iter, 0).value.get_string();\n    \n    print(value);\n    var rec = false;\n    this.get('/ticket-store').data.forEach( function(e) {\n        if (e.id == value) {\n            rec = e;\n            return  false;\n        }\n    });\n    // update the text box with the ticket data..\n    this.get('/view').show(rec);\n    //print(rec);\n\n}"
+                                                    },
+                                                    "id": "ticket-view",
+                                                    "pack": "add",
+                                                    "xtype": "TreeView",
+                                                    "|can_focus": "true",
+                                                    "|fixed_height_mode": "false",
+                                                    "|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    \n    this.data = 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       var line =    '[' + p.status_name + '] <b>'   + \n             GLib.markup_escape_text(p.summary, p.summary.length)  + \"</b>\\n\"  +\n             '<span color=\"#666\">' + \n             GLib.markup_escape_text(p.description,p.description.length).split(\"\\n\").slice(0,3).join(\"\\n\") +\n             '</span>';\n         print(line);\n         \n        el.set_value(ret.iter, 0, p.id);\n        el.set_value(ret.iter, 1,   '<b>#' + p.id + '</b>' +  line );\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",
+                                                            "|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"
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "pack": "add",
+                                    "xtype": "HPaned",
+                                    "|xns": "Gtk",
+                                    "items": [
+                                        {
+                                            "pack": "pack1,true,true",
+                                            "xtype": "VBox",
+                                            "|xns": "Gtk",
+                                            "items": [
+                                                {
+                                                    "pack": "pack_start,false,true,3",
+                                                    "xtype": "HBox",
+                                                    "|xns": "Gtk",
+                                                    "items": [
+                                                        {
+                                                            "label": "I am doing this:",
+                                                            "pack": "pack_start,false,true,3",
+                                                            "xtype": "Label",
+                                                            "|xns": "Gtk"
+                                                        },
+                                                        {
+                                                            "pack": "pack_start,true,true,3",
+                                                            "xtype": "Entry",
+                                                            "|xns": "Gtk"
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    "pack": "pack_start,false,true,3",
+                                                    "xtype": "HBox",
+                                                    "|xns": "Gtk",
+                                                    "items": [
+                                                        {
+                                                            "label": "Since:",
+                                                            "pack": "pack_start,false,true,3",
+                                                            "xtype": "Label",
+                                                            "|xns": "Gtk"
+                                                        },
+                                                        {
+                                                            "pack": "pack_start,false,false,3",
+                                                            "xtype": "Entry",
+                                                            "|width_request": 80,
+                                                            "|xns": "Gtk"
+                                                        },
+                                                        {
+                                                            "label": "Until",
+                                                            "pack": "pack_start,false,true,3",
+                                                            "xtype": "Label",
+                                                            "|xns": "Gtk"
+                                                        },
+                                                        {
+                                                            "pack": "pack_start,true,true,3",
+                                                            "xtype": "Entry",
+                                                            "|xns": "Gtk"
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "ScrolledWindow",
+                                                    "pack": "add",
+                                                    "id": "RightEditor",
+                                                    "items": [
+                                                        {
+                                                            "id": "view",
+                                                            "indent_width": 4,
+                                                            "pack": "add",
+                                                            "xtype": "TextView",
+                                                            "|auto_indent": true,
+                                                            "|editable": "false",
+                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    var description = Pango.font_description_from_string(\"monospace\");\n\n    description.set_size(8000);\n    this.el.modify_font(description);\n\n}\n",
+                                                            "|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}",
+                                                            "|show": "function(p) {\n     var line =  [\n            'Status : ' +   p.status_name,\n            'ID : ' +   p.id,\n            '',\n            'Summary :  ' +  p.summary,\n             '' + \n             p.description,\n         ].join(\"\\n\")   ;\n         print(line);\n         \n         \n         // can not do rich text due to so many missing features..\n          this.el.get_buffer().set_text(line, line.length);\n \n}\n",
+                                                            "|show_line_numbers": true,
+                                                            "|xns": "Gtk",
+                                                            "items": [
+                                                                {
+                                                                    "listeners": {
+                                                                        "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}"
+                                                                    },
+                                                                    "pack": "set_buffer",
+                                                                    "xtype": "Buffer",
+                                                                    "|xns": "GtkSource"
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "pack": "pack2,false,false",
+                                            "width_request": 200,
+                                            "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": [
+                                                        {
+                                                            "id": "today-view",
+                                                            "pack": "add",
+                                                            "xtype": "TreeView",
+                                                            "|can_focus": "true",
+                                                            "|fixed_height_mode": "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": "today-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    var DT = imports.Date.Date;\n    \n    new imports.Request.Request( {\n       url : '/cash_invoice_entry',\n       params : {\n            'query[action_dt_from]' : (new DT()).format('Y-m-d'),\n             'query[action_dt_to]' : (new DT()).add(DT.DAY,1).format('Y-m-d'),\n            limit: 999,\n            'sort' : 'action_dt',\n            dir : 'ASC',\n            action : 'Hours'\n       },\n       \n       success : function(res) {\n           this.loadData();\n       },\n       scope : this\n        \n        \n    });\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"
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": ""
+}
\ No newline at end of file