/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 commit.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:
31
31
from bzrlib.trace import mutter
32
32
from bzrlib.util import bencode
33
33
 
 
34
from bzrlib.plugins.gtk import _i18n
34
35
from dialog import error_dialog, question_dialog
35
36
from errors import show_bzr_error
36
37
 
164
165
        store = self._files_store
165
166
        self._treeview_files.set_model(None)
166
167
 
167
 
        added = _('added')
168
 
        removed = _('removed')
169
 
        renamed = _('renamed')
170
 
        renamed_and_modified = _('renamed and modified')
171
 
        modified = _('modified')
172
 
        kind_changed = _('kind changed')
 
168
        added = _i18n('added')
 
169
        removed = _i18n('removed')
 
170
        renamed = _i18n('renamed')
 
171
        renamed_and_modified = _i18n('renamed and modified')
 
172
        modified = _i18n('modified')
 
173
        kind_changed = _i18n('kind changed')
173
174
 
174
175
        # The store holds:
175
176
        # [file_id, real path, checkbox, display path, changes type, message]
257
258
            self._enable_per_file_commits = True
258
259
        if not self._enable_per_file_commits:
259
260
            self._file_message_expander.hide()
260
 
            self._global_message_label.set_markup(_('<b>Commit Message</b>'))
 
261
            self._global_message_label.set_markup(_i18n('<b>Commit Message</b>'))
261
262
 
262
263
    def _compute_delta(self):
263
264
        self._delta = self._wt.changes_from(self._basis_tree)
307
308
        self._construct_file_list()
308
309
        self._construct_pending_list()
309
310
 
310
 
        self._check_local = gtk.CheckButton(_("_Only commit locally"),
 
311
        self._check_local = gtk.CheckButton(_i18n("_Only commit locally"),
311
312
                                            use_underline=True)
312
313
        self._left_pane_box.pack_end(self._check_local, False, False)
313
314
        self._check_local.set_active(False)
334
335
        self._hpane.pack2(self._right_pane_table, resize=True, shrink=True)
335
336
 
336
337
    def _construct_action_pane(self):
337
 
        self._button_commit = gtk.Button(_("Comm_it"), use_underline=True)
 
338
        self._button_commit = gtk.Button(_i18n("Comm_it"), use_underline=True)
338
339
        self._button_commit.connect('clicked', self._on_commit_clicked)
339
340
        self._button_commit.set_flags(gtk.CAN_DEFAULT)
340
341
        self._button_commit.show()
360
361
 
361
362
    def _construct_file_list(self):
362
363
        self._files_box = gtk.VBox(homogeneous=False, spacing=0)
363
 
        file_label = gtk.Label(_('Files'))
 
364
        file_label = gtk.Label(_i18n('Files'))
364
365
        # file_label.show()
365
366
        self._files_box.pack_start(file_label, expand=False)
366
367
 
367
368
        self._commit_all_files_radio = gtk.RadioButton(
368
 
            None, _("Commit all changes"))
 
369
            None, _i18n("Commit all changes"))
369
370
        self._files_box.pack_start(self._commit_all_files_radio, expand=False)
370
371
        self._commit_all_files_radio.show()
371
372
        self._commit_all_files_radio.connect('toggled',
372
373
            self._toggle_commit_selection)
373
374
        self._commit_selected_radio = gtk.RadioButton(
374
 
            self._commit_all_files_radio, _("Only commit selected changes"))
 
375
            self._commit_all_files_radio, _i18n("Only commit selected changes"))
375
376
        self._files_box.pack_start(self._commit_selected_radio, expand=False)
376
377
        self._commit_selected_radio.show()
377
378
        self._commit_selected_radio.connect('toggled',
378
379
            self._toggle_commit_selection)
379
380
        if self._pending:
380
 
            self._commit_all_files_radio.set_label(_('Commit all changes*'))
 
381
            self._commit_all_files_radio.set_label(_i18n('Commit all changes*'))
381
382
            self._commit_all_files_radio.set_sensitive(False)
382
383
            self._commit_selected_radio.set_sensitive(False)
383
384
 
410
411
        crt.set_property('activatable', not bool(self._pending))
411
412
        crt.connect("toggled", self._toggle_commit, self._files_store)
412
413
        if self._pending:
413
 
            name = _('Commit*')
 
414
            name = _i18n('Commit*')
414
415
        else:
415
 
            name = _('Commit')
 
416
            name = _i18n('Commit')
416
417
        commit_col = gtk.TreeViewColumn(name, crt, active=2)
417
418
        commit_col.set_visible(False)
418
419
        self._treeview_files.append_column(commit_col)
419
 
        self._treeview_files.append_column(gtk.TreeViewColumn(_('Path'),
 
420
        self._treeview_files.append_column(gtk.TreeViewColumn(_i18n('Path'),
420
421
                                           gtk.CellRendererText(), text=3))
421
 
        self._treeview_files.append_column(gtk.TreeViewColumn(_('Type'),
 
422
        self._treeview_files.append_column(gtk.TreeViewColumn(_i18n('Type'),
422
423
                                           gtk.CellRendererText(), text=4))
423
424
        self._treeview_files.connect('cursor-changed',
424
425
                                     self._on_treeview_files_cursor_changed)
451
452
 
452
453
        pending_message = gtk.Label()
453
454
        pending_message.set_markup(
454
 
            _('<i>* Cannot select specific files when merging</i>'))
 
455
            _i18n('<i>* Cannot select specific files when merging</i>'))
455
456
        self._pending_box.pack_start(pending_message, expand=False, padding=5)
456
457
        pending_message.show()
457
458
 
458
 
        pending_label = gtk.Label(_('Pending Revisions'))
 
459
        pending_label = gtk.Label(_i18n('Pending Revisions'))
459
460
        self._pending_box.pack_start(pending_label, expand=False, padding=0)
460
461
        pending_label.show()
461
462
 
477
478
                                 )
478
479
        self._pending_store = liststore
479
480
        self._treeview_pending.set_model(liststore)
480
 
        self._treeview_pending.append_column(gtk.TreeViewColumn(_('Date'),
 
481
        self._treeview_pending.append_column(gtk.TreeViewColumn(_i18n('Date'),
481
482
                                             gtk.CellRendererText(), text=1))
482
 
        self._treeview_pending.append_column(gtk.TreeViewColumn(_('Committer'),
 
483
        self._treeview_pending.append_column(gtk.TreeViewColumn(_i18n('Committer'),
483
484
                                             gtk.CellRendererText(), text=2))
484
 
        self._treeview_pending.append_column(gtk.TreeViewColumn(_('Summary'),
 
485
        self._treeview_pending.append_column(gtk.TreeViewColumn(_i18n('Summary'),
485
486
                                             gtk.CellRendererText(), text=3))
486
487
 
487
488
    def _construct_diff_view(self):
491
492
        #       decide that we really don't ever want to display it, we should
492
493
        #       actually remove it, and other references to it, along with the
493
494
        #       tests that it is set properly.
494
 
        self._diff_label = gtk.Label(_('Diff for whole tree'))
 
495
        self._diff_label = gtk.Label(_i18n('Diff for whole tree'))
495
496
        self._diff_label.set_alignment(0, 0)
496
497
        self._right_pane_table.set_row_spacing(self._right_pane_table_row, 0)
497
498
        self._add_to_right_table(self._diff_label, 1, False)
515
516
        self._file_message_text_view.set_accepts_tab(False)
516
517
        self._file_message_text_view.show()
517
518
 
518
 
        self._file_message_expander = gtk.Expander(_('File commit message'))
 
519
        self._file_message_expander = gtk.Expander(_i18n('File commit message'))
519
520
        self._file_message_expander.set_expanded(True)
520
521
        self._file_message_expander.add(scroller)
521
522
        self._add_to_right_table(self._file_message_expander, 1, False)
522
523
        self._file_message_expander.show()
523
524
 
524
525
    def _construct_global_message(self):
525
 
        self._global_message_label = gtk.Label(_('Global Commit Message'))
526
 
        self._global_message_label.set_markup(_('<b>Global Commit Message</b>'))
 
526
        self._global_message_label = gtk.Label(_i18n('Global Commit Message'))
 
527
        self._global_message_label.set_markup(
 
528
            _i18n('<b>Global Commit Message</b>'))
527
529
        self._global_message_label.set_alignment(0, 0)
528
530
        self._right_pane_table.set_row_spacing(self._right_pane_table_row, 0)
529
531
        self._add_to_right_table(self._global_message_label, 1, False)
549
551
 
550
552
        if selection is not None:
551
553
            path, display_path = model.get(selection, 1, 3)
552
 
            self._diff_label.set_text(_('Diff for ') + display_path)
 
554
            self._diff_label.set_text(_i18n('Diff for ') + display_path)
553
555
            if path is None:
554
556
                self._diff_view.show_diff(None)
555
557
            else:
596
598
        text_buffer = self._file_message_text_view.get_buffer()
597
599
        file_id, display_path, message = self._files_store.get(selection, 0, 3, 5)
598
600
        if file_id is None: # Whole tree
599
 
            self._file_message_expander.set_label(_('File commit message'))
 
601
            self._file_message_expander.set_label(_i18n('File commit message'))
600
602
            self._file_message_expander.set_expanded(False)
601
603
            self._file_message_expander.set_sensitive(False)
602
604
            text_buffer.set_text('')
603
605
            self._last_selected_file = None
604
606
        else:
605
 
            self._file_message_expander.set_label(_('Commit message for ')
 
607
            self._file_message_expander.set_label(_i18n('Commit message for ')
606
608
                                                  + display_path)
607
609
            self._file_message_expander.set_expanded(True)
608
610
            self._file_message_expander.set_sensitive(True)
647
649
 
648
650
        if message == '':
649
651
            response = self._question_dialog(
650
 
                            _('Commit with an empty message?'),
651
 
                            _('You can describe your commit intent in the message.'))
 
652
                _i18n('Commit with an empty message?'),
 
653
                _i18n('You can describe your commit intent in the message.'))
652
654
            if response == gtk.RESPONSE_NO:
653
655
                # Kindly give focus to message area
654
656
                self._global_message_text_view.grab_focus()
667
669
        #       files at this point.
668
670
        for path in self._wt.unknowns():
669
671
            response = self._question_dialog(
670
 
                _("Commit with unknowns?"),
671
 
                _("Unknown files exist in the working tree. Commit anyway?"))
 
672
                _i18n("Commit with unknowns?"),
 
673
                _i18n("Unknown files exist in the working tree. Commit anyway?"))
672
674
            if response == gtk.RESPONSE_NO:
673
675
                return
674
676
            break
686
688
                       revprops=revprops)
687
689
        except errors.PointlessCommit:
688
690
            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?'))
 
691
                _i18n('Commit with no changes?'),
 
692
                _i18n('There are no changes in the working tree.'
 
693
                      ' Do you want to commit anyway?'))
692
694
            if response == gtk.RESPONSE_YES:
693
695
                rev_id = self._wt.commit(message,
694
696
                               allow_pointless=True,