14
14
# along with this program; if not, write to the Free Software
15
15
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
19
pygtk.require("2.0")
30
30
from bzrlib import errors, osutils
31
31
from bzrlib.trace import mutter
32
32
from bzrlib.util import bencode
34
from bzrlib.plugins.gtk import _i18n
35
from bzrlib.plugins.gtk.dialog import question_dialog
36
from bzrlib.plugins.gtk.errors import show_bzr_error
34
from dialog import error_dialog, question_dialog
35
from errors import show_bzr_error
164
164
store = self._files_store
165
165
self._treeview_files.set_model(None)
167
added = _i18n('added')
168
removed = _i18n('removed')
169
renamed = _i18n('renamed')
170
renamed_and_modified = _i18n('renamed and modified')
171
modified = _i18n('modified')
172
kind_changed = _i18n('kind changed')
168
removed = _('removed')
169
renamed = _('renamed')
170
renamed_and_modified = _('renamed and modified')
171
modified = _('modified')
172
kind_changed = _('kind changed')
174
174
# The store holds:
175
175
# [file_id, real path, checkbox, display path, changes type, message]
257
257
self._enable_per_file_commits = True
258
258
if not self._enable_per_file_commits:
259
259
self._file_message_expander.hide()
260
self._global_message_label.set_markup(_i18n('<b>Commit Message</b>'))
260
self._global_message_label.set_markup(_('<b>Commit Message</b>'))
262
262
def _compute_delta(self):
263
263
self._delta = self._wt.changes_from(self._basis_tree)
302
302
gtk.gdk.CONTROL_MASK, 0, self._on_accel_next)
303
303
self.add_accel_group(group)
305
# ignore the escape key (avoid closing the window)
306
self.connect_object('close', self.emit_stop_by_name, 'close')
308
305
def _construct_left_pane(self):
309
306
self._left_pane_box = gtk.VBox(homogeneous=False, spacing=5)
310
307
self._construct_file_list()
311
308
self._construct_pending_list()
313
self._check_local = gtk.CheckButton(_i18n("_Only commit locally"),
310
self._check_local = gtk.CheckButton(_("_Only commit locally"),
314
311
use_underline=True)
315
312
self._left_pane_box.pack_end(self._check_local, False, False)
316
313
self._check_local.set_active(False)
337
334
self._hpane.pack2(self._right_pane_table, resize=True, shrink=True)
339
336
def _construct_action_pane(self):
340
self._button_commit = gtk.Button(_i18n("Comm_it"), use_underline=True)
337
self._button_commit = gtk.Button(_("Comm_it"), use_underline=True)
341
338
self._button_commit.connect('clicked', self._on_commit_clicked)
342
339
self._button_commit.set_flags(gtk.CAN_DEFAULT)
343
340
self._button_commit.show()
364
361
def _construct_file_list(self):
365
362
self._files_box = gtk.VBox(homogeneous=False, spacing=0)
366
file_label = gtk.Label(_i18n('Files'))
363
file_label = gtk.Label(_('Files'))
367
364
# file_label.show()
368
365
self._files_box.pack_start(file_label, expand=False)
370
367
self._commit_all_files_radio = gtk.RadioButton(
371
None, _i18n("Commit all changes"))
368
None, _("Commit all changes"))
372
369
self._files_box.pack_start(self._commit_all_files_radio, expand=False)
373
370
self._commit_all_files_radio.show()
374
371
self._commit_all_files_radio.connect('toggled',
375
372
self._toggle_commit_selection)
376
373
self._commit_selected_radio = gtk.RadioButton(
377
self._commit_all_files_radio, _i18n("Only commit selected changes"))
374
self._commit_all_files_radio, _("Only commit selected changes"))
378
375
self._files_box.pack_start(self._commit_selected_radio, expand=False)
379
376
self._commit_selected_radio.show()
380
377
self._commit_selected_radio.connect('toggled',
381
378
self._toggle_commit_selection)
382
379
if self._pending:
383
self._commit_all_files_radio.set_label(_i18n('Commit all changes*'))
380
self._commit_all_files_radio.set_label(_('Commit all changes*'))
384
381
self._commit_all_files_radio.set_sensitive(False)
385
382
self._commit_selected_radio.set_sensitive(False)
413
410
crt.set_property('activatable', not bool(self._pending))
414
411
crt.connect("toggled", self._toggle_commit, self._files_store)
415
412
if self._pending:
416
name = _i18n('Commit*')
418
name = _i18n('Commit')
419
416
commit_col = gtk.TreeViewColumn(name, crt, active=2)
420
417
commit_col.set_visible(False)
421
418
self._treeview_files.append_column(commit_col)
422
self._treeview_files.append_column(gtk.TreeViewColumn(_i18n('Path'),
419
self._treeview_files.append_column(gtk.TreeViewColumn(_('Path'),
423
420
gtk.CellRendererText(), text=3))
424
self._treeview_files.append_column(gtk.TreeViewColumn(_i18n('Type'),
421
self._treeview_files.append_column(gtk.TreeViewColumn(_('Type'),
425
422
gtk.CellRendererText(), text=4))
426
423
self._treeview_files.connect('cursor-changed',
427
424
self._on_treeview_files_cursor_changed)
455
452
pending_message = gtk.Label()
456
453
pending_message.set_markup(
457
_i18n('<i>* Cannot select specific files when merging</i>'))
454
_('<i>* Cannot select specific files when merging</i>'))
458
455
self._pending_box.pack_start(pending_message, expand=False, padding=5)
459
456
pending_message.show()
461
pending_label = gtk.Label(_i18n('Pending Revisions'))
458
pending_label = gtk.Label(_('Pending Revisions'))
462
459
self._pending_box.pack_start(pending_label, expand=False, padding=0)
463
460
pending_label.show()
481
478
self._pending_store = liststore
482
479
self._treeview_pending.set_model(liststore)
483
self._treeview_pending.append_column(gtk.TreeViewColumn(_i18n('Date'),
480
self._treeview_pending.append_column(gtk.TreeViewColumn(_('Date'),
484
481
gtk.CellRendererText(), text=1))
485
self._treeview_pending.append_column(gtk.TreeViewColumn(_i18n('Committer'),
482
self._treeview_pending.append_column(gtk.TreeViewColumn(_('Committer'),
486
483
gtk.CellRendererText(), text=2))
487
self._treeview_pending.append_column(gtk.TreeViewColumn(_i18n('Summary'),
484
self._treeview_pending.append_column(gtk.TreeViewColumn(_('Summary'),
488
485
gtk.CellRendererText(), text=3))
490
487
def _construct_diff_view(self):
494
491
# decide that we really don't ever want to display it, we should
495
492
# actually remove it, and other references to it, along with the
496
493
# tests that it is set properly.
497
self._diff_label = gtk.Label(_i18n('Diff for whole tree'))
494
self._diff_label = gtk.Label(_('Diff for whole tree'))
498
495
self._diff_label.set_alignment(0, 0)
499
496
self._right_pane_table.set_row_spacing(self._right_pane_table_row, 0)
500
497
self._add_to_right_table(self._diff_label, 1, False)
518
515
self._file_message_text_view.set_accepts_tab(False)
519
516
self._file_message_text_view.show()
521
self._file_message_expander = gtk.Expander(_i18n('File commit message'))
518
self._file_message_expander = gtk.Expander(_('File commit message'))
522
519
self._file_message_expander.set_expanded(True)
523
520
self._file_message_expander.add(scroller)
524
521
self._add_to_right_table(self._file_message_expander, 1, False)
525
522
self._file_message_expander.show()
527
524
def _construct_global_message(self):
528
self._global_message_label = gtk.Label(_i18n('Global Commit Message'))
529
self._global_message_label.set_markup(
530
_i18n('<b>Global Commit Message</b>'))
525
self._global_message_label = gtk.Label(_('Global Commit Message'))
526
self._global_message_label.set_markup(_('<b>Global Commit Message</b>'))
531
527
self._global_message_label.set_alignment(0, 0)
532
528
self._right_pane_table.set_row_spacing(self._right_pane_table_row, 0)
533
529
self._add_to_right_table(self._global_message_label, 1, False)
554
550
if selection is not None:
555
551
path, display_path = model.get(selection, 1, 3)
556
self._diff_label.set_text(_i18n('Diff for ') + display_path)
552
self._diff_label.set_text(_('Diff for ') + display_path)
558
554
self._diff_view.show_diff(None)
600
596
text_buffer = self._file_message_text_view.get_buffer()
601
597
file_id, display_path, message = self._files_store.get(selection, 0, 3, 5)
602
598
if file_id is None: # Whole tree
603
self._file_message_expander.set_label(_i18n('File commit message'))
599
self._file_message_expander.set_label(_('File commit message'))
604
600
self._file_message_expander.set_expanded(False)
605
601
self._file_message_expander.set_sensitive(False)
606
602
text_buffer.set_text('')
607
603
self._last_selected_file = None
609
self._file_message_expander.set_label(_i18n('Commit message for ')
605
self._file_message_expander.set_label(_('Commit message for ')
611
607
self._file_message_expander.set_expanded(True)
612
608
self._file_message_expander.set_sensitive(True)
650
646
message = self._get_global_commit_message()
652
648
if message == '':
653
response = question_dialog(
654
_i18n('Commit with an empty message?'),
655
_i18n('You can describe your commit intent in the message.'),
649
response = self._question_dialog(
650
_('Commit with an empty message?'),
651
_('You can describe your commit intent in the message.'))
657
652
if response == gtk.RESPONSE_NO:
658
653
# Kindly give focus to message area
659
654
self._global_message_text_view.grab_focus()
671
666
# entirely, since there isn't a way for them to add the unknown
672
667
# files at this point.
673
668
for path in self._wt.unknowns():
674
response = question_dialog(
675
_i18n("Commit with unknowns?"),
676
_i18n("Unknown files exist in the working tree. Commit anyway?"),
678
# Doesn't set a parent for the dialog..
669
response = self._question_dialog(
670
_("Commit with unknowns?"),
671
_("Unknown files exist in the working tree. Commit anyway?"))
679
672
if response == gtk.RESPONSE_NO:
692
685
specific_files=specific_files,
693
686
revprops=revprops)
694
687
except errors.PointlessCommit:
695
response = question_dialog(
696
_i18n('Commit with no changes?'),
697
_i18n('There are no changes in the working tree.'
698
' Do you want to commit anyway?'),
688
response = self._question_dialog(
689
_('Commit with no changes?'),
690
_('There are no changes in the working tree.'
691
' Do you want to commit anyway?'))
700
692
if response == gtk.RESPONSE_YES:
701
693
rev_id = self._wt.commit(message,
702
694
allow_pointless=True,