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();
255 fixed_height_mode : false,
256 headers_visible : false,
258 XObject.prototype.init.call(this);
259 var description = new Pango.FontDescription.c_new();
260 description.set_size(10000);
261 this.el.modify_font(description);
263 this.selection = this.el.get_selection();
264 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
267 // is this really needed??
268 this.selection.signal['changed'].connect(function() {
269 print('selection changed');
277 xtype: Gtk.ListStore,
281 GObject.TYPE_STRING, // title
282 GObject.TYPE_STRING, // tip
283 GObject.TYPE_STRING // source..
286 XObject.prototype.init.call(this);
288 this.el.set_column_types ( 2, [
289 GObject.TYPE_STRING, // real key
290 GObject.TYPE_STRING // real type
298 //imports.Projects.Projects.fetch( function(res) {
304 loadData : function (data) {
305 print("loading data");
309 data.forEach(function(p) {
312 //print("ADD " + p.name);
314 var line = '[' + p.status_name + '] <b>' +
315 GLib.markup_escape_text(p.summary, p.summary.length) + "</b>\n" +
316 '<span color="#666">' +
317 GLib.markup_escape_text(p.description,p.description.length).split("\n").slice(0,3).join("\n") +
321 el.set_value(ret.iter, 0, p.id);
322 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' + line );
328 reload : function() {
330 var active_id = this.get('/project-select').el.get_active();
332 var project_id = this.get('/project-select').raw_data[active_id].id;
336 imports.Tasks.Tasks.query({
337 project_id : project_id,
338 'query[filter]' : 'me'
340 print(JSON.stringify(res,null,4));
348 xtype: Gtk.TreeViewColumn,
349 pack : "append_column",
351 XObject.prototype.init.call(this);
352 this.el.add_attribute(this.items[0].el , 'markup', 1 );
356 xtype: Gtk.CellRendererText,
373 pack : "pack1,true,true",
377 pack : "pack_start,false,true,3",
381 label : "I am doing this:",
382 pack : "pack_start,false,true,3"
386 pack : "pack_start,true,true,3"
392 pack : "pack_start,false,true,3",
397 pack : "pack_start,false,true,3"
401 pack : "pack_start,false,false,3",
407 pack : "pack_start,false,true,3"
411 pack : "pack_start,true,true,3"
416 xtype: Gtk.ScrolledWindow,
428 XObject.prototype.init.call(this);
429 var description = Pango.font_description_from_string("monospace");
431 description.set_size(8000);
432 this.el.modify_font(description);
435 load : function(str) {
437 // show the help page for the active node..
442 this.el.get_buffer().set_text(str, str.length);
445 var buf = this.el.get_buffer();
450 show_line_numbers : true,
453 xtype: GtkSource.Buffer,
455 changed : function (self) {
457 var s = new Gtk.TextIter();
458 var e = new Gtk.TextIter();
459 this.el.get_start_iter(s);
460 this.el.get_end_iter(e);
461 var str = this.el.get_text(s,e,true);
463 Seed.check_syntax('var e = ' + str);
465 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
466 red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
468 //print("SYNTAX ERROR IN EDITOR");
473 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
474 red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
477 this.get('/LeftPanel.model').changed( str , false);
491 pack : "pack2,false,false",
496 pack : "pack_start,false,true,3",
501 clicked : function (self) {
506 pack : "pack_end,false,true,3",
512 xtype: Gtk.ScrolledWindow,
513 pack : "pack_end,true,true,3",
514 shadow_type : Gtk.ShadowType.IN,
521 fixed_height_mode : true,
522 headers_visible : false,
524 XObject.prototype.init.call(this);
525 var description = new Pango.FontDescription.c_new();
526 description.set_size(10000);
527 this.el.modify_font(description);
529 this.selection = this.el.get_selection();
530 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
533 // is this really needed??
534 this.selection.signal['changed'].connect(function() {
535 print('selection changed');
543 xtype: Gtk.ListStore,
547 GObject.TYPE_STRING, // title
548 GObject.TYPE_STRING, // tip
549 GObject.TYPE_STRING // source..
552 XObject.prototype.init.call(this);
554 this.el.set_column_types ( 2, [
555 GObject.TYPE_STRING, // real key
556 GObject.TYPE_STRING // real type
564 //imports.Projects.Projects.fetch( function(res) {
570 loadData : function (data) {
571 print("loading data");
575 data.forEach(function(p) {
578 //print("ADD " + p.name);
580 el.set_value(ret.iter, 0, p.id);
581 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
582 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
583 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
592 reload : function() {
594 var active_id = this.get('/project-select').el.get_active();
596 var project_id = this.get('/project-select').raw_data[active_id].id;
600 var DT = imports.Date.Date;
602 new imports.Request.Request( {
603 url : '/cash_invoice_entry',
605 'query[action_dt_from]' : (new DT()).format('Y-m-d'),
606 'query[action_dt_to]' : (new DT()).add(DT.DAY,1).format('Y-m-d'),
608 'sort' : 'action_dt',
613 success : function(res) {
626 xtype: Gtk.TreeViewColumn,
627 pack : "append_column",
628 sizing : Gtk.TreeViewColumnSizing.FIXED,
630 XObject.prototype.init.call(this);
631 this.el.add_attribute(this.items[0].el , 'markup', 1 );
635 xtype: Gtk.CellRendererText,
655 XObject.cache['/FixBug'] = FixBug;