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,
217 fixed_height_mode : true,
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 el.set_value(ret.iter, 0, p.id);
280 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
281 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
282 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
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",
313 sizing : Gtk.TreeViewColumnSizing.FIXED,
315 XObject.prototype.init.call(this);
316 this.el.add_attribute(this.items[0].el , 'markup', 1 );
320 xtype: Gtk.CellRendererText,
337 pack : "pack1,true,true",
341 pack : "pack_start,false,true,3",
345 label : "I am doing this:",
346 pack : "pack_start,false,true,3"
350 pack : "pack_start,true,true,3"
356 pack : "pack_start,false,true,3",
361 pack : "pack_start,false,true,3"
365 pack : "pack_start,false,false,3",
371 pack : "pack_start,false,true,3"
375 pack : "pack_start,true,true,3"
380 xtype: Gtk.ScrolledWindow,
392 XObject.prototype.init.call(this);
393 var description = Pango.font_description_from_string("monospace");
395 description.set_size(8000);
396 this.el.modify_font(description);
399 load : function(str) {
401 // show the help page for the active node..
406 this.el.get_buffer().set_text(str, str.length);
409 var buf = this.el.get_buffer();
414 show_line_numbers : true,
417 xtype: GtkSource.Buffer,
419 changed : function (self) {
421 var s = new Gtk.TextIter();
422 var e = new Gtk.TextIter();
423 this.el.get_start_iter(s);
424 this.el.get_end_iter(e);
425 var str = this.el.get_text(s,e,true);
427 Seed.check_syntax('var e = ' + str);
429 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
430 red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
432 //print("SYNTAX ERROR IN EDITOR");
437 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
438 red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
441 this.get('/LeftPanel.model').changed( str , false);
455 pack : "pack2,false,false",
460 pack : "pack_start,false,true,3",
465 clicked : function (self) {
470 pack : "pack_end,false,true,3",
476 xtype: Gtk.ScrolledWindow,
477 pack : "pack_end,true,true,3",
478 shadow_type : Gtk.ShadowType.IN,
485 fixed_height_mode : true,
486 headers_visible : false,
488 XObject.prototype.init.call(this);
489 var description = new Pango.FontDescription.c_new();
490 description.set_size(10000);
491 this.el.modify_font(description);
493 this.selection = this.el.get_selection();
494 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
497 // is this really needed??
498 this.selection.signal['changed'].connect(function() {
499 print('selection changed');
507 xtype: Gtk.ListStore,
511 GObject.TYPE_STRING, // title
512 GObject.TYPE_STRING, // tip
513 GObject.TYPE_STRING // source..
516 XObject.prototype.init.call(this);
518 this.el.set_column_types ( 2, [
519 GObject.TYPE_STRING, // real key
520 GObject.TYPE_STRING // real type
528 //imports.Projects.Projects.fetch( function(res) {
534 loadData : function (data) {
535 print("loading data");
539 data.forEach(function(p) {
542 //print("ADD " + p.name);
544 el.set_value(ret.iter, 0, p.id);
545 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
546 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
547 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
556 reload : function() {
558 var active_id = this.get('/project-select').el.get_active();
560 var project_id = this.get('/project-select').raw_data[active_id].id;
564 imports.Tasks.Tasks.query({
565 project_id : project_id,
566 'query[filter]' : 'me'
568 print(JSON.stringify(res,null,4));
576 xtype: Gtk.TreeViewColumn,
577 pack : "append_column",
578 sizing : Gtk.TreeViewColumnSizing.FIXED,
580 XObject.prototype.init.call(this);
581 this.el.add_attribute(this.items[0].el , 'markup', 1 );
585 xtype: Gtk.CellRendererText,
605 XObject.cache['/FixBug'] = FixBug;