33
32
from dialog import error_dialog
35
34
from history import UrlHistory
36
from olive import Preferences
38
36
class CheckoutDialog(gtk.Dialog):
39
37
""" New implementation of the Checkout dialog. """
40
def __init__(self, path=None, parent=None, remote_path=None):
38
def __init__(self, path=None, parent=None):
41
39
""" Initialize the Checkout dialog. """
42
40
gtk.Dialog.__init__(self, title="Checkout - Olive",
50
48
# Create the widgets
51
self._button_checkout = gtk.Button(_i18n("Check_out"), use_underline=True)
49
self._button_checkout = gtk.Button(_("Check_out"), use_underline=True)
52
50
self._button_revision = gtk.Button('')
53
51
self._image_browse = gtk.Image()
54
self._filechooser = gtk.FileChooserButton(_i18n("Please select a folder"))
52
self._filechooser = gtk.FileChooserButton(_("Please select a folder"))
55
53
self._combo = gtk.ComboBoxEntry()
56
self._label_location = gtk.Label(_i18n("Branch location:"))
57
self._label_destination = gtk.Label(_i18n("Destination:"))
58
self._label_nick = gtk.Label(_i18n("Branck nick:"))
59
self._label_revision = gtk.Label(_i18n("Revision:"))
54
self._label_location = gtk.Label(_("Branch location:"))
55
self._label_destination = gtk.Label(_("Destination:"))
56
self._label_nick = gtk.Label(_("Branck nick:"))
57
self._label_revision = gtk.Label(_("Revision:"))
60
58
self._hbox_revision = gtk.HBox()
61
59
self._entry_revision = gtk.Entry()
62
60
self._entry_nick = gtk.Entry()
63
self._check_lightweight = gtk.CheckButton(_i18n("_Lightweight checkout"),
61
self._check_lightweight = gtk.CheckButton(_("_Lightweight checkout"),
64
62
use_underline=True)
67
65
self._button_checkout.connect('clicked', self._on_checkout_clicked)
68
66
self._button_revision.connect('clicked', self._on_revision_clicked)
69
self._combo.child.connect('focus-out-event', self._on_combo_changed)
67
self._combo.connect('changed', self._on_combo_changed)
71
69
# Create the table and pack the widgets into it
72
70
self._table = gtk.Table(rows=3, columns=2)
94
92
self.vbox.set_spacing(3)
95
93
if self.path is not None:
96
94
self._filechooser.set_filename(self.path)
97
if remote_path is not None:
98
self._combo.child.set_text(remote_path)
100
96
# Pack some widgets
101
97
self._hbox_revision.pack_start(self._entry_revision, True, True)
113
109
def _build_history(self):
114
110
""" Build up the checkout history. """
115
111
self._combo_model = gtk.ListStore(str)
117
112
for item in self._history.get_entries():
118
113
self._combo_model.append([ item ])
121
for item in pref.get_bookmarks():
122
self._combo_model.append([ item ])
124
114
self._combo.set_model(self._combo_model)
125
115
self._combo.set_text_column(0)
161
151
""" Checkout button clicked handler. """
162
152
location = self._combo.get_child().get_text()
163
153
if location is '':
164
error_dialog(_i18n('Missing branch location'),
165
_i18n('You must specify a branch location.'))
154
error_dialog(_('Missing branch location'),
155
_('You must specify a branch location.'))
168
158
destination = self._filechooser.get_filename()
190
180
self.response(gtk.RESPONSE_OK)
192
def _on_combo_changed(self, widget, event):
182
def _on_combo_changed(self, widget):
193
183
""" We try to get the last revision if focus lost. """
194
184
rev = self._get_last_revno()
196
self._entry_revision.set_text(_i18n('N/A'))
186
self._entry_revision.set_text(_('N/A'))
197
187
self._button_revision.set_sensitive(False)
199
189
self._entry_revision.set_text(str(rev))