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

  • Committer: Jelmer Vernooij
  • Date: 2007-02-03 16:04:46 UTC
  • Revision ID: jelmer@samba.org-20070203160446-r7xksl3qe108vhm3
Add gstatus command.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    pass
22
22
 
23
23
import gtk
24
 
from bzrlib.plugins.gtk import _i18n
25
 
 
26
 
 
27
 
class StatusDialog(gtk.Dialog):
 
24
 
 
25
class StatusDialog(gtk.MessageDialog):
28
26
    """ Display Status window and perform the needed actions. """
29
 
    def __init__(self, wt, wtpath, revision=None):
 
27
    def __init__(self, wt, wtpath):
30
28
        """ Initialize the Status window. """
31
 
        super(StatusDialog, self).__init__(flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
 
29
        super(StatusDialog, self).__init__(flags=gtk.DIALOG_MODAL, buttons=gtk.BUTTONS_OK)
32
30
        self.set_title("Working tree changes")
 
31
        self.set_image(gtk.Label("Working tree status"))
33
32
        self._create()
34
33
        self.wt = wt
35
34
        self.wtpath = wtpath
36
 
        
37
 
        if revision is None:
38
 
            revision = self.wt.branch.last_revision()
39
 
            
40
35
        # Set the old working tree
41
 
        self.old_tree = self.wt.branch.repository.revision_tree(revision)
 
36
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
42
37
        # Generate status output
43
38
        self._generate_status()
44
39
 
45
40
    def _create(self):
46
41
        self.set_default_size(400, 300)
47
 
        scrolledwindow = gtk.ScrolledWindow()
48
 
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
49
42
        self.treeview = gtk.TreeView()
50
 
        scrolledwindow.add(self.treeview)
51
 
        self.vbox.pack_start(scrolledwindow, True, True)
 
43
        self.vbox.pack_start(self.treeview, True, True)
52
44
        self.vbox.show_all()
53
45
 
54
46
    def row_diff(self, tv, path, tvc):
81
73
        
82
74
        if len(delta.added):
83
75
            changes = True
84
 
            titer = self.model.append(None, [ _i18n('Added'), None ])
 
76
            titer = self.model.append(None, [ _('Added'), None ])
85
77
            for path, id, kind in delta.added:
86
78
                self.model.append(titer, [ path, path ])
87
79
 
88
80
        if len(delta.removed):
89
81
            changes = True
90
 
            titer = self.model.append(None, [ _i18n('Removed'), None ])
 
82
            titer = self.model.append(None, [ _('Removed'), None ])
91
83
            for path, id, kind in delta.removed:
92
84
                self.model.append(titer, [ path, path ])
93
85
 
94
86
        if len(delta.renamed):
95
87
            changes = True
96
 
            titer = self.model.append(None, [ _i18n('Renamed'), None ])
 
88
            titer = self.model.append(None, [ _('Renamed'), None ])
97
89
            for oldpath, newpath, id, kind, text_modified, meta_modified \
98
90
                    in delta.renamed:
99
91
                self.model.append(titer, [ oldpath, newpath ])
100
92
 
101
93
        if len(delta.modified):
102
94
            changes = True
103
 
            titer = self.model.append(None, [ _i18n('Modified'), None ])
 
95
            titer = self.model.append(None, [ _('Modified'), None ])
104
96
            for path, id, kind, text_modified, meta_modified in delta.modified:
105
97
                self.model.append(titer, [ path, path ])
106
98
        
108
100
        for path in self.wt.unknowns():
109
101
            changes = True
110
102
            if not done_unknown:
111
 
                titer = self.model.append(None, [ _i18n('Unknown'), None ])
 
103
                titer = self.model.append(None, [ _('Unknown'), None ])
112
104
                done_unknown = True
113
105
            self.model.append(titer, [ path, path ])
114
106
 
115
107
        if not changes:
116
 
            self.model.append(None, [ _i18n('No changes.'), None ])
 
108
            self.model.append(None, [ _('No changes.'), None ])
117
109
 
118
110
        self.treeview.expand_all()
119
111
    
 
112
    def display(self):
 
113
        """ Display the Diff window. """
 
114
        self.window.show_all()
 
115
 
120
116
    def close(self, widget=None):
121
117
        self.window.destroy()