/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

Add options to viz treeview to not show the line graph, and to only show the main line.
Set the revision browser to use these options.

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
24
 
27
25
class StatusDialog(gtk.Dialog):
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_CLOSE, gtk.RESPONSE_CLOSE))
 
29
        super(StatusDialog, self).__init__(flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
32
30
        self.set_title("Working tree changes")
33
 
        self.set_default_response(gtk.RESPONSE_CLOSE)
34
31
        self._create()
35
32
        self.wt = wt
36
33
        self.wtpath = wtpath
37
 
 
38
 
        if revision is None:
39
 
            revision = self.wt.branch.last_revision()
40
 
            
41
34
        # Set the old working tree
42
 
        self.old_tree = self.wt.branch.repository.revision_tree(revision)
 
35
        self.old_tree = self.wt.branch.repository.revision_tree(self.wt.branch.last_revision())
43
36
        # Generate status output
44
37
        self._generate_status()
45
38
 
46
39
    def _create(self):
47
40
        self.set_default_size(400, 300)
48
 
        self.set_has_separator(False)
49
 
        sw = gtk.ScrolledWindow()
50
 
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
51
 
        sw.set_shadow_type(gtk.SHADOW_IN)
 
41
        scrolledwindow = gtk.ScrolledWindow()
 
42
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
52
43
        self.treeview = gtk.TreeView()
53
 
        sw.add(self.treeview)
54
 
        self.vbox.pack_start(sw, True, True)
 
44
        scrolledwindow.add(self.treeview)
 
45
        self.vbox.pack_start(scrolledwindow, True, True)
55
46
        self.vbox.show_all()
56
47
 
57
 
        # sane border and spacing widths (as recommended by GNOME HIG) 
58
 
        self.set_border_width(5)
59
 
        sw.set_border_width(5)
60
 
        self.vbox.set_spacing(2)
61
 
        self.action_area.set_border_width(5)
62
 
 
63
 
 
64
48
    def row_diff(self, tv, path, tvc):
65
49
        file = self.model[path][1]
66
50
        if file is None:
71
55
        window.set_file(file)
72
56
        window.show()
73
57
 
74
 
 
75
58
    def _generate_status(self):
76
59
        """ Generate 'bzr status' output. """
77
60
        self.model = gtk.TreeStore(str, str)
92
75
        
93
76
        if len(delta.added):
94
77
            changes = True
95
 
            titer = self.model.append(None, [ _i18n('Added'), None ])
 
78
            titer = self.model.append(None, [ _('Added'), None ])
96
79
            for path, id, kind in delta.added:
97
80
                self.model.append(titer, [ path, path ])
98
81
 
99
82
        if len(delta.removed):
100
83
            changes = True
101
 
            titer = self.model.append(None, [ _i18n('Removed'), None ])
 
84
            titer = self.model.append(None, [ _('Removed'), None ])
102
85
            for path, id, kind in delta.removed:
103
86
                self.model.append(titer, [ path, path ])
104
87
 
105
88
        if len(delta.renamed):
106
89
            changes = True
107
 
            titer = self.model.append(None, [ _i18n('Renamed'), None ])
 
90
            titer = self.model.append(None, [ _('Renamed'), None ])
108
91
            for oldpath, newpath, id, kind, text_modified, meta_modified \
109
92
                    in delta.renamed:
110
93
                self.model.append(titer, [ oldpath, newpath ])
111
94
 
112
95
        if len(delta.modified):
113
96
            changes = True
114
 
            titer = self.model.append(None, [ _i18n('Modified'), None ])
 
97
            titer = self.model.append(None, [ _('Modified'), None ])
115
98
            for path, id, kind, text_modified, meta_modified in delta.modified:
116
99
                self.model.append(titer, [ path, path ])
117
100
        
119
102
        for path in self.wt.unknowns():
120
103
            changes = True
121
104
            if not done_unknown:
122
 
                titer = self.model.append(None, [ _i18n('Unknown'), None ])
 
105
                titer = self.model.append(None, [ _('Unknown'), None ])
123
106
                done_unknown = True
124
107
            self.model.append(titer, [ path, path ])
125
108
 
126
109
        if not changes:
127
 
            self.model.append(None, [ _i18n('No changes.'), None ])
 
110
            self.model.append(None, [ _('No changes.'), None ])
128
111
 
129
112
        self.treeview.expand_all()
130
113