/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 olive/__init__.py

  • Committer: Vincent Ladeuil
  • Date: 2008-05-05 18:16:46 UTC
  • mto: (487.1.1 gtk)
  • mto: This revision was merged to the branch mainline in revision 490.
  • Revision ID: v.ladeuil+lp@free.fr-20080505181646-n95l8ltw2u6jtr26
Fix bug #187283 fix replacing _() by _i18n().

* genpot.sh 
Remove duplication. Add the ability to specify the genrated pot
file on command-line for debugging purposes.

* po/olive-gtk.pot:
Regenerated.

* __init__.py, branch.py, branchview/treeview.py, checkout.py,
commit.py, conflicts.py, diff.py, errors.py, initialize.py,
merge.py, nautilus-bzr.py, olive/__init__.py, olive/add.py,
olive/bookmark.py, olive/guifiles.py, olive/info.py,
olive/menu.py, olive/mkdir.py, olive/move.py, olive/remove.py,
olive/rename.py, push.py, revbrowser.py, status.py, tags.py:
Replace all calls to _() by calls to _i18n(), the latter being
defined in __init__.py and imported in the other modules from
there. This fix the problem encountered countless times when
running bzr selftest and getting silly error messages about
boolean not being callables.

Show diffs side-by-side

added added

removed removed

Lines of Context:
41
41
from bzrlib.ui import ui_factory
42
42
from bzrlib.workingtree import WorkingTree
43
43
 
 
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
68
69
 
69
70
    # Set version
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>",
73
 
                         _("Contributors:"),
 
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
537
538
        
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.'))
541
542
        else:
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.'))
557
558
            return
558
559
        
559
560
        parent_branch = Branch.open(parent_branch_path)
575
576
            
576
577
            dlg_txt = ""
577
578
            if local_extra:
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")
586
587
                ##        break
587
588
                ## max_revisions -= 1
588
589
            ## dlg_txt += "\n"
589
590
            if remote_extra:
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")
596
597
                ##        break
597
598
                ##    max_revisions -= 1
598
599
                
599
 
            info_dialog(_('There are missing revisions'),
 
600
            info_dialog(_i18n('There are missing revisions'),
600
601
                        dlg_txt)
601
602
        else:
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.'))
604
605
 
605
606
    @show_bzr_error
606
607
    def on_menuitem_branch_pull_activate(self, widget):
609
610
 
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.'))
614
615
            return
615
616
 
616
617
        branch_from = Branch.open(location)
620
621
 
621
622
        ret = branch_to.pull(branch_from)
622
623
        
623
 
        info_dialog(_('Pull successful'), _('%d revision(s) pulled.') % ret)
 
624
        info_dialog(_i18n('Pull successful'), _i18n('%d revision(s) pulled.') % ret)
624
625
        
625
626
    @show_bzr_error
626
627
    def on_menuitem_branch_update_activate(self, widget):
629
630
        ret = self.wt.update()
630
631
        conflicts = self.wt.conflicts()
631
632
        if 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),) )
633
634
        else:
634
 
            info_dialog(_('Update successful'), _('No conflicts generated.') )
 
635
            info_dialog(_i18n('Update successful'), _i18n('No conflicts generated.') )
635
636
    
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([])
647
648
        if ret:
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.'))
650
651
        else:
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()
654
655
    
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.'))
689
690
            return
690
691
        
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()
710
711
        else:
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.'))
713
714
        
714
715
        self.refresh_left()
715
716
    
939
940
        bookmarks = self.pref.get_bookmarks()
940
941
        
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])
946
947
        
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)
951
952
        
952
953
        # Set up the cells
1046
1047
                    self.wt.unlock()
1047
1048
            
1048
1049
            if status == 'renamed':
1049
 
                st = _('renamed')
 
1050
                st = _i18n('renamed')
1050
1051
            elif status == 'removed':
1051
 
                st = _('removed')
 
1052
                st = _i18n('removed')
1052
1053
            elif status == 'added':
1053
 
                st = _('added')
 
1054
                st = _i18n('added')
1054
1055
            elif status == 'modified':
1055
 
                st = _('modified')
 
1056
                st = _i18n('modified')
1056
1057
            elif status == 'unchanged':
1057
 
                st = _('unchanged')
 
1058
                st = _i18n('unchanged')
1058
1059
            elif status == 'ignored':
1059
 
                st = _('ignored')
 
1060
                st = _i18n('ignored')
1060
1061
            else:
1061
 
                st = _('unknown')
 
1062
                st = _i18n('unknown')
1062
1063
            
1063
1064
            try:
1064
1065
                statinfo = os.stat(self.path + os.sep + item)
1080
1081
        
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()
1238
1239
 
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()
1352
1353
                
1353
1354
                if status == 'renamed':
1354
 
                    st = _('renamed')
 
1355
                    st = _i18n('renamed')
1355
1356
                elif status == 'removed':
1356
 
                    st = _('removed')
 
1357
                    st = _i18n('removed')
1357
1358
                elif status == 'added':
1358
 
                    st = _('added')
 
1359
                    st = _i18n('added')
1359
1360
                elif status == 'modified':
1360
 
                    st = _('modified')
 
1361
                    st = _i18n('modified')
1361
1362
                elif status == 'unchanged':
1362
 
                    st = _('unchanged')
 
1363
                    st = _i18n('unchanged')
1363
1364
                elif status == 'ignored':
1364
 
                    st = _('ignored')
 
1365
                    st = _i18n('ignored')
1365
1366
                    if not ignored_files:
1366
1367
                        continue
1367
1368
                else:
1368
 
                    st = _('unknown')
 
1369
                    st = _i18n('unknown')
1369
1370
                
1370
1371
                try:
1371
1372
                    statinfo = os.stat(self.path + os.sep + item)