/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 21:05:19 UTC
  • mto: (0.12.2 olive)
  • mto: This revision was merged to the branch mainline in revision 83.
  • Revision ID: jelmer@samba.org-20060927210519-7bc2662211808af5
Bunch of other small updates, add more items to 
the TODO list.

Show diffs side-by-side

added added

removed removed

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