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

status: use handler_(un)block() to prevent churn

Third time is a charm. This is cleaner and faster than the
previous hacks, and should give a nice perf boost in everyday
use.

Changeset 6ae44b229854

Parent 0c567535ab80

by Steve Borho

Changes to one file · Browse files at 6ae44b229854 Showing diff from parent 0c567535ab80 Diff from another changeset...

Change 1 of 7 Show Entire File hggtk/​status.py Stacked
 
266
267
268
269
 
 
 
 
270
271
272
 
351
352
353
354
355
356
 
 
 
357
358
359
 
405
406
407
408
409
410
 
 
 
411
412
413
 
498
499
500
501
502
503
504
505
506
507
508
509
 
600
601
602
603
604
605
606
607
608
 
 
609
610
611
612
613
614
615
616
 
 
617
618
619
620
621
622
 
 
623
624
625
626
627
628
 
 
629
630
631
 
 
 
 
632
633
634
 
859
860
861
862
863
864
865
866
 
905
906
907
908
909
910
911
912
 
266
267
268
 
269
270
271
272
273
274
275
 
354
355
356
 
 
 
357
358
359
360
361
362
 
408
409
410
 
 
 
411
412
413
414
415
416
 
501
502
503
 
 
 
 
 
 
504
505
506
 
597
598
599
 
 
 
 
 
 
600
601
602
603
604
605
606
607
 
 
608
609
610
611
612
 
 
 
613
614
615
616
 
 
 
 
617
618
619
620
 
621
622
623
624
625
626
627
 
852
853
854
 
 
855
856
857
 
896
897
898
 
 
899
900
901
@@ -266,7 +266,10 @@
  self._menus['MU'] = unresolved_menu     # model stores the file list. - self.filemodel = self.newfilemodel() + fm = gtk.ListStore(bool, str, str, str, str, bool) + fm.set_sort_func(1001, self.sort_by_stat) + fm.set_default_sort_func(self.sort_by_stat) + self.filemodel = fm     self.filetree = gtk.TreeView(self.filemodel)   self.filetree.connect('button-press-event', self.tree_button_press) @@ -351,9 +354,9 @@
  self.merge_diff_text.set_wrap_mode(gtk.WRAP_NONE)   self.merge_diff_text.set_editable(False)   self.merge_diff_text.modify_font(self.difffont) - self.filetree.get_selection().set_mode(gtk.SELECTION_SINGLE) - self.filetree.get_selection().connect('changed', - self.merge_sel_changed) + sel = self.filetree.get_selection() + sel = set_mode(gtk.SELECTION_SINGLE) + self.treeselid = sel.connect('changed', self.merge_sel_changed)   scroller.add(self.merge_diff_text)   diff_frame.add(scroller)   else: @@ -405,9 +408,9 @@
  diffcol.add_attribute(cell, 'foreground-set', DM_REJECTED)     difftree.append_column(diffcol) - self.filetree.get_selection().set_mode(gtk.SELECTION_MULTIPLE) - self.filetree.get_selection().connect('changed', - self.tree_sel_changed) + sel = self.filetree.get_selection() + sel.set_mode(gtk.SELECTION_MULTIPLE) + self.treeselid = sel.connect('changed', self.tree_sel_changed)   scroller.add(difftree)   diff_frame.add(scroller)   @@ -498,12 +501,6 @@
    ### End of overrides ###   - def newfilemodel(self): - fm = gtk.ListStore(bool, str, str, str, str, bool) - fm.set_sort_func(1001, self.sort_by_stat) - fm.set_default_sort_func(self.sort_by_stat) - return fm -   def realize_status_settings(self):   self.diffpane.set_position(self.setting_pos)   @@ -600,35 +597,31 @@
    # Load the new data into the tree's model   self.filetree.hide() - - # issue 181 hack, create new model rather than clearing existing model - model = self.newfilemodel() - self.filemodel = model - self.filetree.set_model(model) - selection = self.filetree.get_selection() + selection.handler_block(self.treeselid) + self.filemodel.clear()     for opt, char, changes in ([ct for ct in explicit_changetypes   if self.test_opt(ct[0])] or changetypes):   for wfile in changes:   mst = wfile in ms and ms[wfile].upper() or ""   wfile = util.localpath(wfile) - self.filemodel.append([wfile in recheck, char, - hglib.toutf(wfile), wfile, mst, False]) + model.append([wfile in recheck, char, + hglib.toutf(wfile), wfile, mst, False])     self.auto_check()   - selected = False - self.ready = False - for row in model: + selpath = (0,) + for i, row in enumerate(model):   if row[FM_PATH] in reselect:   selection.select_iter(row.iter) - selected = True - self.ready = True - if not selected: - selection.select_path((0,)) + selpath = (i,) + selection.handler_unblock(self.treeselid)     # clear buffer after a merge commit - if not len(self.filemodel): + if len(model): + selection.unselect_path(selpath) + selection.select_path(selpath) + else:   if self.merging:   self.merge_diff_text.set_buffer(gtk.TextBuffer())   else: @@ -859,8 +852,6 @@
  def merge_sel_changed(self, selection):   'Selected row in file tree activated changed (merge mode)'   # Update the diff text with merge diff to both parents - if not self.ready: - return   model, paths = selection.get_selected_rows()   if not paths:   return @@ -905,8 +896,6 @@
  def tree_sel_changed(self, selection):   'Selected row in file tree activated changed'   # Read this file's diffs into diff model - if not self.ready: - return   model, paths = selection.get_selected_rows()   if not paths:   return