/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 olive/status.py

  • Committer: Jelmer Vernooij
  • Date: 2006-09-27 17:56:26 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927175626-4462e9dc20d422b1
Bunch of random cleanups

Show diffs side-by-side

added added

removed removed

Lines of Context:
32
32
import bzrlib
33
33
import bzrlib.errors as errors
34
34
 
35
 
if bzrlib.version_info < (0, 9):
36
 
    # function deprecated after 0.9
37
 
    from bzrlib.delta import compare_trees
38
 
 
39
35
from bzrlib.status import show_tree_status
40
36
from bzrlib.workingtree import WorkingTree
41
37
 
43
39
 
44
40
class OliveStatus:
45
41
    """ Display Status window and perform the needed actions. """
46
 
    def __init__(self, gladefile, comm, dialog):
 
42
    def __init__(self, gladefile, wt, wtpath):
47
43
        """ Initialize the Status window. """
48
44
        self.gladefile = gladefile
49
45
        self.glade = gtk.glade.XML(self.gladefile, 'window_status')
50
46
        
51
 
        # Communication object
52
 
        self.comm = comm
53
 
        # Dialog object
54
 
        self.dialog = dialog
55
 
        
56
47
        # Get the Status window widget
57
48
        self.window = self.glade.get_widget('window_status')
 
49
        self.wt = wt
 
50
        self.wtpath = wtpath
58
51
        
59
52
        # Check if current location is a branch
60
53
        try:
61
 
            (self.wt, path) = WorkingTree.open_containing(self.comm.get_path())
62
 
            branch = self.wt.branch
 
54
            branch = wt.branch
63
55
        except errors.NotBranchError:
64
56
            self.notbranch = True
65
57
            return
66
58
        except:
67
59
            raise
68
60
        
69
 
        file_id = self.wt.path2id(path)
 
61
        file_id = self.wt.path2id(wtpath)
70
62
 
71
63
        self.notbranch = False
72
64
        if file_id is None:
98
90
        column.add_attribute(cell, "text", 0)
99
91
        self.treeview.append_column(column)
100
92
        
101
 
        if bzrlib.version_info < (0, 9):
102
 
            delta = compare_trees(self.old_tree, self.wt)
103
 
        else:
104
 
            delta = self.wt.changes_from(self.old_tree)
 
93
        delta = self.wt.changes_from(self.old_tree)
105
94
 
 
95
        changes = False
 
96
        
106
97
        if len(delta.added):
 
98
            changes = True
107
99
            titer = self.model.append(None, [ _('Added'), None ])
108
100
            for path, id, kind in delta.added:
109
101
                self.model.append(titer, [ path, path ])
110
102
 
111
103
        if len(delta.removed):
 
104
            changes = True
112
105
            titer = self.model.append(None, [ _('Removed'), None ])
113
106
            for path, id, kind in delta.removed:
114
107
                self.model.append(titer, [ path, path ])
115
108
 
116
109
        if len(delta.renamed):
 
110
            changes = True
117
111
            titer = self.model.append(None, [ _('Renamed'), None ])
118
112
            for oldpath, newpath, id, kind, text_modified, meta_modified \
119
113
                    in delta.renamed:
120
114
                self.model.append(titer, [ oldpath, newpath ])
121
115
 
122
116
        if len(delta.modified):
 
117
            changes = True
123
118
            titer = self.model.append(None, [ _('Modified'), None ])
124
119
            for path, id, kind, text_modified, meta_modified in delta.modified:
125
120
                self.model.append(titer, [ path, path ])
126
121
        
127
122
        done_unknown = False
128
123
        for path in self.wt.unknowns():
 
124
            changes = True
129
125
            if not done_unknown:
130
126
                titer = self.model.append(None, [ _('Unknown'), None ])
131
127
                done_unknown = True
132
128
            self.model.append(titer, [ path, path ])
133
129
 
 
130
        if not changes:
 
131
            self.model.append(None, [ _('No changes.'), None ])
 
132
 
134
133
        self.treeview.expand_all()
135
134
    
136
135
    def display(self):
137
136
        """ Display the Diff window. """
138
137
        if self.notbranch:
139
 
            self.dialog.error_dialog(_('Directory is not a branch'),
 
138
            error_dialog(_('Directory is not a branch'),
140
139
                                     _('You can perform this action only in a branch.'))
141
140
            self.close()
142
141
        else: