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",
163 pack : "pack_start,false,true,3",
167 pack : "pack_start,false,true,3"
172 pack : "pack_end,false,true,3",
178 xtype: Gtk.ScrolledWindow,
179 pack : "pack_end,true,true,3",
180 shadow_type : Gtk.ShadowType.IN,
184 fixed_height_mode : true,
188 headers_visible : false,
190 XObject.prototype.init.call(this);
191 var description = new Pango.FontDescription.c_new();
192 description.set_size(10000);
193 this.el.modify_font(description);
195 this.selection = this.el.get_selection();
196 this.selection.set_mode( Gtk.SelectionMode.SINGLE);
199 // is this really needed??
200 this.selection.signal['changed'].connect(function() {
201 print('selection changed');
209 xtype: Gtk.ListStore,
213 GObject.TYPE_STRING, // title
214 GObject.TYPE_STRING, // tip
215 GObject.TYPE_STRING // source..
218 XObject.prototype.init.call(this);
220 this.el.set_column_types ( 2, [
221 GObject.TYPE_STRING, // real key
222 GObject.TYPE_STRING // real type
230 //imports.Projects.Projects.fetch( function(res) {
236 loadData : function (data) {
237 print("loading data");
241 data.forEach(function(p) {
244 //print("ADD " + p.name);
246 el.set_value(ret.iter, 0, p.id);
247 el.set_value(ret.iter, 1, '<b>#' + p.id + '</b>' +
248 '[' + p.status_name + '] <b>' + p.summary + "</b>\n" +
249 '<span color="#666">' + p.description.split("\n").slice(0,3).join("\n") +
258 reload : function() {
260 var active_id = this.get('/project-select').el.get_active();
262 var project_id = this.get('/project-select').raw_data[active_id].id;
266 imports.Tasks.Tasks.query({
267 project_id : project_id,
268 'query[filter]' : 'me'
270 print(JSON.stringify(res,null,4));
278 xtype: Gtk.TreeViewColumn,
281 XObject.prototype.init.call(this);
282 this.el.add_attribute(this.items[0].el , 'markup', 1 );
286 xtype: Gtk.CellRendererText,
303 pack : "pack_start,false,true,3",
307 label : "I am doing this:",
308 pack : "pack_start,false,true,3"
312 pack : "pack_start,true,true,3"
318 pack : "pack_start,false,true,3",
323 pack : "pack_start,false,true,3"
327 pack : "pack_start,false,false,3",
333 pack : "pack_start,false,true,3"
337 pack : "pack_start,true,true,3"
342 xtype: Gtk.ScrolledWindow,
354 XObject.prototype.init.call(this);
355 var description = Pango.font_description_from_string("monospace");
357 description.set_size(8000);
358 this.el.modify_font(description);
361 load : function(str) {
363 // show the help page for the active node..
368 this.el.get_buffer().set_text(str, str.length);
371 var buf = this.el.get_buffer();
376 show_line_numbers : true,
379 xtype: GtkSource.Buffer,
381 changed : function (self) {
383 var s = new Gtk.TextIter();
384 var e = new Gtk.TextIter();
385 this.el.get_start_iter(s);
386 this.el.get_end_iter(e);
387 var str = this.el.get_text(s,e,true);
389 Seed.check_syntax('var e = ' + str);
391 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
392 red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
394 //print("SYNTAX ERROR IN EDITOR");
399 this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
400 red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
403 this.get('/LeftPanel.model').changed( str , false);
422 XObject.cache['/FixBug'] = FixBug;