41
41
from bzrlib.ui import ui_factory
42
42
from bzrlib.workingtree import WorkingTree
44
from bzrlib.plugins.gtk import _i18n
44
45
from bzrlib.plugins.gtk.dialog import error_dialog, info_dialog, warning_dialog
45
46
from bzrlib.plugins.gtk.errors import show_bzr_error
46
47
from guifiles import GLADEFILENAME
70
71
dialog.set_version(__version__)
71
dialog.set_authors([ _("Lead Developer:"),
72
dialog.set_authors([ _i18n("Lead Developer:"),
72
73
"Szilveszter Farkas <szilveszter.farkas@gmail.com>",
74
_i18n("Contributors:"),
74
75
"Jelmer Vernooij <jelmer@samba.org>",
75
76
"Mateusz Korniak <mateusz.korniak@ant.gliwice.pl>",
76
77
"Gary van der Merwe <garyvdm@gmail.com>" ])
536
537
from bzrlib.plugins.gtk.merge import MergeDialog
538
539
if self.check_for_changes():
539
error_dialog(_('There are local changes in the branch'),
540
_('Please commit or revert the changes before merging.'))
540
error_dialog(_i18n('There are local changes in the branch'),
541
_i18n('Please commit or revert the changes before merging.'))
542
543
parent_branch_path = self.wt.branch.get_parent()
543
544
merge = MergeDialog(self.wt, self.wtpath,default_branch_path=parent_branch_path )
552
553
local_branch = self.wt.branch
553
554
parent_branch_path = local_branch.get_parent()
554
555
if parent_branch_path is None:
555
error_dialog(_('Parent location is unknown'),
556
_('Cannot determine missing revisions if no parent location is known.'))
556
error_dialog(_i18n('Parent location is unknown'),
557
_i18n('Cannot determine missing revisions if no parent location is known.'))
559
560
parent_branch = Branch.open(parent_branch_path)
578
dlg_txt += _('%d local extra revision(s). \n') % (len(local_extra),)
579
dlg_txt += _i18n('%d local extra revision(s). \n') % (len(local_extra),)
579
580
## NOTE: We do not want such ugly info about missing revisions
580
581
## Revision Browser should be used there
581
582
## max_revisions = 10
582
583
## for log_revision in iter_log_revisions(local_extra, local_branch.repository, verbose=1):
583
584
## dlg_txt += log_revision_one_line_text(log_revision)
584
585
## if max_revisions <= 0:
585
## dlg_txt += _("more ... \n")
586
## dlg_txt += _i18n("more ... \n")
587
588
## max_revisions -= 1
588
589
## dlg_txt += "\n"
590
dlg_txt += _('%d local missing revision(s).\n') % (len(remote_extra),)
591
dlg_txt += _i18n('%d local missing revision(s).\n') % (len(remote_extra),)
591
592
## max_revisions = 10
592
593
## for log_revision in iter_log_revisions(remote_extra, parent_branch.repository, verbose=1):
593
594
## dlg_txt += log_revision_one_line_text(log_revision)
594
595
## if max_revisions <= 0:
595
## dlg_txt += _("more ... \n")
596
## dlg_txt += _i18n("more ... \n")
597
598
## max_revisions -= 1
599
info_dialog(_('There are missing revisions'),
600
info_dialog(_i18n('There are missing revisions'),
602
info_dialog(_('Local branch up to date'),
603
_('There are no missing revisions.'))
603
info_dialog(_i18n('Local branch up to date'),
604
_i18n('There are no missing revisions.'))
606
607
def on_menuitem_branch_pull_activate(self, widget):
610
611
location = branch_to.get_parent()
611
612
if location is None:
612
error_dialog(_('Parent location is unknown'),
613
_('Pulling is not possible until there is a parent location.'))
613
error_dialog(_i18n('Parent location is unknown'),
614
_i18n('Pulling is not possible until there is a parent location.'))
616
617
branch_from = Branch.open(location)
621
622
ret = branch_to.pull(branch_from)
623
info_dialog(_('Pull successful'), _('%d revision(s) pulled.') % ret)
624
info_dialog(_i18n('Pull successful'), _i18n('%d revision(s) pulled.') % ret)
626
627
def on_menuitem_branch_update_activate(self, widget):
629
630
ret = self.wt.update()
630
631
conflicts = self.wt.conflicts()
632
info_dialog(_('Update successful but conflicts generated'), _('Number of conflicts generated: %d.') % (len(conflicts),) )
633
info_dialog(_i18n('Update successful but conflicts generated'), _i18n('Number of conflicts generated: %d.') % (len(conflicts),) )
634
info_dialog(_('Update successful'), _('No conflicts generated.') )
635
info_dialog(_i18n('Update successful'), _i18n('No conflicts generated.') )
636
637
def on_menuitem_branch_push_activate(self, widget):
637
638
""" Branch/Push... menu handler. """
645
646
""" Branch/Revert all changes menu handler. """
646
647
ret = self.wt.revert([])
648
warning_dialog(_('Conflicts detected'),
649
_('Please have a look at the working tree before continuing.'))
649
warning_dialog(_i18n('Conflicts detected'),
650
_i18n('Please have a look at the working tree before continuing.'))
651
info_dialog(_('Revert successful'),
652
_('All files reverted to last revision.'))
652
info_dialog(_i18n('Revert successful'),
653
_i18n('All files reverted to last revision.'))
653
654
self.refresh_right()
655
656
def on_menuitem_branch_status_activate(self, widget):
684
685
def on_menuitem_file_annotate_activate(self, widget):
685
686
""" File/Annotate... menu handler. """
686
687
if self.get_selected_right() is None:
687
error_dialog(_('No file was selected'),
688
_('Please select a file from the list.'))
688
error_dialog(_i18n('No file was selected'),
689
_i18n('Please select a file from the list.'))
691
692
branch = self.wt.branch
704
705
def on_menuitem_file_bookmark_activate(self, widget):
705
706
""" File/Bookmark current directory menu handler. """
706
707
if self.pref.add_bookmark(self.path):
707
info_dialog(_('Bookmark successfully added'),
708
_('The current directory was bookmarked. You can reach\nit by selecting it from the left panel.'))
708
info_dialog(_i18n('Bookmark successfully added'),
709
_i18n('The current directory was bookmarked. You can reach\nit by selecting it from the left panel.'))
709
710
self.pref.write()
711
warning_dialog(_('Location already bookmarked'),
712
_('The current directory is already bookmarked.\nSee the left panel for reference.'))
712
warning_dialog(_i18n('Location already bookmarked'),
713
_i18n('The current directory is already bookmarked.\nSee the left panel for reference.'))
714
715
self.refresh_left()
939
940
bookmarks = self.pref.get_bookmarks()
941
942
# Add them to the TreeStore
942
titer = treestore.append(None, [_('Bookmarks'), None])
943
titer = treestore.append(None, [_i18n('Bookmarks'), None])
943
944
for item in bookmarks:
944
945
title = self.pref.get_bookmark_title(item)
945
946
treestore.append(titer, [title, item])
947
948
# Create the column and add it to the TreeView
948
949
self.treeview_left.set_model(treestore)
949
tvcolumn_bookmark = gtk.TreeViewColumn(_('Bookmark'))
950
tvcolumn_bookmark = gtk.TreeViewColumn(_i18n('Bookmark'))
950
951
self.treeview_left.append_column(tvcolumn_bookmark)
952
953
# Set up the cells
1046
1047
self.wt.unlock()
1048
1049
if status == 'renamed':
1050
st = _i18n('renamed')
1050
1051
elif status == 'removed':
1052
st = _i18n('removed')
1052
1053
elif status == 'added':
1054
1055
elif status == 'modified':
1056
st = _i18n('modified')
1056
1057
elif status == 'unchanged':
1058
st = _i18n('unchanged')
1058
1059
elif status == 'ignored':
1060
st = _i18n('ignored')
1062
st = _i18n('unknown')
1064
1065
statinfo = os.stat(self.path + os.sep + item)
1081
1082
# Create the columns and add them to the TreeView
1082
1083
self.treeview_right.set_model(liststore)
1083
self._tvcolumn_filename = gtk.TreeViewColumn(_('Filename'))
1084
self._tvcolumn_status = gtk.TreeViewColumn(_('Status'))
1085
self._tvcolumn_size = gtk.TreeViewColumn(_('Size'))
1086
self._tvcolumn_mtime = gtk.TreeViewColumn(_('Last modified'))
1084
self._tvcolumn_filename = gtk.TreeViewColumn(_i18n('Filename'))
1085
self._tvcolumn_status = gtk.TreeViewColumn(_i18n('Status'))
1086
self._tvcolumn_size = gtk.TreeViewColumn(_i18n('Size'))
1087
self._tvcolumn_mtime = gtk.TreeViewColumn(_i18n('Last modified'))
1087
1088
self.treeview_right.append_column(self._tvcolumn_filename)
1088
1089
self.treeview_right.append_column(self._tvcolumn_status)
1089
1090
self.treeview_right.append_column(self._tvcolumn_size)
1237
1238
bookmarks = self.pref.get_bookmarks()
1239
1240
# Add them to the TreeStore
1240
titer = treestore.append(None, [_('Bookmarks'), None])
1241
titer = treestore.append(None, [_i18n('Bookmarks'), None])
1241
1242
for item in bookmarks:
1242
1243
title = self.pref.get_bookmark_title(item)
1243
1244
treestore.append(titer, [title, item])
1351
1352
self.wt.unlock()
1353
1354
if status == 'renamed':
1355
st = _i18n('renamed')
1355
1356
elif status == 'removed':
1357
st = _i18n('removed')
1357
1358
elif status == 'added':
1359
1360
elif status == 'modified':
1361
st = _i18n('modified')
1361
1362
elif status == 'unchanged':
1363
st = _i18n('unchanged')
1363
1364
elif status == 'ignored':
1365
st = _i18n('ignored')
1365
1366
if not ignored_files:
1369
st = _i18n('unknown')
1371
1372
statinfo = os.stat(self.path + os.sep + item)