/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: Adrian Wilkins
  • Date: 2008-04-24 15:26:14 UTC
  • mto: This revision was merged to the branch mainline in revision 470.
  • Revision ID: adrian.wilkins@gmail.com-20080424152614-2rnnljbro6vzqvf7
Detect the reserved null: revision in appropriate places. 

This removes a huge shower of stack traces that get dumped to console when 
you look at the bottom of a log.

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
27
    def __init__(self, wt, wtpath, revision=None):
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
 
 
 
34
        
38
35
        if revision is None:
39
36
            revision = self.wt.branch.last_revision()
40
37
            
45
42
 
46
43
    def _create(self):
47
44
        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)
 
45
        scrolledwindow = gtk.ScrolledWindow()
 
46
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
52
47
        self.treeview = gtk.TreeView()
53
 
        sw.add(self.treeview)
54
 
        self.vbox.pack_start(sw, True, True)
 
48
        scrolledwindow.add(self.treeview)
 
49
        self.vbox.pack_start(scrolledwindow, True, True)
55
50
        self.vbox.show_all()
56
51
 
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
52
    def row_diff(self, tv, path, tvc):
65
53
        file = self.model[path][1]
66
54
        if file is None:
71
59
        window.set_file(file)
72
60
        window.show()
73
61
 
74
 
 
75
62
    def _generate_status(self):
76
63
        """ Generate 'bzr status' output. """
77
64
        self.model = gtk.TreeStore(str, str)
92
79
        
93
80
        if len(delta.added):
94
81
            changes = True
95
 
            titer = self.model.append(None, [ _i18n('Added'), None ])
 
82
            titer = self.model.append(None, [ _('Added'), None ])
96
83
            for path, id, kind in delta.added:
97
84
                self.model.append(titer, [ path, path ])
98
85
 
99
86
        if len(delta.removed):
100
87
            changes = True
101
 
            titer = self.model.append(None, [ _i18n('Removed'), None ])
 
88
            titer = self.model.append(None, [ _('Removed'), None ])
102
89
            for path, id, kind in delta.removed:
103
90
                self.model.append(titer, [ path, path ])
104
91
 
105
92
        if len(delta.renamed):
106
93
            changes = True
107
 
            titer = self.model.append(None, [ _i18n('Renamed'), None ])
 
94
            titer = self.model.append(None, [ _('Renamed'), None ])
108
95
            for oldpath, newpath, id, kind, text_modified, meta_modified \
109
96
                    in delta.renamed:
110
97
                self.model.append(titer, [ oldpath, newpath ])
111
98
 
112
99
        if len(delta.modified):
113
100
            changes = True
114
 
            titer = self.model.append(None, [ _i18n('Modified'), None ])
 
101
            titer = self.model.append(None, [ _('Modified'), None ])
115
102
            for path, id, kind, text_modified, meta_modified in delta.modified:
116
103
                self.model.append(titer, [ path, path ])
117
104
        
119
106
        for path in self.wt.unknowns():
120
107
            changes = True
121
108
            if not done_unknown:
122
 
                titer = self.model.append(None, [ _i18n('Unknown'), None ])
 
109
                titer = self.model.append(None, [ _('Unknown'), None ])
123
110
                done_unknown = True
124
111
            self.model.append(titer, [ path, path ])
125
112
 
126
113
        if not changes:
127
 
            self.model.append(None, [ _i18n('No changes.'), None ])
 
114
            self.model.append(None, [ _('No changes.'), None ])
128
115
 
129
116
        self.treeview.expand_all()
130
117