/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: Jelmer Vernooij
  • Date: 2011-03-23 09:49:44 UTC
  • mfrom: (723.1.1 isearch)
  • Revision ID: jelmer@samba.org-20110323094944-7n5h1vif3xpbze3p
Merge support for interactive substring search in bzr viz and annotate.

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