/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: Vincent Ladeuil
  • Date: 2008-05-05 18:16:46 UTC
  • mto: (487.1.1 gtk)
  • mto: This revision was merged to the branch mainline in revision 490.
  • Revision ID: v.ladeuil+lp@free.fr-20080505181646-n95l8ltw2u6jtr26
Fix bug #187283 fix replacing _() by _i18n().

* genpot.sh 
Remove duplication. Add the ability to specify the genrated pot
file on command-line for debugging purposes.

* po/olive-gtk.pot:
Regenerated.

* __init__.py, branch.py, branchview/treeview.py, checkout.py,
commit.py, conflicts.py, diff.py, errors.py, initialize.py,
merge.py, nautilus-bzr.py, olive/__init__.py, olive/add.py,
olive/bookmark.py, olive/guifiles.py, olive/info.py,
olive/menu.py, olive/mkdir.py, olive/move.py, olive/remove.py,
olive/rename.py, push.py, revbrowser.py, status.py, tags.py:
Replace all calls to _() by calls to _i18n(), the latter being
defined in __init__.py and imported in the other modules from
there. This fix the problem encountered countless times when
running bzr selftest and getting silly error messages about
boolean not being callables.

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 (
25
 
    _i18n,
26
 
    window,
27
 
    )
28
 
 
29
 
 
30
 
class StatusWindow(window.Window):
 
24
from bzrlib.plugins.gtk import _i18n
 
25
 
 
26
 
 
27
class StatusDialog(gtk.Dialog):
31
28
    """ Display Status window and perform the needed actions. """
32
29
    def __init__(self, wt, wtpath, revision=None):
33
30
        """ Initialize the Status window. """
34
 
        super(StatusWindow, self).__init__()
 
31
        super(StatusDialog, self).__init__(flags=gtk.DIALOG_MODAL, buttons=(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT))
35
32
        self.set_title("Working tree changes")
36
33
        self._create()
37
34
        self.wt = wt
38
35
        self.wtpath = wtpath
39
 
 
 
36
        
40
37
        if revision is None:
41
38
            revision = self.wt.branch.last_revision()
42
 
 
 
39
            
43
40
        # Set the old working tree
44
41
        self.old_tree = self.wt.branch.repository.revision_tree(revision)
45
42
        # Generate status output
47
44
 
48
45
    def _create(self):
49
46
        self.set_default_size(400, 300)
50
 
        sw = gtk.ScrolledWindow()
51
 
        sw.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
52
 
        sw.set_shadow_type(gtk.SHADOW_IN)
 
47
        scrolledwindow = gtk.ScrolledWindow()
 
48
        scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
53
49
        self.treeview = gtk.TreeView()
54
 
        sw.add(self.treeview)
55
 
        self.add(sw)
56
 
 
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.show_all()
61
 
 
 
50
        scrolledwindow.add(self.treeview)
 
51
        self.vbox.pack_start(scrolledwindow, True, True)
 
52
        self.vbox.show_all()
62
53
 
63
54
    def row_diff(self, tv, path, tvc):
64
55
        file = self.model[path][1]
66
57
            return
67
58
        from bzrlib.plugins.gtk.diff import DiffWindow
68
59
        window = DiffWindow()
69
 
        window.set_diff("Working tree changes", self.wt, self.old_tree)
 
60
        window.set_diff("Working tree changes", self.old_tree, self.wt)
70
61
        window.set_file(file)
71
62
        window.show()
72
63
 
73
 
 
74
64
    def _generate_status(self):
75
65
        """ Generate 'bzr status' output. """
76
66
        self.model = gtk.TreeStore(str, str)
77
67
        self.treeview.set_headers_visible(False)
78
68
        self.treeview.set_model(self.model)
79
69
        self.treeview.connect("row-activated", self.row_diff)
80
 
 
 
70
        
81
71
        cell = gtk.CellRendererText()
82
72
        cell.set_property("width-chars", 20)
83
73
        column = gtk.TreeViewColumn()
84
74
        column.pack_start(cell, expand=True)
85
75
        column.add_attribute(cell, "text", 0)
86
76
        self.treeview.append_column(column)
87
 
 
 
77
        
88
78
        delta = self.wt.changes_from(self.old_tree)
89
79
 
90
80
        changes = False
91
 
 
 
81
        
92
82
        if len(delta.added):
93
83
            changes = True
94
84
            titer = self.model.append(None, [ _i18n('Added'), None ])
113
103
            titer = self.model.append(None, [ _i18n('Modified'), None ])
114
104
            for path, id, kind, text_modified, meta_modified in delta.modified:
115
105
                self.model.append(titer, [ path, path ])
116
 
 
 
106
        
117
107
        done_unknown = False
118
108
        for path in self.wt.unknowns():
119
109
            changes = True
126
116
            self.model.append(None, [ _i18n('No changes.'), None ])
127
117
 
128
118
        self.treeview.expand_all()
129
 
 
 
119
    
130
120
    def close(self, widget=None):
131
121
        self.window.destroy()