3 Pango = imports.gi.Pango;
4 GLib = imports.gi.GLib;
6 GObject = imports.gi.GObject;
7 GtkSource = imports.gi.GtkSource;
8 WebKit = imports.gi.WebKit;
10 console = imports.console;
11 XObject = imports.XObject.XObject;
15 destroy_event : function (self, event) {
19 show : function (self) {
24 this.el.set_keep_above(true);
26 this.get('/today-vew').load();
33 title : "Select Active Bug",
42 /*[ 'xtype' ].forEach(function(k) {
43 _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
50 // this.get('/ok_button').el.set_sensitive(false);
52 // block until we return.
53 // var run_ret = this.el.run();
54 // if (run_ret < 1 ) {
57 // print("RUN RETURN : " + run_ret);
59 //print(JSON.stringify(this.get('bug').getValue()));
60 //return this.get('bug').getValue();
61 //this.success = c.success;
70 pack : "pack_start,false,true,3",
74 label : "On this project:"
79 changed : function (self) {
80 print("store: active id = " + this.el.get_active_id());
81 this.get('/ticket-store').reload();
86 id : "project-select",
88 this.el = new Gtk.ComboBox.with_entry();
91 this.model = new XObject(this.model);
93 this.el.set_model(this.model.el);
94 this.el.set_entry_text_column (0);
95 XObject.prototype.init.call(this);
98 imports.Projects.Projects.fetch( function(res) {
102 load : function(tr) {
103 this.model.el.clear();
105 for(var i =0 ; i < tr.length; i++) {
107 this.model.el.append(ret);
108 //print(JSON.stringify(ret,null,4));
110 this.model.el.set_value(ret.iter, 0, '' + tr[i].code + " - " + tr[i].name );
111 this.model.el.set_value(ret.iter, 1, '' + tr[i].id );
118 xtype: Gtk.ListStore,
119 id : "project-store",
121 XObject.prototype.init.call(this);
122 this.el.set_column_types ( 3, [
123 GObject.TYPE_STRING, // file
124 GObject.TYPE_STRING, // added
125 GObject.TYPE_STRING, // removed
133 button_press_event : function (self, event) {
139 label : "Not working on Project",
145 button_press_event : function (self, event) {
151 label : "Working on Selected Ticket",
158 pack : "pack_end,true,true,3",
167 pack : "pack_start,false,true,3",
172 key_release_event : function (self, event) {
173 if (event.key.keyval == Gdk.KEY_Return) {;
174 // same code as button press..
175 var active_id = this.get('/project-select').el.get_active();
177 var project_id = this.get('/project-select').raw_data[active_id].id;
179 var str = this.get('/search-entry').el.get_text();
185 imports.Tasks.Tasks.query({
186 project_id : project_id,
187 'query[filter]' : 'me',
188 'query[search]' : str
190 // print(JSON.stringify(res,null,4));
191 _t.get('/ticket-store').loadData(res);
198 pack : "pack_start,true,true,3"
203 clicked : function (self) {
204 var active_id = this.get('/project-select').el.get_active();
206 var project_id = this.get('/project-select').raw_data[active_id].id;
208 var str = this.get('/search-entry').el.get_text();
214 imports.Tasks.Tasks.query({
215 project_id : project_id,
216 'query[filter]' : 'me',
217 'query[search]' : str
219 // print(JSON.stringify(res,null,4));
220 _t.get('/ticket-store').loadData(res);
225 pack : "pack_end,false,true,3",
231 xtype: Gtk.ScrolledWindow,
232 pack : "pack_end,true,true,3",
233 shadow_type : Gtk.ShadowType.IN,
238 cursor_changed : function (self) {
241 this.selection.get_selected(ret);
244 var value = ''+ret.model.get_value(ret.iter, 0).value.get_string();
248 this.get('/ticket-store').data.forEach( function(e) {
254 // update the text box with the ticket data..
255 this.get('/view').show(rec);
263 fixed_height_mode : false,
264 headers_visible : false,
266 XObject.prototype.init.call(this);
267 var description = new Pango.FontDescription.c_new();
268 description.set_size(10000);
269 this.el.modify_font(description);
271 this.selection = this.el.get_selection();
272 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
275 // is this really needed??
276 this.selection.signal['changed'].connect(function() {
277 print('selection changed');
285 xtype: Gtk.ListStore,
289 GObject.TYPE_STRING, // title
290 GObject.TYPE_STRING, // tip
291 GObject.TYPE_STRING // source..
294 XObject.prototype.init.call(this);
296 this.el.set_column_types ( 2, [
297 GObject.TYPE_STRING, // real key
298 GObject.TYPE_STRING // real type
306 //imports.Projects.Projects.fetch( function(res) {
312 loadData : function (data) {
313 print("loading data");
320 data.forEach(function(p) {
323 //print("ADD " + p.name);
325 var line = '[' + p.status_name + '] <b>' +
326 GLib.markup_escape_text(p.summary, p.summary.length) + "</b>\n" +
327 '<span color="#666">' +
328 GLib.markup_escape_text(p.description,p.description.length).split("\n").slice(0,3).join("\n") +
332 el.set_value(ret.iter, 0, p.id);
333 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' + line );
339 reload : function() {
341 var active_id = this.get('/project-select').el.get_active();
343 var project_id = this.get('/project-select').raw_data[active_id].id;
347 imports.Tasks.Tasks.query({
348 project_id : project_id,
349 'query[filter]' : 'me'
351 print(JSON.stringify(res,null,4));
359 xtype: Gtk.TreeViewColumn,
360 pack : "append_column",
362 XObject.prototype.init.call(this);
363 this.el.add_attribute(this.items[0].el , 'markup', 1 );
367 xtype: Gtk.CellRendererText,
384 pack : "pack1,true,true",
388 pack : "pack_start,false,true,3",
392 label : "I am doing this:",
393 pack : "pack_start,false,true,3"
397 pack : "pack_start,true,true,3"
403 pack : "pack_start,false,true,3",
408 pack : "pack_start,false,true,3"
412 pack : "pack_start,false,false,3",
418 pack : "pack_start,false,true,3"
422 pack : "pack_start,true,true,3"
427 xtype: Gtk.ScrolledWindow,
439 XObject.prototype.init.call(this);
440 var description = Pango.font_description_from_string("monospace");
442 description.set_size(8000);
443 this.el.modify_font(description);
446 load : function(str) {
448 // show the help page for the active node..
453 this.el.get_buffer().set_text(str, str.length);
456 var buf = this.el.get_buffer();
463 'Status : ' + p.status_name,
466 'Summary : ' + p.summary,
473 // can not do rich text due to so many missing features..
474 this.el.get_buffer().set_text(line, line.length);
477 show_line_numbers : true,
480 xtype: GtkSource.Buffer,
482 changed : function (self) {
484 var s = new Gtk.TextIter();
485 var e = new Gtk.TextIter();
486 this.el.get_start_iter(s);
487 this.el.get_end_iter(e);
488 var str = this.el.get_text(s,e,true);
490 Seed.check_syntax('var e = ' + str);
492 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
493 red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
495 //print("SYNTAX ERROR IN EDITOR");
500 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
501 red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
504 this.get('/LeftPanel.model').changed( str , false);
518 pack : "pack2,false,false",
523 pack : "pack_start,false,true,3",
528 clicked : function (self) {
533 pack : "pack_end,false,true,3",
539 xtype: Gtk.ScrolledWindow,
540 pack : "pack_end,true,true,3",
541 shadow_type : Gtk.ShadowType.IN,
548 fixed_height_mode : true,
549 headers_visible : false,
551 XObject.prototype.init.call(this);
552 var description = new Pango.FontDescription.c_new();
553 description.set_size(10000);
554 this.el.modify_font(description);
556 this.selection = this.el.get_selection();
557 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
560 // is this really needed??
561 this.selection.signal['changed'].connect(function() {
562 print('selection changed');
570 xtype: Gtk.ListStore,
574 GObject.TYPE_STRING, // title
575 GObject.TYPE_STRING, // tip
576 GObject.TYPE_STRING // source..
579 XObject.prototype.init.call(this);
581 this.el.set_column_types ( 2, [
582 GObject.TYPE_STRING, // real key
583 GObject.TYPE_STRING // real type
591 //imports.Projects.Projects.fetch( function(res) {
597 loadData : function (data) {
598 print("loading data");
602 data.forEach(function(p) {
605 //print("ADD " + p.name);
607 el.set_value(ret.iter, 0, p.id);
608 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
609 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
610 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
619 reload : function() {
621 var active_id = this.get('/project-select').el.get_active();
623 var project_id = this.get('/project-select').raw_data[active_id].id;
627 var DT = imports.Date.Date;
629 new imports.Request.Request( {
630 url : '/cash_invoice_entry',
632 'query[action_dt_from]' : (new DT()).format('Y-m-d'),
633 'query[action_dt_to]' : (new DT()).add(DT.DAY,1).format('Y-m-d'),
635 'sort' : 'action_dt',
640 success : function(res) {
653 xtype: Gtk.TreeViewColumn,
654 pack : "append_column",
655 sizing : Gtk.TreeViewColumnSizing.FIXED,
657 XObject.prototype.init.call(this);
658 this.el.add_attribute(this.items[0].el , 'markup', 1 );
662 xtype: Gtk.CellRendererText,
682 XObject.cache['/FixBug'] = FixBug;