/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: 2011-02-18 13:01:03 UTC
  • Revision ID: jelmer@samba.org-20110218130103-fiyk203auk28thpn
Remove some unused imports, fix some formatting.

Show diffs side-by-side

added added

removed removed

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