/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 push.py

  • Committer: Jelmer Vernooij
  • Date: 2011-04-10 18:44:39 UTC
  • mto: This revision was merged to the branch mainline in revision 730.
  • Revision ID: jelmer@samba.org-20110410184439-g7hqaacexqtviq13
Move i18n support to a separate file, so gettext files aren't loaded unless bzr-gtk is used.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# along with this program; if not, write to the Free Software
16
16
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17
17
 
18
 
from gi.repository import Gtk
 
18
try:
 
19
    import pygtk
 
20
    pygtk.require("2.0")
 
21
except:
 
22
    pass
 
23
 
 
24
import gtk
19
25
 
20
26
from errors import show_bzr_error
21
27
 
30
36
from bzrlib.plugins.gtk.i18n import _i18n
31
37
 
32
38
 
33
 
class PushDialog(Gtk.Dialog):
 
39
class PushDialog(gtk.Dialog):
34
40
    """New implementation of the Push dialog."""
35
41
 
36
42
    def __init__(self, repository, revid, branch=None, parent=None):
37
43
        """Initialize the Push dialog. """
38
 
        GObject.GObject.__init__(self, title="Push",
 
44
        gtk.Dialog.__init__(self, title="Push",
39
45
                                  parent=parent,
40
46
                                  flags=0,
41
 
                                  buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL))
 
47
                                  buttons=(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL))
42
48
 
43
49
        # Get arguments
44
50
        self.repository = repository
46
52
        self.branch = branch
47
53
 
48
54
        # Create the widgets
49
 
        self._label_location = Gtk.Label(label=_i18n("Location:"))
50
 
        self._combo = Gtk.ComboBoxEntry()
51
 
        self._button_push = Gtk.Button(_i18n("_Push"), use_underline=True)
52
 
        self._hbox_location = Gtk.HBox()
 
55
        self._label_location = gtk.Label(_i18n("Location:"))
 
56
        self._combo = gtk.ComboBoxEntry()
 
57
        self._button_push = gtk.Button(_i18n("_Push"), use_underline=True)
 
58
        self._hbox_location = gtk.HBox()
53
59
 
54
60
        # Set callbacks
55
61
        self._button_push.connect('clicked', self._on_push_clicked)
62
68
        # Pack widgets
63
69
        self._hbox_location.pack_start(self._label_location, False, False)
64
70
        self._hbox_location.pack_start(self._combo, True, True)
65
 
        self.vbox.pack_start(self._hbox_location, True, True, 0)
 
71
        self.vbox.pack_start(self._hbox_location)
66
72
        self.action_area.pack_end(self._button_push)
67
73
 
68
74
        # Show the dialog
74
80
 
75
81
    def _build_history(self):
76
82
        """Build up the location history. """
77
 
        self._combo_model = Gtk.ListStore(str)
 
83
        self._combo_model = gtk.ListStore(str)
78
84
        for item in self._history.get_entries():
79
85
            self._combo_model.append([ item ])
80
86
        self._combo.set_model(self._combo_model)
96
102
        except errors.DivergedBranches:
97
103
            response = question_dialog(_i18n('Branches have been diverged'),
98
104
                                       _i18n('You cannot push if branches have diverged.\nOverwrite?'))
99
 
            if response == Gtk.ResponseType.YES:
 
105
            if response == gtk.RESPONSE_YES:
100
106
                revs = do_push(self.branch, location=location, overwrite=True)
101
107
 
102
108
        if self.branch is not None and self.branch.get_push_location() is None:
106
112
        info_dialog(_i18n('Push successful'),
107
113
                    _i18n("%d revision(s) pushed.") % revs)
108
114
 
109
 
        self.response(Gtk.ResponseType.OK)
 
115
        self.response(gtk.RESPONSE_OK)
110
116
 
111
117
 
112
118
def do_push(br_from, location, overwrite):
137
143
        except errors.NoSuchFile:
138
144
            response = question_dialog(_i18n('Non existing parent directory'),
139
145
                         _i18n("The parent directory (%s)\ndoesn't exist. Create?") % location)
140
 
            if response == Gtk.ResponseType.OK:
 
146
            if response == gtk.RESPONSE_OK:
141
147
                transport.create_prefix()
142
148
            else:
143
149
                return