/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 commit/gcommit.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:
1
 
# Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
2
 
 
3
 
# This program is free software; you can redistribute it and/or modify
4
 
# it under the terms of the GNU General Public License as published by
5
 
# the Free Software Foundation; either version 2 of the License, or
6
 
# (at your option) any later version.
7
 
 
8
 
# This program is distributed in the hope that it will be useful,
9
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 
# GNU General Public License for more details.
12
 
 
13
 
# You should have received a copy of the GNU General Public License
14
 
# along with this program; if not, write to the Free Software
15
 
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
16
 
 
17
 
import pygtk
18
 
pygtk.require("2.0")
19
 
import gobject
20
 
import gtk
21
 
import pango
22
 
from bzrlib.delta import compare_trees
23
 
 
24
 
class GCommitDialog(gtk.Dialog):
25
 
    """ Commit Dialog """
26
 
 
27
 
    def __init__(self, tree):
28
 
        gtk.Dialog.__init__(self)
29
 
 
30
 
        self.set_default_size(400, 400)
31
 
 
32
 
        self.old_tree = tree.branch.repository.revision_tree(tree.branch.last_revision())
33
 
        self.pending_merges = tree.pending_merges()
34
 
        self.delta = compare_trees(self.old_tree, tree)
35
 
 
36
 
        self._create()
37
 
 
38
 
    def _create_file_view(self):
39
 
        self.file_store = gtk.ListStore(gobject.TYPE_BOOLEAN, gobject.TYPE_STRING, gobject.TYPE_STRING)
40
 
        self.file_view = gtk.TreeView(self.file_store)
41
 
        self.file_view.append_column(gtk.TreeViewColumn("Change",gtk.CellRendererToggle(),active=0))
42
 
        self.file_view.append_column(gtk.TreeViewColumn("Path",gtk.CellRendererText(),text=1))
43
 
        self.file_view.append_column(gtk.TreeViewColumn("Type",gtk.CellRendererText(),text=2))
44
 
 
45
 
        for path, id, kind in self.delta.added:
46
 
            self.file_store.append([ True, path, "Added" ])
47
 
 
48
 
        for path, id, kind in self.delta.removed:
49
 
            self.file_store.append([ True, path, "Removed" ])
50
 
 
51
 
        for oldpath, newpath, id, kind, text_modified, meta_modified in self.delta.renamed:
52
 
            self.file_store.append([ True, oldpath, "Renamed"])
53
 
 
54
 
        for path, id, kind, text_modified, meta_modified in self.delta.modified:
55
 
            self.file_store.append([ True, path, "Modified"])
56
 
 
57
 
        self.file_view.show()
58
 
 
59
 
    def _get_specific_files(self):
60
 
        ret = []
61
 
        it = self.file_store.get_iter_first()
62
 
        while it:
63
 
            if self.file_store.get_value(it, 0):
64
 
                ret.append(self.file_store.get_value(it,1))
65
 
            it = self.file_store.iter_next(it)
66
 
 
67
 
        return ret
68
 
 
69
 
    specific_files = property(_get_specific_files)
70
 
 
71
 
    def _create_pending_merge_view(self, merges):
72
 
        self.pending_merge_store = gtk.ListStore(gobject.TYPE_STRING)
73
 
        for revid in merges:
74
 
            self.pending_merge_store.append([revid])
75
 
        self.pending_merge_view = gtk.TreeView(self.pending_merge_store)
76
 
        self.pending_merge_view.show()
77
 
 
78
 
    def _create_message_box(self):
79
 
        self.message_entry = gtk.TextView()
80
 
        self.message_entry.show()
81
 
        return self.message_entry
82
 
 
83
 
    def _get_message(self):
84
 
        buffer = self.message_entry.get_buffer()
85
 
        return buffer.get_text(buffer.get_start_iter(),buffer.get_end_iter())
86
 
 
87
 
    message = property(_get_message)
88
 
 
89
 
    def _create(self):
90
 
        # Show list of changed files with checkboxes
91
 
        self._create_file_view()
92
 
        self.vbox.set_spacing(2)
93
 
        self.vbox.pack_start(self.file_view, expand=True, fill=True)
94
 
 
95
 
        # If_ there are any pending merges, show list of pending merges
96
 
        if self.pending_merges:
97
 
            self._create_pending_merge_view(self.pending_merges)
98
 
            self.vbox.pack_start(self.pending_merge_view, expand=True, fill=True)
99
 
 
100
 
        # Show box where user can add comments
101
 
        self._create_message_box()
102
 
        self.vbox.pack_start(self.message_entry, expand=True, fill=True)
103
 
 
104
 
        # Commit, Cancel buttons
105
 
        self.add_buttons(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL, "_Commit", gtk.RESPONSE_OK)
106