Changeset efd65cbaed9c…
Parent 37b1f7742759…
by
Changes to 8 files · Browse files at efd65cbaed9c Showing diff from parent 37b1f7742759 Diff from another changeset...
@@ -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")
|
@@ -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)
|
|
|
@@ -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)
|
|
|
@@ -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
|
|
|
@@ -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()
|
@@ -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)
|
|
|
@@ -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
|
@@ -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:
|
Loading...