Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.4rc1, 0.4rc2, and 0.4rc3

hggtk/datamine: add 'User' column to annotate page

Hidden by default. Enabled via context menu on column headers.

Changeset 658eb95c2728

Parent 1edbd4823c80

by TK Soh

Changes to one file · Browse files at 658eb95c2728 Showing diff from parent 1edbd4823c80 Diff from another changeset...

Change 1 of 11 Show Entire File hggtk/​datamine.py Stacked
 
25
26
27
 
28
29
30
 
76
77
78
 
 
 
 
 
 
 
 
 
 
 
79
80
81
 
130
131
132
133
134
 
 
135
136
137
 
301
302
303
304
 
305
306
307
 
340
341
342
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
343
344
345
 
371
372
373
374
375
376
377
378
379
380
381
382
383
 
392
393
394
395
 
396
397
398
399
 
 
 
 
 
 
 
400
401
402
 
408
409
410
 
411
 
 
412
413
414
 
439
440
441
442
443
444
445
446
 
450
451
452
453
 
454
455
 
456
457
458
 
545
546
547
548
 
549
550
551
 
552
553
554
 
25
26
27
28
29
30
31
 
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
 
142
143
144
 
 
145
146
147
148
149
 
313
314
315
 
316
317
318
319
 
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
 
399
400
401
 
402
403
404
405
406
 
407
408
409
 
418
419
420
 
421
422
 
 
 
423
424
425
426
427
428
429
430
431
432
 
438
439
440
441
442
443
444
445
446
447
 
472
473
474
 
 
475
476
477
 
481
482
483
 
484
485
 
486
487
488
489
 
576
577
578
 
579
580
581
 
582
583
584
585
@@ -25,6 +25,7 @@
  COL_TOOLTIP = 2   COL_PATH = 3   COL_COLOR = 4 + COL_USER = 5     def get_title(self):   return 'DataMining - ' + os.path.basename(self.repo.root) @@ -76,6 +77,17 @@
  self.stop_button.set_sensitive(False)   return vbox   + def ann_header_context_menu(self, treeview): + _menu = gtk.Menu() + _button = gtk.CheckMenuItem("Filename") + _button.connect("toggled", self.toggle_annatate_columns, treeview, 1) + _menu.append(_button) + _button = gtk.CheckMenuItem("User") + _button.connect("toggled", self.toggle_annatate_columns, treeview, 2) + _menu.append(_button) + _menu.show_all() + return _menu +   def grep_context_menu(self):   _menu = gtk.Menu()   _menu.append(create_menu('di_splay change', self._cmenu_display)) @@ -130,8 +142,8 @@
  summary = summary.split('\n')[0]   date = time.strftime("%y-%m-%d %H:%M", time.gmtime(ctx.date()[0]))   desc = author+'@'+str(rev)+' '+date+' "'+summary+'"' - self.changedesc[rev] = desc - return desc + self.changedesc[rev] = (desc, author) + return (desc, author)     def _search_clicked(self, button, data):   self.add_search_page() @@ -301,7 +313,7 @@
  (path, revid, text) = line.split(':', 2)   except ValueError:   continue - tip = self.get_rev_desc(long(revid)) + tip, user = self.get_rev_desc(long(revid))   model.append((revid, text, tip, path))   if thread.isAlive():   return True @@ -340,6 +352,22 @@
  if num != -1 and self.notebook.get_n_pages() > 1:   self.notebook.remove_page(num)   + def _add_header_context_menu(self, col, menu): + lb = gtk.Label(col.get_title()) + lb.show() + col.set_widget(lb) + wgt = lb.get_parent() + while wgt and type(wgt) != gtk.Button: + wgt = wgt.get_parent() + wgt.connect("button-press-event", self._tree_header_button_press, + menu) + + def _tree_header_button_press(self, widget, event, menu): + if event.button == 3: + menu.popup(None, None, None, event.button, event.time) + return True + return False +   def add_annotate_page(self, path, revid):   '''   Add new annotation page to notebook. Start scan of @@ -371,13 +399,11 @@
  graphview.set_property('date-column-visible', True)     hbox = gtk.HBox() - showfilename = gtk.CheckButton('Show Filename')   followlabel = gtk.Label('')   follow = gtk.Button('Follow')   follow.connect('clicked', self.follow_rename)   follow.hide()   follow.set_sensitive(False) - hbox.pack_start(showfilename, False, False)   hbox.pack_start(gtk.Label(''), True, True)   hbox.pack_start(followlabel, False, False)   hbox.pack_start(follow, False, False) @@ -392,11 +418,15 @@
  treeview.connect('popup-menu', self._ann_popup_menu)   treeview.connect('row-activated', self._ann_row_act)   - results = gtk.ListStore(str, str, str, str, str) + results = gtk.ListStore(str, str, str, str, str, str)   treeview.set_model(results) - for title, width, col in (('Rev', 10, self.COL_REVID), - ('File', 15, self.COL_PATH), - ('Matches', 80, self.COL_TEXT)): + + context_menu = self.ann_header_context_menu(treeview) + for title, width, col, visible in ( + ('Rev', 10, self.COL_REVID, True), + ('File', 15, self.COL_PATH, False), + ('User', 15, self.COL_USER, False), + ('Matches', 80, self.COL_TEXT, True)):   cell = gtk.CellRendererText()   cell.set_property("width-chars", width)   cell.set_property("ellipsize", pango.ELLIPSIZE_START) @@ -408,7 +438,10 @@
  column.pack_start(cell, expand=True)   column.add_attribute(cell, "text", col)   column.add_attribute(cell, "background", self.COL_COLOR) + column.set_visible(visible)   treeview.append_column(column) + self._add_header_context_menu(column, context_menu) + treeview.set_headers_clickable(True)   if hasattr(treeview, 'set_tooltip_column'):   treeview.set_tooltip_column(self.COL_TOOLTIP)   results.path = path @@ -439,8 +472,6 @@
  self.notebook.set_tab_reorderable(frame, True)   self.notebook.set_current_page(num)   - showfilename.connect('toggled', self.toggle_filename_col, treeview) - treeview.get_column(1).set_visible(False)   graphview.connect('revision-selected', self.log_selection_changed,   path, followlabel, follow)   @@ -450,9 +481,9 @@
  self._ann_button_release)   graphview.treeview.connect('popup-menu', self._ann_popup_menu)   - def toggle_filename_col(self, button, treeview): + def toggle_annatate_columns(self, button, treeview, col):   b = button.get_active() - treeview.get_column(1).set_visible(b) + treeview.get_column(col).set_visible(b)     def log_selection_changed(self, graphview, path, label, button):   row = graphview.get_revision() @@ -545,10 +576,10 @@
  rowrev = long(revid)   except ValueError:   continue - tip = self.get_rev_desc(rowrev) + tip, user = self.get_rev_desc(rowrev)   ctx = self.repo.changectx(rowrev)   color = colormap.get_color(ctx, curdate) - model.append((revid, text, tip, path.strip(), color)) + model.append((revid, text, tip, path.strip(), color, user))   if thread.isAlive():   return True   else: