/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-04-06 14:00:46 UTC
  • mfrom: (727 trunk)
  • mto: This revision was merged to the branch mainline in revision 731.
  • Revision ID: jelmer@samba.org-20110406140046-xa42a1ce8a5bgq7p
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
9
9
import gtk
10
10
import gobject
11
11
import pango
12
 
import treemodel
 
12
 
13
13
from bzrlib import ui
14
 
 
15
 
from bzrlib.plugins.gtk.ui import ProgressPanel
16
 
from linegraph import linegraph, same_branch
17
 
from graphcell import CellRendererGraph
18
 
from treemodel import TreeModel
19
14
from bzrlib.revision import NULL_REVISION
 
15
 
20
16
from bzrlib.plugins.gtk import lock
 
17
from bzrlib.plugins.gtk.ui import ProgressPanel
 
18
from bzrlib.plugins.gtk.branchview import treemodel
 
19
from bzrlib.plugins.gtk.branchview.linegraph import linegraph, same_branch
 
20
from bzrlib.plugins.gtk.branchview.graphcell import CellRendererGraph
21
21
 
22
22
 
23
23
class TreeView(gtk.VBox):
232
232
            lock.acquire(self.branch, lock.READ)
233
233
 
234
234
            self.emit('tag-added', tag, revid)
235
 
        
 
235
 
236
236
    def refresh(self):
237
237
        gobject.idle_add(self.populate, self.get_revision())
238
238
 
298
298
                broken_line_length = 32
299
299
            else:
300
300
                broken_line_length = None
301
 
            
 
301
 
302
302
            show_graph = self.graph_column.get_visible()
303
303
 
304
304
            self.branch.lock_read()
310
310
                                                            self.mainline_only,
311
311
                                                            self.progress_bar)
312
312
 
313
 
            self.model = TreeModel(self.branch, linegraphdata)
 
313
            self.model = treemodel.TreeModel(self.branch, linegraphdata)
314
314
            self.graph_cell.columns_len = columns_len
315
315
            width = self.graph_cell.get_size(self.treeview)[2]
316
316
            if width > 500:
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
        # 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)
 
349
 
339
350
        # Fix old PyGTK bug - by JAM
340
351
        set_tooltip = getattr(self.treeview, 'set_tooltip_column', None)
341
352
        if set_tooltip is not None:
411
422
        self.date_column.pack_start(cell, expand=True)
412
423
        self.date_column.add_attribute(cell, "text", treemodel.TIMESTAMP)
413
424
        self.treeview.append_column(self.date_column)
414
 
        
 
425
 
415
426
        return self.treeview
416
 
    
 
427
 
417
428
    def _on_selection_changed(self, treeview):
418
429
        """callback for when the treeview changes."""
419
430
        (path, focus) = treeview.get_cursor()