42
41
from bzrlib.ui import ui_factory
43
42
from bzrlib.workingtree import WorkingTree
44
from bzrlib.plugins.gtk import _i18n
45
45
from bzrlib.plugins.gtk.dialog import error_dialog, info_dialog, warning_dialog
46
46
from bzrlib.plugins.gtk.errors import show_bzr_error
47
47
from guifiles import GLADEFILENAME
71
71
dialog.set_version(__version__)
72
dialog.set_authors([ _("Lead Developer:"),
72
dialog.set_authors([ _i18n("Lead Developer:"),
73
73
"Szilveszter Farkas <szilveszter.farkas@gmail.com>",
74
_i18n("Contributors:"),
75
75
"Jelmer Vernooij <jelmer@samba.org>",
76
76
"Mateusz Korniak <mateusz.korniak@ant.gliwice.pl>",
77
77
"Gary van der Merwe <garyvdm@gmail.com>" ])
447
447
def on_entry_history_revno_key_press_event(self, widget, event):
448
448
""" Key pressed handler for the history entry. """
449
if event.keyval == 65293:
449
if event.keyval == gtk.gdk.keyval_from_name('Return') or event.keyval == gtk.gdk.keyval_from_name('KP_Enter'):
450
450
# Return was hit, so we have to load that specific revision
451
451
# Emulate being remote, so inventory should be used
452
452
path = self.get_path()
462
462
def on_entry_location_key_press_event(self, widget, event):
463
463
""" Key pressed handler for the location entry. """
464
if event.keyval == 65293:
464
if event.keyval == gtk.gdk.keyval_from_name('Return') or event.keyval == gtk.gdk.keyval_from_name('KP_Enter'):
465
465
# Return was hit, so we have to jump
466
466
self.on_button_location_jump_clicked(widget)
537
537
from bzrlib.plugins.gtk.merge import MergeDialog
539
539
if self.check_for_changes():
540
error_dialog(_('There are local changes in the branch'),
541
_('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.'))
543
543
parent_branch_path = self.wt.branch.get_parent()
544
544
merge = MergeDialog(self.wt, self.wtpath,default_branch_path=parent_branch_path )
553
553
local_branch = self.wt.branch
554
554
parent_branch_path = local_branch.get_parent()
555
555
if parent_branch_path is None:
556
error_dialog(_('Parent location is unknown'),
557
_('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.'))
560
560
parent_branch = Branch.open(parent_branch_path)
579
dlg_txt += _('%d local extra revision(s). \n') % (len(local_extra),)
579
dlg_txt += _i18n('%d local extra revision(s). \n') % (len(local_extra),)
580
580
## NOTE: We do not want such ugly info about missing revisions
581
581
## Revision Browser should be used there
582
582
## max_revisions = 10
583
583
## for log_revision in iter_log_revisions(local_extra, local_branch.repository, verbose=1):
584
584
## dlg_txt += log_revision_one_line_text(log_revision)
585
585
## if max_revisions <= 0:
586
## dlg_txt += _("more ... \n")
586
## dlg_txt += _i18n("more ... \n")
588
588
## max_revisions -= 1
589
589
## dlg_txt += "\n"
591
dlg_txt += _('%d local missing revision(s).\n') % (len(remote_extra),)
591
dlg_txt += _i18n('%d local missing revision(s).\n') % (len(remote_extra),)
592
592
## max_revisions = 10
593
593
## for log_revision in iter_log_revisions(remote_extra, parent_branch.repository, verbose=1):
594
594
## dlg_txt += log_revision_one_line_text(log_revision)
595
595
## if max_revisions <= 0:
596
## dlg_txt += _("more ... \n")
596
## dlg_txt += _i18n("more ... \n")
598
598
## max_revisions -= 1
600
info_dialog(_('There are missing revisions'),
600
info_dialog(_i18n('There are missing revisions'),
603
info_dialog(_('Local branch up to date'),
604
_('There are no missing revisions.'))
603
info_dialog(_i18n('Local branch up to date'),
604
_i18n('There are no missing revisions.'))
607
607
def on_menuitem_branch_pull_activate(self, widget):
611
611
location = branch_to.get_parent()
612
612
if location is None:
613
error_dialog(_('Parent location is unknown'),
614
_('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.'))
617
617
branch_from = Branch.open(location)
622
622
ret = branch_to.pull(branch_from)
624
info_dialog(_('Pull successful'), _('%d revision(s) pulled.') % ret)
624
info_dialog(_i18n('Pull successful'), _i18n('%d revision(s) pulled.') % ret)
627
627
def on_menuitem_branch_update_activate(self, widget):
630
630
ret = self.wt.update()
631
631
conflicts = self.wt.conflicts()
633
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),) )
635
info_dialog(_('Update successful'), _('No conflicts generated.') )
635
info_dialog(_i18n('Update successful'), _i18n('No conflicts generated.') )
637
637
def on_menuitem_branch_push_activate(self, widget):
638
638
""" Branch/Push... menu handler. """
646
646
""" Branch/Revert all changes menu handler. """
647
647
ret = self.wt.revert([])
649
warning_dialog(_('Conflicts detected'),
650
_('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.'))
652
info_dialog(_('Revert successful'),
653
_('All files reverted to last revision.'))
652
info_dialog(_i18n('Revert successful'),
653
_i18n('All files reverted to last revision.'))
654
654
self.refresh_right()
656
656
def on_menuitem_branch_status_activate(self, widget):
685
685
def on_menuitem_file_annotate_activate(self, widget):
686
686
""" File/Annotate... menu handler. """
687
687
if self.get_selected_right() is None:
688
error_dialog(_('No file was selected'),
689
_('Please select a file from the list.'))
688
error_dialog(_i18n('No file was selected'),
689
_i18n('Please select a file from the list.'))
692
692
branch = self.wt.branch
705
705
def on_menuitem_file_bookmark_activate(self, widget):
706
706
""" File/Bookmark current directory menu handler. """
707
707
if self.pref.add_bookmark(self.path):
708
info_dialog(_('Bookmark successfully added'),
709
_('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.'))
710
710
self.pref.write()
712
warning_dialog(_('Location already bookmarked'),
713
_('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.'))
715
715
self.refresh_left()
940
940
bookmarks = self.pref.get_bookmarks()
942
942
# Add them to the TreeStore
943
titer = treestore.append(None, [_('Bookmarks'), None])
943
titer = treestore.append(None, [_i18n('Bookmarks'), None])
944
944
for item in bookmarks:
945
945
title = self.pref.get_bookmark_title(item)
946
946
treestore.append(titer, [title, item])
948
948
# Create the column and add it to the TreeView
949
949
self.treeview_left.set_model(treestore)
950
tvcolumn_bookmark = gtk.TreeViewColumn(_('Bookmark'))
950
tvcolumn_bookmark = gtk.TreeViewColumn(_i18n('Bookmark'))
951
951
self.treeview_left.append_column(tvcolumn_bookmark)
953
953
# Set up the cells
1047
1047
self.wt.unlock()
1049
1049
if status == 'renamed':
1050
st = _i18n('renamed')
1051
1051
elif status == 'removed':
1052
st = _i18n('removed')
1053
1053
elif status == 'added':
1055
1055
elif status == 'modified':
1056
st = _i18n('modified')
1057
1057
elif status == 'unchanged':
1058
st = _i18n('unchanged')
1059
1059
elif status == 'ignored':
1060
st = _i18n('ignored')
1062
st = _i18n('unknown')
1065
1065
statinfo = os.stat(self.path + os.sep + item)
1082
1082
# Create the columns and add them to the TreeView
1083
1083
self.treeview_right.set_model(liststore)
1084
self._tvcolumn_filename = gtk.TreeViewColumn(_('Filename'))
1085
self._tvcolumn_status = gtk.TreeViewColumn(_('Status'))
1086
self._tvcolumn_size = gtk.TreeViewColumn(_('Size'))
1087
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'))
1088
1088
self.treeview_right.append_column(self._tvcolumn_filename)
1089
1089
self.treeview_right.append_column(self._tvcolumn_status)
1090
1090
self.treeview_right.append_column(self._tvcolumn_size)
1238
1238
bookmarks = self.pref.get_bookmarks()
1240
1240
# Add them to the TreeStore
1241
titer = treestore.append(None, [_('Bookmarks'), None])
1241
titer = treestore.append(None, [_i18n('Bookmarks'), None])
1242
1242
for item in bookmarks:
1243
1243
title = self.pref.get_bookmark_title(item)
1244
1244
treestore.append(titer, [title, item])
1352
1352
self.wt.unlock()
1354
1354
if status == 'renamed':
1355
st = _i18n('renamed')
1356
1356
elif status == 'removed':
1357
st = _i18n('removed')
1358
1358
elif status == 'added':
1360
1360
elif status == 'modified':
1361
st = _i18n('modified')
1362
1362
elif status == 'unchanged':
1363
st = _i18n('unchanged')
1364
1364
elif status == 'ignored':
1365
st = _i18n('ignored')
1366
1366
if not ignored_files:
1369
st = _i18n('unknown')
1372
1372
statinfo = os.stat(self.path + os.sep + item)