/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/linegraph.py

  • Committer: Jelmer Vernooij
  • Date: 2008-07-01 21:54:21 UTC
  • mfrom: (523.3.2 trunk)
  • Revision ID: jelmer@samba.org-20080701215421-50g2c59zx9vcn7j5
Share code between context and main revision menu.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: UTF-8 -*-
1
2
"""Directed graph production.
2
3
 
3
4
This module contains the code to produce an ordered directed graph of a
5
6
window.
6
7
"""
7
8
 
8
 
__copyright__ = "Copyright 2005 Canonical Ltd."
 
9
__copyright__ = "Copyright © 2005 Canonical Ltd."
9
10
__author__    = "Scott James Remnant <scott@ubuntu.com>"
10
11
 
11
12
from bzrlib.revision import NULL_REVISION
46
47
    def update_root_progress(step_number):
47
48
        """IFF our container received a root progress bar, then update it."""
48
49
        if root_progress is not None:
49
 
            root_progress.update(None, step_number)
 
50
            root_progress.update(None, current_cnt=step_number)
50
51
 
51
52
    graph_parents = {}
52
53
    ghosts = set()
54
55
    update_root_progress(1)
55
56
    progress_bar = ui.ui_factory.nested_progress_bar()
56
57
    try:
57
 
        progress_bar.update("Arranging tree fragments")
 
58
        progress_bar.update(msg="Arranging tree fragments")
58
59
        for i, (revid, parent_revids) in enumerate(graph.iter_ancestry(start_revs)):
59
60
            if i % 25 == 0:
60
61
                progress_bar.tick()
74
75
    update_root_progress(2)
75
76
    progress_bar = ui.ui_factory.nested_progress_bar()
76
77
    try:
77
 
        progress_bar.update("Removing ghosts", 0, len(ghosts))
 
78
        progress_bar.update(msg="Removing ghosts", total_cnt=len(ghosts))
78
79
        for i, ghost in enumerate(ghosts):
79
80
            if i % 25 == 0:
80
 
                progress_bar.update(None, i)
 
81
                progress_bar.update(None, current_cnt=i)
81
82
            for ghost_child in graph_children[ghost]:
82
83
                graph_parents[ghost_child] = [p for p in graph_parents[ghost_child]
83
84
                                              if p not in ghosts]
117
118
    update_root_progress(3)
118
119
    progress_bar = ui.ui_factory.nested_progress_bar()
119
120
    try:
120
 
        progress_bar.update("Finding nodes", 0, len(merge_sorted_revisions))
 
121
        progress_bar.update(msg="Finding nodes", total_cnt=len(merge_sorted_revisions))
121
122
        for (rev_index, (sequence_number,
122
123
                         revid,
123
124
                         merge_depth,
125
126
                         end_of_merge)) in enumerate(merge_sorted_revisions):
126
127
 
127
128
            if rev_index % 25 == 0:
128
 
                progress_bar.update(None, rev_index)
 
129
                progress_bar.update(None, current_cnt=rev_index)
129
130
            if maxnum and rev_index >= maxnum:
130
131
                break
131
132
            revid_index[revid] = rev_index
183
184
        update_root_progress(4)
184
185
        progress_bar = ui.ui_factory.nested_progress_bar()
185
186
        try:
186
 
            progress_bar.update("Organizing edges", 0, len(branch_ids))
 
187
            progress_bar.update(msg="Organizing edges", total_cnt=len(branch_ids))
187
188
            for i, branch_id in enumerate(branch_ids):
188
189
                if i % 25 == 0:
189
 
                    progress_bar.update(None, i)
 
190
                    progress_bar.update(None, current_cnt=i)
190
191
                branch_line = branch_lines[branch_id]
191
192
                
192
193
                # Find the col_index for the direct parent branch. This will be the
313
314
        update_root_progress(5)
314
315
        progress_bar = ui.ui_factory.nested_progress_bar()
315
316
        try:
316
 
            progress_bar.update("Prettifying graph", 0, len(lines))
 
317
            progress_bar.update(msg="Pretifying graph", total_cnt=len(lines))
317
318
            for i, (child_index, parent_index, line_col_indexes) in enumerate(lines):
318
319
                if i % 25 == 0:
319
 
                    progress_bar.update(None, i)
 
320
                    progress_bar.update(None, current_cnt=i)
320
321
                (child_col_index, child_color) = linegraph[child_index][1]
321
322
                (parent_col_index, parent_color) = linegraph[parent_index][1]
322
323