Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8, 0.8.1, and 0.8.2

hggtk: translatable strings, round 1

Changeset efd65cbaed9c

Parent 37b1f7742759

by Steve Borho

Changes to 8 files · Browse files at efd65cbaed9c Showing diff from parent 37b1f7742759 Diff from another changeset...

Change 1 of 2 Show Entire File hggtk/​about.py Stacked
 
11
12
13
 
14
15
16
 
56
57
58
59
 
60
61
62
 
11
12
13
14
15
16
17
 
57
58
59
 
60
61
62
63
@@ -11,6 +11,7 @@
 pygtk.require('2.0')  import gtk  import shlib +from mercurial.i18n import _    try:   # post 1.1.2 @@ -56,7 +57,7 @@
  "GTK-%s" % make_version(gtk.gtk_version),   ])   - comment = "Several icons are courtesy of the TortoiseSVN project" + comment = _("Several icons are courtesy of the TortoiseSVN project")     self.set_website("http://bitbucket.org/tortoisehg/stable/")   self.set_name("TortoiseHg")
Change 1 of 6 Show Entire File hggtk/​backout.py Stacked
 
10
11
12
 
13
14
15
 
19
20
21
22
 
23
24
25
 
31
32
33
34
 
35
36
 
37
38
39
 
44
45
46
47
 
48
49
50
51
 
52
53
54
55
56
57
58
 
59
60
 
61
62
63
64
65
66
 
67
68
69
70
71
 
 
72
73
74
 
81
82
83
84
 
85
86
87
 
104
105
106
107
108
 
 
109
110
111
 
10
11
12
13
14
15
16
 
20
21
22
 
23
24
25
26
 
32
33
34
 
35
36
 
37
38
39
40
 
45
46
47
 
48
49
50
51
 
52
53
54
55
56
57
58
 
59
60
 
61
62
63
64
65
66
 
67
68
69
70
 
 
71
72
73
74
75
 
82
83
84
 
85
86
87
88
 
105
106
107
 
 
108
109
110
111
112
@@ -10,6 +10,7 @@
 import pango  from dialog import *  from hgcmd import CmdDialog +from mercurial.i18n import _  import histselect    class BackoutDialog(gtk.Window): @@ -19,7 +20,7 @@
  gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)     self.root = root - self.set_title('Backout changeset - ' + rev) + self.set_title(_('Backout changeset - ') + rev)   self.set_default_size(600, 400)   self.notify_func = None   @@ -31,9 +32,9 @@
  sep.set_draw(False)     tbuttons = [ - self._toolbutton(gtk.STOCK_GO_BACK, 'Backout', + self._toolbutton(gtk.STOCK_GO_BACK, _('Backout'),   self._backout_clicked, - 'Backout selected changeset') + _('Backout selected changeset'))   ]   for btn in tbuttons:   self.tbar.insert(btn, -1) @@ -44,31 +45,31 @@
  # From: combo box   self.reventry = gtk.Entry()   self.reventry.set_text(rev) - self.browse = gtk.Button("Browse...") + self.browse = gtk.Button(_('Browse...'))   self.browse.connect('clicked', self._btn_rev_clicked)     hbox = gtk.HBox() - hbox.pack_start(gtk.Label('Revision to backout:'), False, False, 4) + hbox.pack_start(gtk.Label(_('Revision to backout:')), False, False, 4)   hbox.pack_start(self.reventry, True, True, 4)   hbox.pack_start(self.browse, False, False, 4)   vbox.pack_start(hbox, False, False, 4)     self.logview = gtk.TextView(buffer=None)   self.logview.set_editable(True) - self.logview.modify_font(pango.FontDescription("Monospace")) + self.logview.modify_font(pango.FontDescription('Monospace'))   buf = self.logview.get_buffer() - buf.set_text('Backed out changeset: ' + rev) + buf.set_text(_('Backed out changeset: ') + rev)   scrolledwindow = gtk.ScrolledWindow()   scrolledwindow.set_shadow_type(gtk.SHADOW_ETCHED_IN)   scrolledwindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)   scrolledwindow.add(self.logview)   scrolledwindow.set_border_width(4) - frame = gtk.Frame('Backout commit message') + frame = gtk.Frame(_('Backout commit message'))   frame.set_border_width(4)   frame.add(scrolledwindow)   self.tips.set_tip(frame, - 'Commit message text for new changeset that reverses the' - ' effect of the change being backed out.') + _('Commit message text for new changeset that reverses the' + ' effect of the change being backed out.'))   vbox.pack_start(frame, True, True, 4)     def set_notify_func(self, func, *args): @@ -81,7 +82,7 @@
  if rev is not None:   self.reventry.set_text(rev)   buf = self.logview.get_buffer() - buf.set_text('Backed out changeset: ' + rev) + buf.set_text(_('Backed out changeset: ') + rev)     def _toolbutton(self, stock, label, handler, tip):   tbutton = gtk.ToolButton(stock) @@ -104,8 +105,8 @@
   def run(root='', **opts):   # This dialog is intended to be launched by the changelog browser - # It's not expected to be used from hgproc or the command line. I - # leave this path in place for testing purposes. + # It's not expected to be used from hgtk. I leave this path in + # place for testing purposes.   dialog = BackoutDialog(root, 'tip')   dialog.show_all()   dialog.connect('destroy', gtk.main_quit)
Change 1 of 11 Show Entire File hggtk/​clone.py Stacked
 
4
5
6
7
8
9
10
11
12
 
 
 
13
14
15
16
17
 
62
63
64
65
 
66
67
 
68
69
70
 
76
77
78
79
80
 
 
81
82
83
 
94
95
96
97
 
98
99
100
 
112
113
114
115
116
 
 
117
118
119
 
128
129
130
131
 
132
133
134
 
143
144
145
146
147
 
 
148
149
150
151
 
152
153
 
154
155
156
 
160
161
162
163
164
165
166
 
 
 
 
167
168
169
 
176
177
178
179
 
180
181
182
 
267
268
269
270
 
271
272
273
 
295
296
297
298
299
300
301
302
303
304
 
305
306
307
308
 
309
310
311
 
4
5
6
 
 
 
 
 
 
7
8
9
10
 
11
12
13
 
58
59
60
 
61
62
 
63
64
65
66
 
72
73
74
 
 
75
76
77
78
79
 
90
91
92
 
93
94
95
96
 
108
109
110
 
 
111
112
113
114
115
 
124
125
126
 
127
128
129
130
 
139
140
141
 
 
142
143
144
145
146
 
147
148
 
149
150
151
152
 
156
157
158
 
 
 
 
159
160
161
162
163
164
165
 
172
173
174
 
175
176
177
178
 
263
264
265
 
266
267
268
269
 
291
292
293
 
294
295
296
297
298
 
299
300
301
302
 
303
304
305
306
@@ -4,14 +4,10 @@
 # Copyright (C) 2007 TK Soh <teekaysoh@gmail.com>  #   -try: - import pygtk - pygtk.require("2.0") -except: - pass - +import pygtk +pygtk.require("2.0") +import gtk  import os -import gtk  import pango  from dialog import question_dialog, error_dialog, info_dialog  from mercurial import hg, ui, cmdutil, util @@ -62,9 +58,9 @@
    self._btn_clone = self._toolbutton(   gtk.STOCK_COPY, - 'clone', + _('clone'),   self._btn_clone_clicked, - tip='Clone a repository') + tip=_('Clone a repository'))   tbuttons = [   self._btn_clone,   ] @@ -76,8 +72,8 @@
    # clone source   srcbox = gtk.HBox() - lbl = gtk.Label("Source Path:") - lbl.set_property("width-chars", ewidth) + lbl = gtk.Label(_('Source Path:')) + lbl.set_property('width-chars', ewidth)   lbl.set_alignment(0, 0.5)     # create drop-down list for source paths @@ -94,7 +90,7 @@
  self._srclistbox.pack_start(cell)   self._srclistbox.add_attribute(cell, 'text', 0)   - self._btn_src_browse = gtk.Button("Browse...") + self._btn_src_browse = gtk.Button(_('Browse...'))   self._btn_src_browse.connect('clicked', self._btn_src_clicked)   srcbox.pack_start(lbl, False, False)   srcbox.pack_start(self._srclistbox, True, True) @@ -112,8 +108,8 @@
    # clone destination   destbox = gtk.HBox() - lbl = gtk.Label("Destination Path:") - lbl.set_property("width-chars", ewidth) + lbl = gtk.Label(_('Destination Path:')) + lbl.set_property('width-chars', ewidth)   lbl.set_alignment(0, 0.5)   self._destlist = gtk.ListStore(str)   self._destlistbox = gtk.ComboBoxEntry(self._destlist, 0) @@ -128,7 +124,7 @@
  self._destlistbox.pack_start(cell)   self._destlistbox.add_attribute(cell, 'text', 0)   - self._btn_dest_browse = gtk.Button("Browse...") + self._btn_dest_browse = gtk.Button(_('Browse...'))   self._btn_dest_browse.connect('clicked', self._btn_dest_clicked)   destbox.pack_start(lbl, False, False)   destbox.pack_start(self._destlistbox, True, True) @@ -143,14 +139,14 @@
    # revision input   revbox = gtk.HBox() - lbl = gtk.Label("Clone To Revision:") - lbl.set_property("width-chars", ewidth) + lbl = gtk.Label(_('Clone To Revision:')) + lbl.set_property('width-chars', ewidth)   lbl.set_alignment(0, 0.5)   self._rev_input = gtk.Entry()   self._rev_input.set_text("") - self._opt_allrev = gtk.CheckButton("Clone all revisions") + self._opt_allrev = gtk.CheckButton(_('Clone all revisions'))   self._opt_allrev.set_active(True) - self._btn_rev_browse = gtk.Button("Select...") + self._btn_rev_browse = gtk.Button(_('Select...'))   self._btn_rev_browse.connect('clicked', self._btn_rev_clicked)   revbox.pack_start(lbl, False, False)   revbox.pack_start(self._rev_input, False, False) @@ -160,10 +156,10 @@
    # options   option_box = gtk.VBox() - self._opt_update = gtk.CheckButton("do not update the new working directory") - self._opt_pull = gtk.CheckButton("use pull protocol to copy metadata") - self._opt_uncomp = gtk.CheckButton("use uncompressed transfer") - self._opt_proxy = gtk.CheckButton("use proxy server") + self._opt_update = gtk.CheckButton(_('do not update the new working directory') + self._opt_pull = gtk.CheckButton(_('use pull protocol to copy metadata')) + self._opt_uncomp = gtk.CheckButton(_('use uncompressed transfer')) + self._opt_proxy = gtk.CheckButton(_('use proxy server'))   option_box.pack_start(self._opt_update, False, False)   option_box.pack_start(self._opt_pull, False, False)   option_box.pack_start(self._opt_uncomp, False, False) @@ -176,7 +172,7 @@
  self._opt_proxy.set_sensitive(False)     # remote cmd - lbl = gtk.Label("Remote Cmd:") + lbl = gtk.Label(_('Remote Cmd:'))   lbl.set_alignment(0, 0.5)   self._remote_cmd = gtk.Entry()   vbox.pack_end(self._remote_cmd, False, False, 1) @@ -267,7 +263,7 @@
    # verify input   if src == "": - error_dialog(self, "Source path is empty", "Please enter") + error_dialog(self, _('Source path is empty'), _('Please enter'))   self._src_input.grab_focus()   return False   @@ -295,17 +291,16 @@
  if dest:   cmdline.append(dest)   - print "cmdline: ", ' '.join(cmdline)   from hgcmd import CmdDialog   dlg = CmdDialog(cmdline)   dlg.run()   dlg.hide()   except util.Abort, inst: - error_dialog(self, "Clone aborted", str(inst)) + error_dialog(self, _('Clone aborted'), str(inst))   return False   except:   import traceback - error_dialog(self, "Clone error", traceback.format_exc()) + error_dialog(self, _('Clone error'), traceback.format_exc())   return False     self._add_src_to_recent(src)
Change 1 of 17 Show Entire File hggtk/​commit.py Stacked
 
92
93
94
95
96
97
98
 
 
 
 
99
100
101
 
107
108
109
110
111
 
 
112
113
114
 
134
135
136
137
 
138
139
140
 
149
150
151
152
 
153
154
155
 
189
190
191
192
 
 
193
194
195
 
210
211
212
213
 
214
215
216
 
243
244
245
246
247
248
249
 
 
 
 
250
251
252
 
257
258
259
260
 
261
262
263
 
279
280
281
282
283
284
 
 
 
285
286
287
288
 
 
 
289
290
291
 
327
328
329
330
 
331
332
333
 
374
375
376
377
 
378
379
380
 
412
413
414
415
 
416
417
418
419
420
421
422
423
 
 
 
424
425
426
 
429
430
431
432
 
433
434
435
436
437
438
439
 
440
441
442
 
449
450
451
452
 
 
453
454
455
 
459
460
461
462
463
464
 
 
 
465
466
467
 
481
482
483
484
485
486
 
 
 
487
488
489
490
491
 
 
492
493
494
 
546
547
548
549
550
551
 
 
 
552
553
554
 
92
93
94
 
 
 
 
95
96
97
98
99
100
101
 
107
108
109
 
 
110
111
112
113
114
 
134
135
136
 
137
138
139
140
 
149
150
151
 
152
153
154
155
 
189
190
191
 
192
193
194
195
196
 
211
212
213
 
214
215
216
217
 
244
245
246
 
 
 
 
247
248
249
250
251
252
253
 
258
259
260
 
261
262
263
264
 
280
281
282
 
 
 
283
284
285
286
 
 
 
287
288
289
290
291
292
 
328
329
330
 
331
332
333
334
 
375
376
377
 
378
379
380
381
 
413
414
415
 
416
417
418
419
420
421
 
 
 
422
423
424
425
426
427
 
430
431
432
 
433
434
435
436
437
438
439
 
440
441
442
443
 
450
451
452
 
453
454
455
456
457
 
461
462
463
 
 
 
464
465
466
467
468
469
 
483
484
485
 
 
 
486
487
488
489
490
491
 
 
492
493
494
495
496
 
548
549
550
 
 
 
551
552
553
554
555
556
@@ -92,10 +92,10 @@
  def get_tbbuttons(self):   tbbuttons = GStatus.get_tbbuttons(self)   tbbuttons.insert(2, gtk.SeparatorToolItem()) - self._undo_button = self.make_toolbutton(gtk.STOCK_UNDO, '_Undo', - self._undo_clicked, tip='undo recent commit') - self._commit_button = self.make_toolbutton(gtk.STOCK_OK, '_Commit', - self._commit_clicked, tip='commit') + self._undo_button = self.make_toolbutton(gtk.STOCK_UNDO, _('_Undo'), + self._undo_clicked, tip=_('undo recent commit')) + self._commit_button = self.make_toolbutton(gtk.STOCK_OK, _('_Commit'), + self._commit_clicked, tip=_('commit'))   tbbuttons.insert(2, self._undo_button)   tbbuttons.insert(2, self._commit_button)   return tbbuttons @@ -107,8 +107,8 @@
  if index >= 0:   buf = self.text.get_buffer()   if buf.get_char_count() and buf.get_modified(): - response = Confirm('Discard Message', [], self, - 'Discard current commit message?').run() + response = Confirm(_('Discard Message'), [], self, + _('Discard current commit message?')).run()   if response != gtk.RESPONSE_YES:   combobox.set_active(-1)   return @@ -134,7 +134,7 @@
    mbox = gtk.HBox()   - label = gtk.Label('Branch: ') + label = gtk.Label(_('Branch: '))   mbox.pack_start(label, False, False, 2)   self.branchentry = gtk.Entry()   mbox.pack_start(self.branchentry, False, False, 2) @@ -149,7 +149,7 @@
  else:   self.qnew_name = None   - label = gtk.Label('Recent Commit Messages: ') + label = gtk.Label(_('Recent Commit Messages: '))   mbox.pack_start(label, False, False, 2)   self.msg_cbbox = gtk.combo_box_new_text()   liststore = gtk.ListStore(str, str) @@ -189,7 +189,8 @@
      def get_menu_info(self): - """Returns menu info in this order: merge, addrem, unknown, clean, ignored, deleted + """Returns menu info in this order: merge, addrem, unknown, + clean, ignored, deleted   """   merge, addrem, unknown, clean, ignored, deleted, unresolved, resolved \   = GStatus.get_menu_info(self) @@ -210,7 +211,7 @@
  live = False   buf = self.text.get_buffer()   if buf.get_char_count() > 10 and buf.get_modified(): - dialog = Confirm('Exit', [], self, 'Save commit message at exit?') + dialog = Confirm(_('Exit'), [], self, _('Save commit message at exit?'))   res = dialog.run()   if res == gtk.RESPONSE_YES:   self._update_recent_messages(cur_msg) @@ -243,10 +244,10 @@
  # disable the checkboxes on the filelist if repo in merging state   merged = len(self.repo.changectx(None).parents()) > 1   - self.get_toolbutton('Re_vert').set_sensitive(not merged) - self.get_toolbutton('_Add').set_sensitive(not merged) - self.get_toolbutton('_Remove').set_sensitive(not merged) - self.get_toolbutton('Move').set_sensitive(not merged) + self.get_toolbutton(_('Re_vert')).set_sensitive(not merged) + self.get_toolbutton(_('_Add')).set_sensitive(not merged) + self.get_toolbutton(_('_Remove')).set_sensitive(not merged) + self.get_toolbutton(_('Move')).set_sensitive(not merged)     if merged:   # select all changes if repo is merged @@ -257,7 +258,7 @@
    # pre-fill commit message   buf = self.text.get_buffer() - buf.set_text('merge') + buf.set_text(_('merge'))   buf.set_modified(False)   #else:   # self.selectlabel.set_text( @@ -279,13 +280,13 @@
  if buf.get_char_count() == 0 or not buf.get_modified():   buf.set_text(self.qheader)   buf.set_modified(False) - c_btn = self.get_toolbutton('_Commit') - c_btn.set_label('QRefresh') - c_btn.set_tooltip(self.tooltips, self.mqmode and 'QRefresh' or 'QNew') + c_btn = self.get_toolbutton(_('_Commit')) + c_btn.set_label(_('QRefresh')) + c_btn.set_tooltip(self.tooltips, self.mqmode and _('QRefresh') or _('QNew'))   else: - c_btn = self.get_toolbutton('_Commit') - c_btn.set_label('_Commit') - c_btn.set_tooltip(self.tooltips, 'commit') + c_btn = self.get_toolbutton(('_Commit')) + c_btn.set_label(_('_Commit')) + c_btn.set_tooltip(self.tooltips, _('commit'))   self.branchentry.set_sensitive(not mqmode)     def _commit_clicked(self, toolbutton, data=None): @@ -327,7 +328,7 @@
  os.mkdir(backupdir)   except OSError, err:   if err.errno != errno.EEXIST: - Prompt('Commit', 'Unable to create ' + backupdir, + Prompt(_('Commit'), _('Unable to create ') + backupdir,   self).run()   return   try: @@ -374,7 +375,7 @@
  if s:   raise util.Abort(s)   else: - Prompt('Commit', 'Unable to apply patch', self).run() + Prompt(_('Commit'), _('Unable to apply patch'), self).run()   raise util.Abort(_('patch failed to apply'))   del fp   @@ -412,15 +413,15 @@
      def _undo_clicked(self, toolbutton, data=None): - response = Confirm('Undo commit', [], self, 'Undo last commit').run() + response = Confirm(_('Undo commit'), [], self, _('Undo last commit')).run()   if response != gtk.RESPONSE_YES:   return     tip = self._get_tip_rev(True)   if not tip == self._last_commit_id: - Prompt('Undo commit', - 'Unable to undo!\n\n' - 'Tip revision differs from last commit.', + Prompt(_('Undo commit'), + _('Unable to undo!\n\n' + 'Tip revision differs from last commit.'),   self).run()   return   @@ -429,14 +430,14 @@
  self._last_commit_id = None   self.reload_status()   except: - Prompt('Undo commit', 'Errors during rollback!', self).run() + Prompt(_('Undo commit'), _('Errors during rollback!'), self).run()       def _should_addremove(self, files):   if self.test_opt('addremove'):   return True   else: - response = Confirm('Add/Remove', files, self).run() + response = Confirm(_('Add/Remove'), files, self).run()   if response == gtk.RESPONSE_YES:   # This will stay set for further commits (meaning no more prompts). Problem?   self.opts['addremove'] = True @@ -449,7 +450,8 @@
  return   buf = self.text.get_buffer()   if buf.get_char_count() == 0: - Prompt('Nothing Commited', 'Please enter commit message', self).run() + Prompt(_('Nothing Commited'), + _('Please enter commit message'), self).run()   self.text.grab_focus()   return False   begin, end = buf.get_bounds() @@ -459,9 +461,9 @@
    def _hg_commit(self, files):   if not self.repo.ui.config('ui', 'username'): - Prompt('Commit: Invalid username', - 'Your username has not been configured.\n\n' - 'Please configure your username and try again', + Prompt(_('Commit: Invalid username'), + _('Your username has not been configured.\n\n' + 'Please configure your username and try again'),   self).run()     # bring up the config dialog for user to enter their username. @@ -481,14 +483,14 @@
  if newbranch != self.repo.dirstate.branch():   if newbranch in self.repo.branchtags():   if newbranch not in [p.branch() for p in self.repo.parents()]: - response = Confirm('Override Branch', [], self, - 'A branch named "%s" already exists,\n' - 'override?' % newbranch).run() + response = Confirm(_('Override Branch'), [], self, + _('A branch named "%s" already exists,\n' + 'override?') % newbranch).run()   else:   response = gtk.RESPONSE_YES   else: - response = Confirm('New Branch', [], self, - 'Create new named branch "%s"?' % newbranch).run() + response = Confirm(_('New Branch'), [], self, + _('Create new named branch "%s"?') % newbranch).run()   if response == gtk.RESPONSE_YES:   self.repo.dirstate.setbranch(newbranch)   elif response != gtk.RESPONSE_NO: @@ -546,9 +548,9 @@
  mqmode = self.mqmode   self.mqmode = not self.qnew_name.get_text().strip()   if mqmode != self.mqmode: - c_btn = self.get_toolbutton('_Commit') - c_btn.set_label(self.mqmode and 'QRefresh' or 'QNew') - c_btn.set_tooltip(self.tooltips, self.mqmode and 'QRefresh' or 'QNew') + c_btn = self.get_toolbutton(_('_Commit')) + c_btn.set_label(self.mqmode and _('QRefresh') or _('QNew')) + c_btn.set_tooltip(self.tooltips, self.mqmode and _('QRefresh') or _)('QNew')   success, outtext = self._hg_call_wrapper('Status', self._do_reload_status)   self.qnew_name.grab_focus() # set focus back  
Change 1 of 14 Show Entire File hggtk/​datamine.py Stacked
 
12
13
14
 
15
16
17
 
29
30
31
32
 
33
34
35
 
38
39
40
41
42
 
 
43
44
45
 
 
46
47
48
 
86
87
88
89
90
 
 
91
92
93
 
 
94
95
96
97
98
99
100
101
102
 
 
 
103
104
105
106
107
108
 
109
110
111
 
181
182
183
184
185
 
 
186
187
 
188
189
 
190
191
192
193
194
 
 
 
195
196
197
 
 
198
199
 
200
201
202
203
204
205
206
 
 
 
 
207
208
209
 
222
223
224
225
226
227
 
 
 
228
229
230
231
 
 
 
232
233
234
235
236
237
 
238
239
240
 
246
247
248
249
 
250
251
252
 
277
278
279
280
281
 
 
282
283
284
 
306
307
308
309
 
310
311
312
 
412
413
414
415
416
 
 
417
418
419
 
433
434
435
436
 
437
438
439
 
456
457
458
459
460
461
462
463
 
 
 
 
 
464
465
466
467
 
 
 
468
469
470
471
472
473
474
 
 
475
476
477
 
533
534
535
536
 
537
538
539
 
677
678
679
680
681
 
 
682
683
684
 
12
13
14
15
16
17
18
 
30
31
32
 
33
34
35
36
 
39
40
41
 
 
42
43
44
 
 
45
46
47
48
49
 
87
88
89
 
 
90
91
92
 
 
93
94
95
96
97
98
99
100
 
 
 
101
102
103
104
105
106
107
108
 
109
110
111
112
 
182
183
184
 
 
185
186
187
 
188
189
 
190
191
192
 
 
 
193
194
195
196
 
 
197
198
199
 
200
201
202
203
 
 
 
 
204
205
206
207
208
209
210
 
223
224
225
 
 
 
226
227
228
229
 
 
 
230
231
232
233
234
235
236
237
 
238
239
240
241
 
247
248
249
 
250
251
252
253
 
278
279
280
 
 
281
282
283
284
285
 
307
308
309
 
310
311
312
313
 
413
414
415
 
 
416
417
418
419
420
 
434
435
436
 
437
438
439
440
 
457
458
459
 
 
 
 
 
460
461
462
463
464
465
 
 
 
466
467
468
469
470
471
472
473
 
 
474
475
476
477
478
 
534
535
536
 
537
538
539
540
 
678
679
680
 
 
681
682
683
684
685
@@ -12,6 +12,7 @@
 import Queue  import threading, thread2  from mercurial import hg, ui, util, revlog +from mercurial.i18n import _  from hglib import hgcmd_toq, toutf, fromutf, gettabwidth, displaytime, LookupError, rootpath  from gdialog import *  from vis import treemodel @@ -29,7 +30,7 @@
  COL_LINENUM = 6     def get_title(self): - return 'DataMining - ' + os.path.basename(self.repo.root) + return _('DataMining') + ' - ' + os.path.basename(self.repo.root)     def get_icon(self):   return 'menurepobrowse.ico' @@ -38,11 +39,11 @@
  pass     def get_tbbuttons(self): - self.stop_button = self.make_toolbutton(gtk.STOCK_STOP, 'Stop', - self._stop_current_search, tip='Stop operation on current tab') + self.stop_button = self.make_toolbutton(gtk.STOCK_STOP, _('Stop'), + self._stop_current_search, tip=_('Stop operation on current tab'))   return [ - self.make_toolbutton(gtk.STOCK_FIND, 'New Search', - self._search_clicked, tip='Open new search tab'), + self.make_toolbutton(gtk.STOCK_FIND, _('New Search'), + self._search_clicked, tip=_('Open new search tab')),   self.stop_button   ]   @@ -86,26 +87,26 @@
    def ann_header_context_menu(self, treeview):   _menu = gtk.Menu() - _button = gtk.CheckMenuItem("Filename") - _button.connect("toggled", self.toggle_annatate_columns, treeview, 2) + _button = gtk.CheckMenuItem(_('Filename')) + _button.connect('toggled', self.toggle_annatate_columns, treeview, 2)   _menu.append(_button) - _button = gtk.CheckMenuItem("User") - _button.connect("toggled", self.toggle_annatate_columns, treeview, 3) + _button = gtk.CheckMenuItem(_('User')) + _button.connect('toggled', self.toggle_annatate_columns, treeview, 3)   _menu.append(_button)   _menu.show_all()   return _menu     def grep_context_menu(self):   _menu = gtk.Menu() - _menu.append(create_menu('di_splay change', self._cmenu_display)) - _menu.append(create_menu('_annotate file', self._cmenu_annotate)) - _menu.append(create_menu('_file history', self._cmenu_file_log)) + _menu.append(create_menu(_('di_splay change'), self._cmenu_display)) + _menu.append(create_menu(_('_annotate file'), self._cmenu_annotate)) + _menu.append(create_menu(_('_file history'), self._cmenu_file_log))   _menu.show_all()   return _menu     def annotate_context_menu(self):   _menu = gtk.Menu() - _menu.append(create_menu('di_splay change', self._cmenu_display)) + _menu.append(create_menu(_('di_splay change'), self._cmenu_display))   _menu.show_all()   return _menu   @@ -181,29 +182,29 @@
  if self.cwd.startswith(self.repo.root):   includes.set_text(util.canonpath(self.repo.root, self.cwd, '.'))   excludes = gtk.Entry() - search = gtk.Button('Search') - search_hbox.pack_start(gtk.Label('Regexp:'), False, False, 4) + search = gtk.Button(_('Search')) + search_hbox.pack_start(gtk.Label(_('Regexp:')), False, False, 4)   search_hbox.pack_start(regexp, True, True, 4) - search_hbox.pack_start(gtk.Label('Includes:'), False, False, 4) + search_hbox.pack_start(gtk.Label(_('Includes:')), False, False, 4)   search_hbox.pack_start(includes, True, True, 4) - search_hbox.pack_start(gtk.Label('Excludes:'), False, False, 4) + search_hbox.pack_start(gtk.Label(_('Excludes:')), False, False, 4)   search_hbox.pack_start(excludes, True, True, 4)   search_hbox.pack_start(search, False, False) - self.tooltips.set_tip(search, 'Start this search') - self.tooltips.set_tip(regexp, 'Regular expression search pattern') - self.tooltips.set_tip(includes, 'Comma separated list of' + self.tooltips.set_tip(search, _('Start this search')) + self.tooltips.set_tip(regexp, _('Regular expression search pattern')) + self.tooltips.set_tip(includes, _('Comma separated list of'   ' inclusion patterns. By default, the entire repository' - ' is searched.') - self.tooltips.set_tip(excludes, 'Comma separated list of' + ' is searched.')) + self.tooltips.set_tip(excludes, _('Comma separated list of'   ' exclusion patterns. Exclusion patterns are applied' - ' after inclusion patterns.') + ' after inclusion patterns.'))   vbox.pack_start(search_hbox, False, False, 4)     hbox = gtk.HBox() - follow = gtk.CheckButton('Follow copies and renames') - ignorecase = gtk.CheckButton('Ignore case') - linenum = gtk.CheckButton('Show line numbers') - showall = gtk.CheckButton('Show all matching revisions') + follow = gtk.CheckButton(_('Follow copies and renames')) + ignorecase = gtk.CheckButton(_('Ignore case')) + linenum = gtk.CheckButton(_('Show line numbers')) + showall = gtk.CheckButton(_('Show all matching revisions'))   hbox.pack_start(follow, False, False, 4)   hbox.pack_start(ignorecase, False, False, 4)   hbox.pack_start(linenum, False, False, 4) @@ -222,19 +223,19 @@
  results = gtk.ListStore(str, str, str, str)   treeview.set_model(results)   for title, width, col, emode in ( - ('Rev', 10, self.COL_REVID, pango.ELLIPSIZE_NONE), - ('File', 25, self.COL_PATH, pango.ELLIPSIZE_START), - ('Matches', 80, self.COL_TEXT, pango.ELLIPSIZE_END)): + (_('Rev'), 10, self.COL_REVID, pango.ELLIPSIZE_NONE), + (_('File'), 25, self.COL_PATH, pango.ELLIPSIZE_START), + (_('Matches'), 80, self.COL_TEXT, pango.ELLIPSIZE_END)):   cell = gtk.CellRendererText() - cell.set_property("width-chars", width) - cell.set_property("ellipsize", emode) - cell.set_property("family", "Monospace") + cell.set_property('width-chars', width) + cell.set_property('ellipsize', emode) + cell.set_property('family', 'Monospace')   column = gtk.TreeViewColumn(title)   column.set_resizable(True)   column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)   column.set_fixed_width(cell.get_size(treeview)[2])   column.pack_start(cell, expand=True) - column.add_attribute(cell, "text", col) + column.add_attribute(cell, 'text', col)   treeview.append_column(column)   if hasattr(treeview, 'set_tooltip_column'):   treeview.set_tooltip_column(self.COL_TOOLTIP) @@ -246,7 +247,7 @@
  frame.show_all()     hbox = gtk.HBox() - lbl = gtk.Label('Search %d' % self.newpagecount) + lbl = gtk.Label(_('Search %d') % self.newpagecount)   close = self.create_tab_close_button()   close.connect('clicked', self.close_page, frame)   hbox.pack_start(lbl, True, True, 2) @@ -277,8 +278,8 @@
  excludes, includes, linenum, showall, search_hbox) = objs   retext = regexp.get_text()   if not retext: - Prompt('No regular expression given', - 'You must provide a search expression', self).run() + Prompt(_('No regular expression given'), + _('You must provide a search expression'), self).run()   regexp.grab_focus()   return   @@ -306,7 +307,7 @@
  self.stbar.set_status_text('hg ' + ' '.join(args[2:]))     hbox = gtk.HBox() - lbl = gtk.Label('Search "%s"' % retext.split()[0]) + lbl = gtk.Label(_('Search "%s"') % retext.split()[0])   close = self.create_tab_close_button()   close.connect('clicked', self.close_page, frame)   hbox.pack_start(lbl, True, True, 2) @@ -412,8 +413,8 @@
  try:   fctx = ctx.filectx(path)   except LookupError: - Prompt('File is unrevisioned', - 'Unable to annotate ' + path, self).run() + Prompt(_('File is unrevisioned'), + _('Unable to annotate ') + path, self).run()   return   rev = fctx.filelog().linkrev(fctx.filerev())   revid = str(rev) @@ -433,7 +434,7 @@
    hbox = gtk.HBox()   followlabel = gtk.Label('') - follow = gtk.Button('Follow') + follow = gtk.Button(_('Follow'))   follow.connect('clicked', self.follow_rename)   follow.hide()   follow.set_sensitive(False) @@ -456,22 +457,22 @@
    context_menu = self.ann_header_context_menu(treeview)   for title, width, col, emode, visible in ( - ('Line', 8, self.COL_LINENUM, pango.ELLIPSIZE_NONE, True), - ('Rev', 10, self.COL_REVID, pango.ELLIPSIZE_NONE, True), - ('File', 15, self.COL_PATH, pango.ELLIPSIZE_START, False), - ('User', 15, self.COL_USER, pango.ELLIPSIZE_END, False), - ('Source', 80, self.COL_TEXT, pango.ELLIPSIZE_END, True)): + (_('Line'), 8, self.COL_LINENUM, pango.ELLIPSIZE_NONE, True), + (_('Rev'), 10, self.COL_REVID, pango.ELLIPSIZE_NONE, True), + (_('File'), 15, self.COL_PATH, pango.ELLIPSIZE_START, False), + (_('User'), 15, self.COL_USER, pango.ELLIPSIZE_END, False), + (_('Source'), 80, self.COL_TEXT, pango.ELLIPSIZE_END, True)):   cell = gtk.CellRendererText() - cell.set_property("width-chars", width) - cell.set_property("ellipsize", emode) - cell.set_property("family", "Monospace") + cell.set_property('width-chars', width) + cell.set_property('ellipsize', emode) + cell.set_property('family', 'Monospace')   column = gtk.TreeViewColumn(title)   column.set_resizable(True)   column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)   column.set_fixed_width(cell.get_size(treeview)[2])   column.pack_start(cell, expand=True) - column.add_attribute(cell, "text", col) - column.add_attribute(cell, "background", self.COL_COLOR) + column.add_attribute(cell, 'text', col) + column.add_attribute(cell, 'background', self.COL_COLOR)   column.set_visible(visible)   treeview.append_column(column)   self._add_header_context_menu(column, context_menu) @@ -533,7 +534,7 @@
  button.set_label(toutf('%s@%s' % (rpath, frev)))   button.show()   button.set_sensitive(True) - label.set_text('Follow Rename:') + label.set_text(_('Follow Rename:'))   else:   button.hide()   button.set_sensitive(False) @@ -677,8 +678,8 @@
  if os.path.isfile(f):   cf.append(util.canonpath(root, cwd, f))   elif os.path.isdir(f): - Prompt('Invalid path', - 'Cannot annotate directory: %s' % f, None).run() + Prompt(_('Invalid path'), + _('Cannot annotate directory: %s') % f, None).run()     dialog = DataMineDialog(u, repo, cwd, files, cmdoptions, True)   dialog.display()
Change 1 of 2 Show Entire File hggtk/​dialog.py Stacked
 
18
19
20
 
21
22
23
24
25
26
27
28
 
53
54
55
56
 
57
58
59
 
18
19
20
21
22
 
 
 
 
23
24
25
 
50
51
52
 
53
54
55
56
@@ -18,11 +18,8 @@
 pygtk.require("2.0")  import gtk  from gtklib import MessageDialog +from mercurial.i18n import _   - -def about(): - raise "About dialog currently under construction" -  def _message_dialog(parent, type, primary, secondary, buttons=gtk.BUTTONS_OK,   title="TortoiseHg"):   """ Display a given type of MessageDialog with the given message. @@ -53,7 +50,7 @@
  gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL)   dialog = gtk.Dialog(parent=parent, flags=gtk.DIALOG_MODAL,   buttons=buttons) - dialog.set_title('TortoiseHg Prompt') + dialog.set_title(_('TortoiseHg Prompt'))   entry = gtk.Entry()   entry.set_text(default or '')   entry.set_visibility(visible)
Change 1 of 9 Show Entire File hggtk/​gdialog.py Stacked
 
53
54
55
56
 
57
58
59
 
330
331
332
333
334
 
 
335
336
337
 
342
343
344
345
 
346
347
348
 
353
354
355
356
 
357
358
359
 
363
364
365
366
367
 
 
368
369
370
 
444
445
446
447
448
 
 
449
450
451
 
461
462
463
464
465
 
 
 
466
467
468
 
474
475
476
477
 
 
478
479
480
481
482
483
 
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
 
513
514
515
516
 
517
518
519
 
520
521
522
 
53
54
55
 
56
57
58
59
 
330
331
332
 
 
333
334
335
336
337
 
342
343
344
 
345
346
347
348
 
353
354
355
 
356
357
358
359
 
363
364
365
 
 
366
367
368
369
370
 
444
445
446
 
 
447
448
449
450
451
 
461
462
463
 
 
464
465
466
467
468
469
 
475
476
477
 
478
479
480
 
 
 
 
 
481
482
483
484
 
 
 
 
 
 
 
 
 
 
485
486
487
 
501
502
503
 
504
505
506
 
507
508
509
510
@@ -53,7 +53,7 @@
  def __init__(self, title, files, parent, primary=None):   SimpleMessage.__init__(self, parent, gtk.DIALOG_MODAL,   gtk.MESSAGE_QUESTION, gtk.BUTTONS_YES_NO) - self.set_title(toutf('Confirm ' + title)) + self.set_title(toutf(_('Confirm ') + title))   if primary is None:   primary = title + ' file' + ((len(files) > 1 and 's') or '') + '?'   primary = '<b>' + primary + '</b>' @@ -330,8 +330,8 @@
      def _hg_call_wrapper(self, title, command, showoutput=True): - """Run the specified command and display any resulting aborts, messages, - and errors + """Run the specified command and display any resulting aborts, + messages, and errors   """   textout = ''   saved = sys.stderr @@ -342,7 +342,7 @@
  try:   command()   except util.Abort, inst: - Prompt(title + ' Aborted', str(inst), self).run() + Prompt(title + _(' Aborted'), str(inst), self).run()   return False, ''   finally:   sys.stderr = saved @@ -353,7 +353,7 @@
  prompttext += errors.getvalue()   errors.close()   if len(prompttext) > 1: - Prompt(title + ' Messages and Errors', prompttext, self).run() + Prompt(title + _(' Messages and Errors'), prompttext, self).run()     return True, textout   @@ -363,8 +363,8 @@
  [self.repo.wjoin(file)], self.opts)     if self.diffcmd == 'diff': - Prompt('No visual diff configured', - 'Please select a visual diff application.', self).run() + Prompt(_('No visual diff configured'), + _('Please select a visual diff application.'), self).run()   dlg = ConfigDialog(self.repo.root, False)   dlg.show_all()   dlg.focus_field('tortoisehg.vdiff') @@ -444,8 +444,8 @@
  self.ui.config('ui', 'editor') or   os.environ.get('EDITOR', 'vi'))   if os.path.basename(editor) in ('vi', 'vim', 'hgeditor'): - Prompt('No visual editor configured', - 'Please configure a visual editor.', self).run() + Prompt(_('No visual editor configured'), + _('Please configure a visual editor.'), self).run()   dlg = ConfigDialog(self.repo.root, False)   dlg.show_all()   dlg.focus_field('tortoisehg.editor') @@ -461,8 +461,9 @@
  thread.start()    class NativeSaveFileDialogWrapper: - """Wrap the windows file dialog, or display default gtk dialog if that isn't available""" - def __init__(self, InitialDir = None, Title = "Save File", + """Wrap the windows file dialog, or display default gtk dialog if + that isn't available""" + def __init__(self, InitialDir = None, Title = _('Save File'),   Filter = {"All files": "*.*"}, FilterIndex = 1, FileName = ''):   import os.path   if InitialDir == None: @@ -474,26 +475,13 @@
  self.FilterIndex = FilterIndex     def run(self): - """run the file dialog, either return a file name, or False if the user aborted the dialog""" + """run the file dialog, either return a file name, or False if + the user aborted the dialog"""   try: - import win32gui - if self.tortoiseHgIsInstalled(): #as of 20071021, the file dialog will hang if the tortoiseHg shell extension is installed. I have no clue why, yet - Tyberius Prime - return self.runCompatible() - else: - return self.runWindows() + return self.runWindows()   except ImportError:   return self.runCompatible()   - def tortoiseHgIsInstalled(self): - import _winreg - try: - _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, - r"Software\TortoiseHg") - return True - except WindowsError: #reg key not found - pass - return False -   def runWindows(self):   import win32gui, win32con   #filter = "" @@ -513,10 +501,10 @@
  if fname:   return fname   else: - return False + return False     def runCompatible(self): - file_save =gtk.FileChooserDialog(self.Title,None, + file_save = gtk.FileChooserDialog(self.Title,None,   gtk.FILE_CHOOSER_ACTION_SAVE   , (gtk.STOCK_CANCEL   , gtk.RESPONSE_CANCEL
Change 1 of 2 Show Entire File hggtk/​gtklib.py Stacked
 
9
10
11
 
12
13
14
 
33
34
35
36
 
37
38
39
40
41
42
 
43
44
45
 
9
10
11
12
13
14
15
 
34
35
36
 
37
38
39
40
41
42
 
43
44
45
46
@@ -9,6 +9,7 @@
 import gtk  import gobject  import pango +from mercurial.i18n import _    class StatusBar(gtk.HBox):   def __init__(self, extra=None): @@ -33,13 +34,13 @@
  self.pbar.pulse()   return True   - def begin(self, msg="Running", timeout=100): + def begin(self, msg=_('Running'), timeout=100):   self.pbox.set_child_visible(True)   self.pbox.map()   self.set_status_text(msg)   self._timeout_event = gobject.timeout_add(timeout, self._pulse_timer)   - def end(self, msg="Done", unmap=True): + def end(self, msg=_('Done'), unmap=True):   gobject.source_remove(self._timeout_event)   self.set_status_text(msg)   if unmap: