Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

thgconfig: add gettext wrappers to protocol label in PathEditDialog

Changeset 3b468db83ee1

Parent 86256972d5d6

by Yuki KODAMA

Changes to one file · Browse files at 3b468db83ee1 Showing diff from parent 86256972d5d6 Diff from another changeset...

 
216
217
218
219
 
 
220
221
222
 
282
283
284
285
286
 
 
287
288
289
 
317
318
319
 
 
 
 
 
 
 
 
 
 
 
 
320
321
322
 
372
373
374
375
376
 
377
378
379
 
380
381
382
 
405
406
407
408
 
409
410
411
 
448
449
450
451
 
452
453
454
 
216
217
218
 
219
220
221
222
223
 
283
284
285
 
 
286
287
288
289
290
 
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
 
385
386
387
 
 
388
389
390
 
391
392
393
394
 
417
418
419
 
420
421
422
423
 
460
461
462
 
463
464
465
466
@@ -216,7 +216,8 @@
  ' Default: False')))    class PathEditDialog(gtk.Dialog): - _protocols = ['ssh', 'http', 'https', 'local'] + _protocols = (('ssh', _('ssh')), ('http', _('http')), + ('https', _('https')), ('local', _('local')))     def __init__(self, path, alias, list):   gtk.Dialog.__init__(self, parent=None, flags=gtk.DIALOG_MODAL, @@ -282,8 +283,8 @@
  typelabel.set_alignment(1, 0.5)   entrytable.attach(typelabel, 0, 1, 0, 1, gtk.FILL, 0, 4, 2)   self.protcombo = gtk.combo_box_new_text() - for p in self._protocols: - self.protcombo.append_text(p) + for name, label in self._protocols: + self.protcombo.append_text(label)   hbox = gtk.HBox()   hbox.pack_start(self.protcombo, False, False)   hbox.pack_start(gtk.Label('')) @@ -317,6 +318,18 @@
  self.update_sensitive()   self.show_all()   + def protocolindex(self, pname): + for (i, (name, label)) in enumerate(self._protocols): + if name == pname: + return i + return None + + def protocolname(self, plabel): + for (name, label) in self._protocols: + if label == plabel: + return name + return None +   def sethandlers(self, enable=True):   # protocol combobox   if enable: @@ -372,11 +385,10 @@
  self.entries['Folder'][0].set_text(folder or '')   self.entries['Password'][0].set_text(pw or '')   - i = self._protocols.index(scheme) - self.protcombo.set_active(i) + self.protcombo.set_active(self.protocolindex(scheme) or 0)     def update_sensitive(self): - proto = self.protcombo.get_active_text() + proto = self.protocolname(self.protcombo.get_active_text())   if proto == self.lastproto:   return   self.lastproto = proto @@ -405,7 +417,7 @@
  self.settings.write()     def browse_clicked(self, button): - if self.protcombo.get_active_text() == 'local': + if self.protocolname(self.protcombo.get_active_text()) == 'local':   initial = self.entries['URL'][0].get_text()   else:   initial = None @@ -448,7 +460,7 @@
  self.response(widget, gtk.RESPONSE_OK)     def buildurl(self): - proto = self.protcombo.get_active_text() + proto = self.protocolname(self.protcombo.get_active_text())   host = self.entries['Host'][0].get_text()   port = self.entries['Port'][0].get_text()   folder = self.entries['Folder'][0].get_text()