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(event.key.keyval); //.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>' +
280 GLib.markup_escape_text(p.summary, p.summary.length) + "</b>\n" +
281 '<span color="#666">' +
282 GLib.markup_escape_text(p.description,p.description.length).split("\n").slice(0,3).join("\n") +
286 el.set_value(ret.iter, 0, p.id);
287 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' + line );
293 reload : function() {
295 var active_id = this.get('/project-select').el.get_active();
297 var project_id = this.get('/project-select').raw_data[active_id].id;
301 imports.Tasks.Tasks.query({
302 project_id : project_id,
303 'query[filter]' : 'me'
305 print(JSON.stringify(res,null,4));
313 xtype: Gtk.TreeViewColumn,
314 pack : "append_column",
316 XObject.prototype.init.call(this);
317 this.el.add_attribute(this.items[0].el , 'markup', 1 );
321 xtype: Gtk.CellRendererText,
338 pack : "pack1,true,true",
342 pack : "pack_start,false,true,3",
346 label : "I am doing this:",
347 pack : "pack_start,false,true,3"
351 pack : "pack_start,true,true,3"
357 pack : "pack_start,false,true,3",
362 pack : "pack_start,false,true,3"
366 pack : "pack_start,false,false,3",
372 pack : "pack_start,false,true,3"
376 pack : "pack_start,true,true,3"
381 xtype: Gtk.ScrolledWindow,
393 XObject.prototype.init.call(this);
394 var description = Pango.font_description_from_string("monospace");
396 description.set_size(8000);
397 this.el.modify_font(description);
400 load : function(str) {
402 // show the help page for the active node..
407 this.el.get_buffer().set_text(str, str.length);
410 var buf = this.el.get_buffer();
415 show_line_numbers : true,
418 xtype: GtkSource.Buffer,
420 changed : function (self) {
422 var s = new Gtk.TextIter();
423 var e = new Gtk.TextIter();
424 this.el.get_start_iter(s);
425 this.el.get_end_iter(e);
426 var str = this.el.get_text(s,e,true);
428 Seed.check_syntax('var e = ' + str);
430 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
431 red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
433 //print("SYNTAX ERROR IN EDITOR");
438 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
439 red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
442 this.get('/LeftPanel.model').changed( str , false);
456 pack : "pack2,false,false",
461 pack : "pack_start,false,true,3",
466 clicked : function (self) {
471 pack : "pack_end,false,true,3",
477 xtype: Gtk.ScrolledWindow,
478 pack : "pack_end,true,true,3",
479 shadow_type : Gtk.ShadowType.IN,
486 fixed_height_mode : true,
487 headers_visible : false,
489 XObject.prototype.init.call(this);
490 var description = new Pango.FontDescription.c_new();
491 description.set_size(10000);
492 this.el.modify_font(description);
494 this.selection = this.el.get_selection();
495 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
498 // is this really needed??
499 this.selection.signal['changed'].connect(function() {
500 print('selection changed');
508 xtype: Gtk.ListStore,
512 GObject.TYPE_STRING, // title
513 GObject.TYPE_STRING, // tip
514 GObject.TYPE_STRING // source..
517 XObject.prototype.init.call(this);
519 this.el.set_column_types ( 2, [
520 GObject.TYPE_STRING, // real key
521 GObject.TYPE_STRING // real type
529 //imports.Projects.Projects.fetch( function(res) {
535 loadData : function (data) {
536 print("loading data");
540 data.forEach(function(p) {
543 //print("ADD " + p.name);
545 el.set_value(ret.iter, 0, p.id);
546 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
547 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
548 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
557 reload : function() {
559 var active_id = this.get('/project-select').el.get_active();
561 var project_id = this.get('/project-select').raw_data[active_id].id;
565 var DT = imports.Date.Date;
567 new imports.Request.Request( {
568 url : '/cash_invoice_entry',
570 'query[action_dt_from]' : (new DT()).format('Y-m-d'),
571 'query[action_dt_to]' : (new DT()).add(DT.DAY,1).format('Y-m-d'),
573 'sort' : 'action_dt',
578 success : function(res) {
591 xtype: Gtk.TreeViewColumn,
592 pack : "append_column",
593 sizing : Gtk.TreeViewColumnSizing.FIXED,
595 XObject.prototype.init.call(this);
596 this.el.add_attribute(this.items[0].el , 'markup', 1 );
600 xtype: Gtk.CellRendererText,
620 XObject.cache['/FixBug'] = FixBug;