/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: 2008-06-28 16:59:50 UTC
  • mto: This revision was merged to the branch mainline in revision 516.
  • Revision ID: jelmer@samba.org-20080628165950-18kv7bdykgf1f1jf
Fix import in olive.

Show diffs side-by-side

added added

removed removed

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