Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

datamine: add 'annotate parent' context menu

Changeset 02ddb9b7fddb

Parent 4d5c81e5cea5

by Steve Borho

Changes to one file · Browse files at 02ddb9b7fddb Showing diff from parent 4d5c81e5cea5 Diff from another changeset...

Change 1 of 5 Show Entire File hggtk/​datamine.py Stacked
 
74
75
76
77
78
79
80
 
115
116
117
118
 
119
120
 
 
121
122
123
 
 
 
 
 
124
125
126
 
476
477
478
479
480
481
482
483
484
485
 
543
544
545
546
547
 
 
 
 
 
 
 
548
549
550
 
682
683
684
685
 
686
687
688
 
689
690
691
692
 
 
 
693
694
695
696
 
 
 
697
698
699
 
700
701
 
702
703
704
 
74
75
76
 
77
78
79
 
114
115
116
 
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
 
482
483
484
 
 
 
 
485
486
487
 
545
546
547
 
 
548
549
550
551
552
553
554
555
556
557
 
689
690
691
 
692
693
694
 
695
696
697
 
 
698
699
700
701
702
 
 
703
704
705
706
707
 
708
709
 
710
711
712
713
@@ -74,7 +74,6 @@
  def get_body(self):   """ Initialize the Dialog. """   self.grep_cmenu = self.grep_context_menu() - self.ann_cmenu = self.annotate_context_menu()   self.changedesc = {}   self.newpagecount = 1   vbox = gtk.VBox() @@ -115,12 +114,19 @@
  _menu.show_all()   return _menu   - def annotate_context_menu(self): + def annotate_context_menu(self, opts):   _menu = gtk.Menu()   _menu.append(create_menu(_('di_splay change'), self._cmenu_display)) + _menu.append(create_menu(_('_annotate parent'), + self._annotate_parent, opts))   _menu.show_all()   return _menu   + def _annotate_parent(self, menuitem, objs): + if not self.currev: + return + self.trigger_annotate(self.currev, objs) +   def _cmenu_display(self, menuitem):   from changeset import ChangeSet   statopts = {'rev' : [self.currev] } @@ -476,10 +482,6 @@
  treeview.get_selection().set_mode(gtk.SELECTION_SINGLE)   treeview.set_property('fixed-height-mode', True)   treeview.set_border_width(0) - treeview.connect("cursor-changed", self._ann_selection_changed) - treeview.connect('button-release-event', self._ann_button_release) - treeview.connect('popup-menu', self._ann_popup_menu) - treeview.connect('row-activated', self._ann_row_act)     results = gtk.ListStore(str, str, str, str, str, str, str)   treeview.set_model(results) @@ -543,8 +545,13 @@
  objs = (frame, treeview.get_model(), path)   graphview.treeview.connect('row-activated', self.log_activate, objs)   graphview.treeview.connect('button-release-event', - self._ann_button_release) - graphview.treeview.connect('popup-menu', self._ann_popup_menu) + self._ann_button_release, objs) + graphview.treeview.connect('popup-menu', self._ann_popup_menu, objs) + + treeview.connect("cursor-changed", self._ann_selection_changed) + treeview.connect('button-release-event', self._ann_button_release, objs) + treeview.connect('popup-menu', self._ann_popup_menu, objs) + treeview.connect('row-activated', self._ann_row_act, objs)     def search_in_file(self, model, column, key, iter):   """Searches all fields shown in the tree when the user hits crtr+f, @@ -682,23 +689,25 @@
  self.path = model.path   self.stbar.set_status_text(model[anniter][self.COL_TOOLTIP])   - def _ann_button_release(self, widget, event): + def _ann_button_release(self, widget, event, objs):   if event.button == 3 and not (event.state & (gtk.gdk.SHIFT_MASK |   gtk.gdk.CONTROL_MASK)): - self._ann_popup_menu(widget, event.button, event.time) + self._ann_popup_menu(widget, event.button, event.time, objs)   return False   - def _ann_popup_menu(self, treeview, button=0, time=0): - self.ann_cmenu.popup(None, None, None, button, time) + def _ann_popup_menu(self, treeview, button, time, objs): + ann_cmenu = self.annotate_context_menu(objs) + ann_cmenu.popup(None, None, None, button, time)   return True   - def _ann_row_act(self, tree, path, column): - self.ann_cmenu.get_children()[0].activate() + def _ann_row_act(self, tree, path, column, objs): + ann_cmenu = self.annotate_context_menu(objs) + ann_cmenu.get_children()[0].activate()     -def create_menu(label, callback): +def create_menu(label, callback, *args):   menuitem = gtk.MenuItem(label, True) - menuitem.connect('activate', callback) + menuitem.connect('activate', callback, *args)   menuitem.set_border_width(1)   return menuitem