/b-gtk/fix-viz

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/b-gtk/fix-viz

« back to all changes in this revision

Viewing changes to branchview/treeview.py

  • Committer: Sergei Golubchik
  • Date: 2011-03-22 19:05:34 UTC
  • mto: This revision was merged to the branch mainline in revision 725.
  • Revision ID: sergii@pisem.net-20110322190534-o0iqbv48823oxfrr
interactive substring search in gannotate
interactive revno/summary search in vizualize

Show diffs side-by-side

added added

removed removed

Lines of Context:
334
334
        self.treeview = gtk.TreeView()
335
335
 
336
336
        self.treeview.set_rules_hint(True)
337
 
        self.treeview.set_search_column(treemodel.REVNO)
338
337
        
 
338
        # combined revno/summary interactive search
 
339
        #
 
340
        # the row in a treemodel is considered "matched" if a REVNO *starts*
 
341
        # from the key (that is the key is found in a REVNO at the offset 0)
 
342
        # or if a MESSAGE *contains* the key anywhere (that is, the key is
 
343
        # found case insensitively in a MESSAGE at any offset)
 
344
        def search_equal_func(model, column, key, iter):
 
345
            return (model.get_value(iter, treemodel.REVNO).find(key) != 0
 
346
                and model.get_value(iter, treemodel.MESSAGE).lower().find(key.lower()) == -1)
 
347
 
 
348
        self.treeview.set_search_equal_func(search_equal_func)
 
349
        self.treeview.set_enable_search(True)
 
350
 
339
351
        # Fix old PyGTK bug - by JAM
340
352
        set_tooltip = getattr(self.treeview, 'set_tooltip_column', None)
341
353
        if set_tooltip is not None: