/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 revisionmenu.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:
23
23
 
24
24
import bzrlib
25
25
import gtk
 
26
import gobject
26
27
from bzrlib import (errors, ui)
 
28
from bzrlib.revision import NULL_REVISION
27
29
 
28
30
class RevisionPopupMenu(gtk.Menu):
29
 
    def __init__(self, repository, revids, branch=None):
 
31
 
 
32
    __gsignals__ = {
 
33
            'tag-added': (
 
34
                gobject.SIGNAL_RUN_FIRST,
 
35
                gobject.TYPE_NONE,
 
36
                (gobject.TYPE_STRING, gobject.TYPE_STRING)
 
37
            )
 
38
    }
 
39
 
 
40
    def __init__(self, repository, revids, branch=None, wt=None):
30
41
        super(RevisionPopupMenu, self).__init__()
31
42
        self.branch = branch
32
43
        self.repository = repository
 
44
        self.wt = wt
33
45
        self.revids = revids
34
46
        self.create_items()
35
47
 
36
48
    def create_items(self):
37
49
        if len(self.revids) == 1:
38
 
            item = gtk.MenuItem("View _Diff")
 
50
            item = gtk.MenuItem("View _Changes")
39
51
            item.connect('activate', self.show_diff)
40
52
            self.append(item)
41
53
            self.show_all()
55
67
            # FIXME: self.append(item)
56
68
            self.show_all()
57
69
            
58
 
            self.bzrdir = self.branch.bzrdir
59
 
            self.wt = None
60
 
            try:
61
 
                self.wt = self.bzrdir.open_workingtree()
62
 
            except errors.NoWorkingTree:
63
 
                return False
64
 
            if self.wt :
 
70
            if self.wt:
65
71
                item = gtk.MenuItem("_Revert to this revision")
66
72
                item.connect('activate', self.revert)
67
73
                self.append(item)
75
81
    def show_diff(self, item):
76
82
        from bzrlib.plugins.gtk.diff import DiffWindow
77
83
        window = DiffWindow(parent=self.parent)
78
 
        parentid = self.repository.revision_parents(self.revids[0])[0]
79
 
        (parent_tree, rev_tree) = self.repository.revision_trees(
80
 
            [parentid, self.revids[0]])
 
84
        parentids = self.repository.revision_parents(self.revids[0])
 
85
 
 
86
        if len(parentids) == 0:
 
87
            parentid = NULL_REVISION
 
88
        else:
 
89
            parentid = parentids[0]
 
90
 
 
91
        rev_tree    = self.repository.revision_tree(self.revids[0])
 
92
        parent_tree = self.repository.revision_tree(parentid)
81
93
        window.set_diff(self.revids[0], rev_tree, parent_tree)
82
94
        window.show()
83
95
 
84
96
    def show_push(self, item):
85
97
        from bzrlib.plugins.gtk.push import PushDialog
86
98
        dialog = PushDialog(self.repository, self.revids[0], self.branch)
87
 
        dialog.run()
 
99
        response = dialog.run()
 
100
 
 
101
        if response != gtk.RESPONSE_NONE:
 
102
            dialog.destroy()
88
103
 
89
104
    def show_tag(self, item):
90
105
        from bzrlib.plugins.gtk.tags import AddTagDialog
91
106
        dialog = AddTagDialog(self.repository, self.revids[0], self.branch)
92
107
        response = dialog.run()
 
108
 
93
109
        if response != gtk.RESPONSE_NONE:
94
110
            dialog.hide()
95
111
        
96
112
            if response == gtk.RESPONSE_OK:
97
 
                self.branch.lock_write()
98
 
                self.branch.tags.set_tag(dialog.tagname, dialog._revid)
99
 
                self.branch.unlock()
 
113
                self.emit('tag-added', dialog.tagname, dialog._revid)
100
114
            
101
115
            dialog.destroy()
102
116