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 print(JSON.stringify(event,null,4)); //.keyval);
178 pack : "pack_start,true,true,3"
183 clicked : function (self) {
184 var active_id = this.get('/project-select').el.get_active();
186 var project_id = this.get('/project-select').raw_data[active_id].id;
188 var str = this.get('/search-entry').el.get_text();
194 imports.Tasks.Tasks.query({
195 project_id : project_id,
196 'query[filter]' : 'me',
197 'query[search]' : str
199 // print(JSON.stringify(res,null,4));
200 _t.get('/ticket-store').loadData(res);
205 pack : "pack_end,false,true,3",
211 xtype: Gtk.ScrolledWindow,
212 pack : "pack_end,true,true,3",
213 shadow_type : Gtk.ShadowType.IN,
220 fixed_height_mode : false,
221 headers_visible : false,
223 XObject.prototype.init.call(this);
224 var description = new Pango.FontDescription.c_new();
225 description.set_size(10000);
226 this.el.modify_font(description);
228 this.selection = this.el.get_selection();
229 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
232 // is this really needed??
233 this.selection.signal['changed'].connect(function() {
234 print('selection changed');
242 xtype: Gtk.ListStore,
246 GObject.TYPE_STRING, // title
247 GObject.TYPE_STRING, // tip
248 GObject.TYPE_STRING // source..
251 XObject.prototype.init.call(this);
253 this.el.set_column_types ( 2, [
254 GObject.TYPE_STRING, // real key
255 GObject.TYPE_STRING // real type
263 //imports.Projects.Projects.fetch( function(res) {
269 loadData : function (data) {
270 print("loading data");
274 data.forEach(function(p) {
277 //print("ADD " + p.name);
279 var line = '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
280 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
284 el.set_value(ret.iter, 0, p.id);
285 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' + line );
291 reload : function() {
293 var active_id = this.get('/project-select').el.get_active();
295 var project_id = this.get('/project-select').raw_data[active_id].id;
299 imports.Tasks.Tasks.query({
300 project_id : project_id,
301 'query[filter]' : 'me'
303 print(JSON.stringify(res,null,4));
311 xtype: Gtk.TreeViewColumn,
312 pack : "append_column",
314 XObject.prototype.init.call(this);
315 this.el.add_attribute(this.items[0].el , 'markup', 1 );
319 xtype: Gtk.CellRendererText,
336 pack : "pack1,true,true",
340 pack : "pack_start,false,true,3",
344 label : "I am doing this:",
345 pack : "pack_start,false,true,3"
349 pack : "pack_start,true,true,3"
355 pack : "pack_start,false,true,3",
360 pack : "pack_start,false,true,3"
364 pack : "pack_start,false,false,3",
370 pack : "pack_start,false,true,3"
374 pack : "pack_start,true,true,3"
379 xtype: Gtk.ScrolledWindow,
391 XObject.prototype.init.call(this);
392 var description = Pango.font_description_from_string("monospace");
394 description.set_size(8000);
395 this.el.modify_font(description);
398 load : function(str) {
400 // show the help page for the active node..
405 this.el.get_buffer().set_text(str, str.length);
408 var buf = this.el.get_buffer();
413 show_line_numbers : true,
416 xtype: GtkSource.Buffer,
418 changed : function (self) {
420 var s = new Gtk.TextIter();
421 var e = new Gtk.TextIter();
422 this.el.get_start_iter(s);
423 this.el.get_end_iter(e);
424 var str = this.el.get_text(s,e,true);
426 Seed.check_syntax('var e = ' + str);
428 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
429 red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
431 //print("SYNTAX ERROR IN EDITOR");
436 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
437 red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
440 this.get('/LeftPanel.model').changed( str , false);
454 pack : "pack2,false,false",
459 pack : "pack_start,false,true,3",
464 clicked : function (self) {
469 pack : "pack_end,false,true,3",
475 xtype: Gtk.ScrolledWindow,
476 pack : "pack_end,true,true,3",
477 shadow_type : Gtk.ShadowType.IN,
484 fixed_height_mode : true,
485 headers_visible : false,
487 XObject.prototype.init.call(this);
488 var description = new Pango.FontDescription.c_new();
489 description.set_size(10000);
490 this.el.modify_font(description);
492 this.selection = this.el.get_selection();
493 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
496 // is this really needed??
497 this.selection.signal['changed'].connect(function() {
498 print('selection changed');
506 xtype: Gtk.ListStore,
510 GObject.TYPE_STRING, // title
511 GObject.TYPE_STRING, // tip
512 GObject.TYPE_STRING // source..
515 XObject.prototype.init.call(this);
517 this.el.set_column_types ( 2, [
518 GObject.TYPE_STRING, // real key
519 GObject.TYPE_STRING // real type
527 //imports.Projects.Projects.fetch( function(res) {
533 loadData : function (data) {
534 print("loading data");
538 data.forEach(function(p) {
541 //print("ADD " + p.name);
543 el.set_value(ret.iter, 0, p.id);
544 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
545 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
546 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
555 reload : function() {
557 var active_id = this.get('/project-select').el.get_active();
559 var project_id = this.get('/project-select').raw_data[active_id].id;
563 var DT = imports.Date.Date;
565 new imports.Request.Request( {
566 url : '/cash_invoice_entry',
568 'query[action_dt_from]' : (new DT()).format('Y-m-d'),
569 'query[action_dt_to]' : (new DT()).add(DT.DAY,1).format('Y-m-d'),
571 'sort' : 'action_dt',
576 success : function(res) {
589 xtype: Gtk.TreeViewColumn,
590 pack : "append_column",
591 sizing : Gtk.TreeViewColumnSizing.FIXED,
593 XObject.prototype.init.call(this);
594 this.el.add_attribute(this.items[0].el , 'markup', 1 );
598 xtype: Gtk.CellRendererText,
618 XObject.cache['/FixBug'] = FixBug;