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) {
239 var s = this.selection;
244 var value = ''+ret.model.get_value(ret.iter, 0).value.get_string();
253 fixed_height_mode : false,
254 headers_visible : false,
256 XObject.prototype.init.call(this);
257 var description = new Pango.FontDescription.c_new();
258 description.set_size(10000);
259 this.el.modify_font(description);
261 this.selection = this.el.get_selection();
262 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
265 // is this really needed??
266 this.selection.signal['changed'].connect(function() {
267 print('selection changed');
275 xtype: Gtk.ListStore,
279 GObject.TYPE_STRING, // title
280 GObject.TYPE_STRING, // tip
281 GObject.TYPE_STRING // source..
284 XObject.prototype.init.call(this);
286 this.el.set_column_types ( 2, [
287 GObject.TYPE_STRING, // real key
288 GObject.TYPE_STRING // real type
296 //imports.Projects.Projects.fetch( function(res) {
302 loadData : function (data) {
303 print("loading data");
307 data.forEach(function(p) {
310 //print("ADD " + p.name);
312 var line = '[' + p.status_name + '] <b>' +
313 GLib.markup_escape_text(p.summary, p.summary.length) + "</b>\n" +
314 '<span color="#666">' +
315 GLib.markup_escape_text(p.description,p.description.length).split("\n").slice(0,3).join("\n") +
319 el.set_value(ret.iter, 0, p.id);
320 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' + line );
326 reload : function() {
328 var active_id = this.get('/project-select').el.get_active();
330 var project_id = this.get('/project-select').raw_data[active_id].id;
334 imports.Tasks.Tasks.query({
335 project_id : project_id,
336 'query[filter]' : 'me'
338 print(JSON.stringify(res,null,4));
346 xtype: Gtk.TreeViewColumn,
347 pack : "append_column",
349 XObject.prototype.init.call(this);
350 this.el.add_attribute(this.items[0].el , 'markup', 1 );
354 xtype: Gtk.CellRendererText,
371 pack : "pack1,true,true",
375 pack : "pack_start,false,true,3",
379 label : "I am doing this:",
380 pack : "pack_start,false,true,3"
384 pack : "pack_start,true,true,3"
390 pack : "pack_start,false,true,3",
395 pack : "pack_start,false,true,3"
399 pack : "pack_start,false,false,3",
405 pack : "pack_start,false,true,3"
409 pack : "pack_start,true,true,3"
414 xtype: Gtk.ScrolledWindow,
426 XObject.prototype.init.call(this);
427 var description = Pango.font_description_from_string("monospace");
429 description.set_size(8000);
430 this.el.modify_font(description);
433 load : function(str) {
435 // show the help page for the active node..
440 this.el.get_buffer().set_text(str, str.length);
443 var buf = this.el.get_buffer();
448 show_line_numbers : true,
451 xtype: GtkSource.Buffer,
453 changed : function (self) {
455 var s = new Gtk.TextIter();
456 var e = new Gtk.TextIter();
457 this.el.get_start_iter(s);
458 this.el.get_end_iter(e);
459 var str = this.el.get_text(s,e,true);
461 Seed.check_syntax('var e = ' + str);
463 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
464 red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
466 //print("SYNTAX ERROR IN EDITOR");
471 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
472 red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
475 this.get('/LeftPanel.model').changed( str , false);
489 pack : "pack2,false,false",
494 pack : "pack_start,false,true,3",
499 clicked : function (self) {
504 pack : "pack_end,false,true,3",
510 xtype: Gtk.ScrolledWindow,
511 pack : "pack_end,true,true,3",
512 shadow_type : Gtk.ShadowType.IN,
519 fixed_height_mode : true,
520 headers_visible : false,
522 XObject.prototype.init.call(this);
523 var description = new Pango.FontDescription.c_new();
524 description.set_size(10000);
525 this.el.modify_font(description);
527 this.selection = this.el.get_selection();
528 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
531 // is this really needed??
532 this.selection.signal['changed'].connect(function() {
533 print('selection changed');
541 xtype: Gtk.ListStore,
545 GObject.TYPE_STRING, // title
546 GObject.TYPE_STRING, // tip
547 GObject.TYPE_STRING // source..
550 XObject.prototype.init.call(this);
552 this.el.set_column_types ( 2, [
553 GObject.TYPE_STRING, // real key
554 GObject.TYPE_STRING // real type
562 //imports.Projects.Projects.fetch( function(res) {
568 loadData : function (data) {
569 print("loading data");
573 data.forEach(function(p) {
576 //print("ADD " + p.name);
578 el.set_value(ret.iter, 0, p.id);
579 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
580 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
581 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
590 reload : function() {
592 var active_id = this.get('/project-select').el.get_active();
594 var project_id = this.get('/project-select').raw_data[active_id].id;
598 var DT = imports.Date.Date;
600 new imports.Request.Request( {
601 url : '/cash_invoice_entry',
603 'query[action_dt_from]' : (new DT()).format('Y-m-d'),
604 'query[action_dt_to]' : (new DT()).add(DT.DAY,1).format('Y-m-d'),
606 'sort' : 'action_dt',
611 success : function(res) {
624 xtype: Gtk.TreeViewColumn,
625 pack : "append_column",
626 sizing : Gtk.TreeViewColumnSizing.FIXED,
628 XObject.prototype.init.call(this);
629 this.el.add_attribute(this.items[0].el , 'markup', 1 );
633 xtype: Gtk.CellRendererText,
653 XObject.cache['/FixBug'] = FixBug;