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);
30 title : "Select Active Bug",
39 /*[ 'xtype' ].forEach(function(k) {
40 _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
47 // this.get('/ok_button').el.set_sensitive(false);
49 // block until we return.
50 // var run_ret = this.el.run();
51 // if (run_ret < 1 ) {
54 // print("RUN RETURN : " + run_ret);
56 //print(JSON.stringify(this.get('bug').getValue()));
57 //return this.get('bug').getValue();
58 //this.success = c.success;
67 pack : "pack_start,false,true,3",
71 label : "On this project:"
76 changed : function (self) {
77 print("store: active id = " + this.el.get_active_id());
78 this.get('/ticket-store').reload();
83 id : "project-select",
85 this.el = new Gtk.ComboBox.with_entry();
88 this.model = new XObject(this.model);
90 this.el.set_model(this.model.el);
91 this.el.set_entry_text_column (0);
92 XObject.prototype.init.call(this);
95 imports.Projects.Projects.fetch( function(res) {
100 this.model.el.clear();
102 for(var i =0 ; i < tr.length; i++) {
104 this.model.el.append(ret);
105 //print(JSON.stringify(ret,null,4));
107 this.model.el.set_value(ret.iter, 0, '' + tr[i].code + " - " + tr[i].name );
108 this.model.el.set_value(ret.iter, 1, '' + tr[i].id );
115 xtype: Gtk.ListStore,
116 id : "project-store",
118 XObject.prototype.init.call(this);
119 this.el.set_column_types ( 3, [
120 GObject.TYPE_STRING, // file
121 GObject.TYPE_STRING, // added
122 GObject.TYPE_STRING, // removed
130 button_press_event : function (self, event) {
136 label : "Not working on Project",
142 button_press_event : function (self, event) {
148 label : "Working on Selected Ticket",
155 pack : "pack_end,true,true,3",
164 pack : "pack_start,false,true,3",
169 key_release_event : function (self, event) {
170 print(JSON.stringify(event,null,4)); //.keyval);
175 pack : "pack_start,true,true,3"
180 clicked : function (self) {
181 var active_id = this.get('/project-select').el.get_active();
183 var project_id = this.get('/project-select').raw_data[active_id].id;
185 var str = this.get('/search-entry').el.get_text();
191 imports.Tasks.Tasks.query({
192 project_id : project_id,
193 'query[filter]' : 'me',
194 'query[search]' : str
196 // print(JSON.stringify(res,null,4));
197 _t.get('/ticket-store').loadData(res);
202 pack : "pack_end,false,true,3",
208 xtype: Gtk.ScrolledWindow,
209 pack : "pack_end,true,true,3",
210 shadow_type : Gtk.ShadowType.IN,
214 fixed_height_mode : true,
218 headers_visible : false,
220 XObject.prototype.init.call(this);
221 var description = new Pango.FontDescription.c_new();
222 description.set_size(10000);
223 this.el.modify_font(description);
225 this.selection = this.el.get_selection();
226 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
229 // is this really needed??
230 this.selection.signal['changed'].connect(function() {
231 print('selection changed');
239 xtype: Gtk.ListStore,
243 GObject.TYPE_STRING, // title
244 GObject.TYPE_STRING, // tip
245 GObject.TYPE_STRING // source..
248 XObject.prototype.init.call(this);
250 this.el.set_column_types ( 2, [
251 GObject.TYPE_STRING, // real key
252 GObject.TYPE_STRING // real type
260 //imports.Projects.Projects.fetch( function(res) {
266 loadData : function (data) {
267 print("loading data");
271 data.forEach(function(p) {
274 //print("ADD " + p.name);
276 el.set_value(ret.iter, 0, p.id);
277 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
278 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
279 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
288 reload : function() {
290 var active_id = this.get('/project-select').el.get_active();
292 var project_id = this.get('/project-select').raw_data[active_id].id;
296 imports.Tasks.Tasks.query({
297 project_id : project_id,
298 'query[filter]' : 'me'
300 print(JSON.stringify(res,null,4));
308 xtype: Gtk.TreeViewColumn,
309 pack : "append_column",
310 sizing : Gtk.TreeViewColumnSizing.FIXED,
312 XObject.prototype.init.call(this);
313 this.el.add_attribute(this.items[0].el , 'markup', 1 );
317 xtype: Gtk.CellRendererText,
338 pack : "pack_start,false,true,3",
342 label : "I am doing this:",
343 pack : "pack_start,false,true,3"
347 pack : "pack_start,true,true,3"
353 pack : "pack_start,false,true,3",
358 pack : "pack_start,false,true,3"
362 pack : "pack_start,false,false,3",
368 pack : "pack_start,false,true,3"
372 pack : "pack_start,true,true,3"
377 xtype: Gtk.ScrolledWindow,
389 XObject.prototype.init.call(this);
390 var description = Pango.font_description_from_string("monospace");
392 description.set_size(8000);
393 this.el.modify_font(description);
396 load : function(str) {
398 // show the help page for the active node..
403 this.el.get_buffer().set_text(str, str.length);
406 var buf = this.el.get_buffer();
411 show_line_numbers : true,
414 xtype: GtkSource.Buffer,
416 changed : function (self) {
418 var s = new Gtk.TextIter();
419 var e = new Gtk.TextIter();
420 this.el.get_start_iter(s);
421 this.el.get_end_iter(e);
422 var str = this.el.get_text(s,e,true);
424 Seed.check_syntax('var e = ' + str);
426 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
427 red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
429 //print("SYNTAX ERROR IN EDITOR");
434 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
435 red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
438 this.get('/LeftPanel.model').changed( str , false);
457 pack : "pack_start,false,true,3",
462 clicked : function (self) {
467 pack : "pack_end,false,true,3",
473 xtype: Gtk.ScrolledWindow,
474 pack : "pack_end,true,true,3",
475 shadow_type : Gtk.ShadowType.IN,
479 fixed_height_mode : true,
483 headers_visible : false,
485 XObject.prototype.init.call(this);
486 var description = new Pango.FontDescription.c_new();
487 description.set_size(10000);
488 this.el.modify_font(description);
490 this.selection = this.el.get_selection();
491 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
494 // is this really needed??
495 this.selection.signal['changed'].connect(function() {
496 print('selection changed');
504 xtype: Gtk.ListStore,
508 GObject.TYPE_STRING, // title
509 GObject.TYPE_STRING, // tip
510 GObject.TYPE_STRING // source..
513 XObject.prototype.init.call(this);
515 this.el.set_column_types ( 2, [
516 GObject.TYPE_STRING, // real key
517 GObject.TYPE_STRING // real type
525 //imports.Projects.Projects.fetch( function(res) {
531 loadData : function (data) {
532 print("loading data");
536 data.forEach(function(p) {
539 //print("ADD " + p.name);
541 el.set_value(ret.iter, 0, p.id);
542 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
543 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
544 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
553 reload : function() {
555 var active_id = this.get('/project-select').el.get_active();
557 var project_id = this.get('/project-select').raw_data[active_id].id;
561 imports.Tasks.Tasks.query({
562 project_id : project_id,
563 'query[filter]' : 'me'
565 print(JSON.stringify(res,null,4));
573 xtype: Gtk.TreeViewColumn,
574 pack : "append_column",
575 sizing : Gtk.TreeViewColumnSizing.FIXED,
577 XObject.prototype.init.call(this);
578 this.el.add_attribute(this.items[0].el , 'markup', 1 );
582 xtype: Gtk.CellRendererText,
602 XObject.cache['/FixBug'] = FixBug;