Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

datamine: refactoring codes around ListStore

I know column indexes are shared by 2 ListStore structures,
but it should be separated for more explicitness.

Changeset ba10c2ef3f59

Parent 83671f7ed24b

by Yuki KODAMA

Changes to one file · Browse files at ba10c2ef3f59 Showing diff from parent 83671f7ed24b Diff from another changeset...

 
24
25
26
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
28
29
30
31
32
33
34
35
36
37
 
340
341
342
343
344
345
 
 
 
346
347
348
 
355
356
357
358
 
359
360
361
 
397
398
399
400
 
401
402
403
 
493
494
495
496
497
498
 
 
 
499
500
501
 
614
615
616
617
618
619
620
621
 
 
 
 
 
622
623
624
 
629
630
631
632
 
633
634
635
636
637
638
 
639
640
641
 
684
685
686
687
 
688
689
690
 
806
807
808
809
 
810
811
 
812
813
814
 
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
 
 
 
 
 
 
 
43
44
45
 
348
349
350
 
 
 
351
352
353
354
355
356
 
363
364
365
 
366
367
368
369
 
405
406
407
 
408
409
410
411
 
501
502
503
 
 
 
504
505
506
507
508
509
 
622
623
624
 
 
 
 
 
625
626
627
628
629
630
631
632
 
637
638
639
 
640
641
642
643
644
645
 
646
647
648
649
 
692
693
694
 
695
696
697
698
 
814
815
816
 
817
818
 
819
820
821
822
@@ -24,14 +24,22 @@
 from tortoisehg.hgtk.logview import treemodel as LogTreeModelModule  from tortoisehg.hgtk import gtklib, gdialog, changeset   +# Column indexes for grep +GCOL_REVID = 0 +GCOL_LINE = 1 # matched line +GCOL_DESC = 2 # summary +GCOL_PATH = 3 + +# Column indexes for annotation +ACOL_REVID = 0 +ACOL_LINE = 1 # file line +ACOL_DESC = 2 # summary +ACOL_PATH = 3 +ACOL_COLOR = 4 +ACOL_USER = 5 +ACOL_LNUM = 6 # line number +  class DataMineDialog(gdialog.GDialog): - COL_REVID = 0 - COL_TEXT = 1 - COL_TOOLTIP = 2 - COL_PATH = 3 - COL_COLOR = 4 - COL_USER = 5 - COL_LINENUM = 6     def get_title(self):   return _('%s - datamine') % self.get_reponame() @@ -340,9 +348,9 @@
  treeview.set_model(results)   treeview.set_search_equal_func(self.search_in_grep)   for title, width, col, emode in ( - (_('Rev'), 10, self.COL_REVID, pango.ELLIPSIZE_NONE), - (_('File'), 25, self.COL_PATH, pango.ELLIPSIZE_START), - (_('Matches'), 80, self.COL_TEXT, pango.ELLIPSIZE_END)): + (_('Rev'), 10, GCOL_REVID, pango.ELLIPSIZE_NONE), + (_('File'), 25, GCOL_PATH, pango.ELLIPSIZE_START), + (_('Matches'), 80, GCOL_LINE, pango.ELLIPSIZE_END)):   cell = gtk.CellRendererText()   cell.set_property('width-chars', width)   cell.set_property('ellipsize', emode) @@ -355,7 +363,7 @@
  column.add_attribute(cell, 'text', col)   treeview.append_column(column)   if hasattr(treeview, 'set_tooltip_column'): - treeview.set_tooltip_column(self.COL_TOOLTIP) + treeview.set_tooltip_column(GCOL_DESC)   scroller = gtk.ScrolledWindow()   scroller.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)   scroller.add(treeview) @@ -397,7 +405,7 @@
  Case insensitive   """   key = key.lower() - for col in (self.COL_PATH, self.COL_TEXT): + for col in (GCOL_PATH, GCOL_LINE):   if key in model.get_value(iter, col).lower():   return False   return True @@ -493,9 +501,9 @@
  model = treeview.get_model()   if path is not None and model is not None:   paths = model.get_iter(path) - self.currev = model[paths][self.COL_REVID] - self.curpath = hglib.fromutf(model[paths][self.COL_PATH]) - self.stbar.set_status_text(hglib.toutf(model[paths][self.COL_TOOLTIP])) + self.currev = model[paths][GCOL_REVID] + self.curpath = hglib.fromutf(model[paths][GCOL_PATH]) + self.stbar.set_status_text(hglib.toutf(model[paths][GCOL_DESC]))     def close_current_page(self):   num = self.notebook.get_current_page() @@ -614,11 +622,11 @@
    context_menu = self.ann_header_context_menu(treeview)   for title, width, col, emode, visible in ( - (_('Line'), 8, self.COL_LINENUM, pango.ELLIPSIZE_NONE, True), - (_('Rev'), 10, self.COL_REVID, pango.ELLIPSIZE_NONE, True), - (_('File'), 15, self.COL_PATH, pango.ELLIPSIZE_START, False), - (_('User'), 15, self.COL_USER, pango.ELLIPSIZE_END, False), - (_('Source'), 80, self.COL_TEXT, pango.ELLIPSIZE_END, True)): + (_('Line'), 8, ACOL_LNUM, pango.ELLIPSIZE_NONE, True), + (_('Rev'), 10, ACOL_REVID, pango.ELLIPSIZE_NONE, True), + (_('File'), 15, ACOL_PATH, pango.ELLIPSIZE_START, False), + (_('User'), 15, ACOL_USER, pango.ELLIPSIZE_END, False), + (_('Source'), 80, ACOL_LINE, pango.ELLIPSIZE_END, True)):   cell = gtk.CellRendererText()   cell.set_property('width-chars', width)   cell.set_property('ellipsize', emode) @@ -629,13 +637,13 @@
  column.set_fixed_width(cell.get_size(treeview)[2])   column.pack_start(cell, expand=True)   column.add_attribute(cell, 'text', col) - column.add_attribute(cell, 'background', self.COL_COLOR) + column.add_attribute(cell, 'background', ACOL_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) + treeview.set_tooltip_column(ACOL_DESC)   results.path = path   results.rev = revid   scroller = gtk.ScrolledWindow() @@ -684,7 +692,7 @@
  Case insensitive   """   key = key.lower() - for col in (self.COL_USER, self.COL_TEXT): + for col in (ACOL_USER, ACOL_LINE):   if key in model.get_value(iter, col).lower():   return False   return True @@ -806,9 +814,9 @@
  model = treeview.get_model()   if path is not None and model is not None:   anniter = model.get_iter(path) - self.currev = model[anniter][self.COL_REVID] + self.currev = model[anniter][ACOL_REVID]   self.path = model.path - self.stbar.set_status_text(model[anniter][self.COL_TOOLTIP]) + self.stbar.set_status_text(model[anniter][ACOL_DESC])     def ann_button_release(self, widget, event, objs):   if event.button == 3 and not (event.state & (gtk.gdk.SHIFT_MASK |