本文整理汇总了Python中tortoisehg.util.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了_函数的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: updatestatus
def updatestatus(self):
if not self.curitems:
text = _('No items to display')
else:
num = dict(count=len(self.showitems), total=len(self.curitems))
text = _('Displaying %(count)d of %(total)d items') % num
self.statuslabel.setText(text)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:7,代码来源:cslist.py
示例2: refreshWctx
def refreshWctx(self):
if self.refthread:
self.refreshWctxLater.start()
return
self.refreshWctxLater.stop()
self.fileview.clearDisplay()
# store selected paths or current path
model = self.tv.model()
if model and model.rowCount(QModelIndex()):
smodel = self.tv.selectionModel()
curidx = smodel.currentIndex()
if curidx.isValid():
curpath = model.getRow(curidx)[COL_PATH]
else:
curpath = None
spaths = [model.getRow(i)[COL_PATH] for i in smodel.selectedRows()]
self.reselection = spaths, curpath
else:
self.reselection = None
if self.checkable:
self.checkAllNoneBtn.setEnabled(False)
self.refreshBtn.setEnabled(False)
self.progress.emit(*cmdui.startProgress(_('Refresh'), _('status')))
self.refthread = StatusThread(self.repo, self.pctx, self.pats, self.opts)
self.refthread.finished.connect(self.reloadComplete)
self.refthread.showMessage.connect(self.reloadFailed)
self.refthread.start()
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:29,代码来源:status.py
示例3: menuRequest
def menuRequest(self, point):
'context menu request for unknown list'
point = self.unknownlist.viewport().mapToGlobal(point)
selected = [self.lclunknowns[i.row()]
for i in sorted(self.unknownlist.selectedIndexes())]
if len(selected) == 0:
return
if not self.contextmenu:
self.contextmenu = QMenu(self)
self.contextmenu.setTitle(_('Add ignore filter...'))
else:
self.contextmenu.clear()
filters = []
if len(selected) == 1:
local = selected[0]
filters.append([local])
dirname = os.path.dirname(local)
while dirname:
filters.append([dirname])
dirname = os.path.dirname(dirname)
base, ext = os.path.splitext(local)
if ext:
filters.append(['*'+ext])
filters.append(['**'+ext])
else:
filters.append(selected)
for f in filters:
n = len(f) == 1 and f[0] or _('selected files')
a = self.contextmenu.addAction(_('Ignore ') + hglib.tounicode(n))
a._patterns = f
a.triggered.connect(self.insertFilters)
self.contextmenu.exec_(point)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:32,代码来源:hgignore.py
示例4: qreorder
def qreorder(ui, repo, *patches, **opts):
"""move patches to the beginning or after the specified patch"""
after = opts['after'] or None
q = repo.mq
if any(n not in q.series for n in patches):
raise util.Abort(_('unknown patch to move specified'))
if after in patches:
raise util.Abort(_('invalid patch position specified'))
if any(q.isapplied(n) for n in patches):
raise util.Abort(_('cannot move applied patches'))
if after is None:
at = 0
else:
try:
at = q.series.index(after) + 1
except ValueError:
raise util.Abort(_('patch %s not in series') % after)
if at < q.seriesend(True):
raise util.Abort(_('cannot move into applied patches'))
wlock = repo.wlock()
try:
_applymovemqpatches(q, after, patches)
q.savedirty()
finally:
wlock.release()
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:27,代码来源:hgcommands.py
示例5: checkResolve
def checkResolve(self):
for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
if status == 'u':
txt = _('Graft generated merge <b>conflicts</b> that must '
'be <a href="resolve"><b>resolved</b></a>')
self.graftbtn.setEnabled(False)
break
else:
self.graftbtn.setEnabled(True)
txt = _('You may continue the graft')
self._stbar.showMessage(txt)
currgraftrevs = self.graftstate()
if currgraftrevs:
def findrev(rev, revlist):
rev = self.repo[rev].rev()
for n, r in enumerate(revlist):
r = self.repo[r].rev()
if rev == r:
return n
return None
idx = findrev(currgraftrevs[0], self.sourcelist)
if idx is not None:
self._updateSource(idx)
self.abortbtn.setEnabled(True)
self.graftbtn.setText('Continue')
return True
else:
self.abortbtn.setEnabled(False)
return False
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:30,代码来源:graft.py
示例6: setRenameCopy
def setRenameCopy(self):
if self.copy_chk.isChecked():
self.msgTitle = _('Copy')
self.errTitle = _('Copy Error')
else:
self.msgTitle = _('Rename')
self.errTitle = _('Rename Error')
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:7,代码来源:rename.py
示例7: runCommand
def runCommand(self):
# check inputs
fullsrc, fulldest = self._sourceFile(), self._destinationFile()
if not os.path.exists(fullsrc):
qtlib.WarningMsgBox(self.msgTitle, _('Source does not exist.'))
return cmdcore.nullCmdSession()
if not fullsrc.startswith(self._repoagent.rootPath()):
qtlib.ErrorMsgBox(self.errTitle,
_('The source must be within the repository tree.'))
return cmdcore.nullCmdSession()
if not fulldest.startswith(self._repoagent.rootPath()):
qtlib.ErrorMsgBox(self.errTitle,
_('The destination must be within the repository tree.'))
return cmdcore.nullCmdSession()
if os.path.isfile(fulldest) and not self.isCaseFoldingOnWin():
res = qtlib.QuestionMsgBox(self.msgTitle, '<p>%s</p><p>%s</p>' %
(_('Destination file already exists.'),
_('Are you sure you want to overwrite it ?')),
defaultbutton=QMessageBox.No)
if not res:
return cmdcore.nullCmdSession()
cmdline = self.compose_command()
self.show_command(cmdline)
return self._repoagent.runCommand(cmdline, self)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:25,代码来源:rename.py
示例8: validatePage
def validatePage(self):
if not self._cmdsession.isFinished():
return False
if len(self.repo[None].parents()) == 1:
# commit succeeded, repositoryChanged() called wizard().next()
if self.field('skiplast').toBool():
self.wizard().close()
return True
user = hglib.tounicode(qtlib.getCurrentUsername(self, self.repo,
self.opts))
if not user:
return False
self.setTitle(_('Committing...'))
self.setSubTitle(_('Please wait while committing merged files.'))
opts = {'verbose': True,
'message': self.msgEntry.text(),
'user': user,
'subrepos': bool(self.opts.get('recurseinsubrepos')),
'date': hglib.tounicode(self.opts.get('date')),
}
commandlines = [hglib.buildcmdargs('commit', **opts)]
pushafter = self.repo.ui.config('tortoisehg', 'cipushafter')
if pushafter:
cmd = ['push', hglib.tounicode(pushafter)]
commandlines.append(cmd)
self._cmdlog.show()
sess = self._repoagent.runCommandSequence(commandlines, self)
self._cmdsession = sess
sess.commandFinished.connect(self.onCommandFinished)
sess.outputReceived.connect(self._cmdlog.appendLog)
return False
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:35,代码来源:merge.py
示例9: _renameQueue
def _renameQueue(self):
curname = self._activeName()
newname = self._getNewName(_('Rename Patch Queue'),
_("Rename patch queue '%s' to") % curname,
_('Rename'))
if newname and curname != newname:
self._runQqueue('rename', newname)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:7,代码来源:mq.py
示例10: debuggethostfingerprint
def debuggethostfingerprint(ui, repo, source='default'):
"""retrieve a fingerprint of the server certificate
The server certificate is not verified.
"""
source = ui.expandpath(source)
u = util.url(source)
scheme = (u.scheme or '').split('+')[-1]
host = u.host
port = util.getport(u.port or scheme or '-1')
if scheme != 'https' or not host or not (0 <= port <= 65535):
raise util.Abort(_('unsupported URL: %s') % source)
sock = socket.socket()
try:
sock.connect((host, port))
sock = sslutil.wrapsocket(sock, None, None, ui, serverhostname=host)
peercert = sock.getpeercert(True)
if not peercert:
raise util.Abort(_('%s certificate error: no certificate received')
% host)
finally:
sock.close()
s = util.sha1(peercert).hexdigest()
ui.write(':'.join([s[x:x + 2] for x in xrange(0, len(s), 2)]), '\n')
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:26,代码来源:hgcommands.py
示例11: __init__
def __init__(self, opts, parent=None):
QDialog.__init__(self, parent)
self.setWindowTitle(_('MQ options'))
layout = QVBoxLayout()
self.setLayout(layout)
self.forcecb = QCheckBox(
_('Force push or pop (--force)'))
layout.addWidget(self.forcecb)
self.keepcb = QCheckBox(
_('Tolerate non-conflicting local changes (--keep-changes)'))
layout.addWidget(self.keepcb)
self.forcecb.setChecked(opts.get('force', False))
self.keepcb.setChecked(opts.get('keep_changes', False))
for cb in [self.forcecb, self.keepcb]:
cb.clicked.connect(self._resolveopts)
BB = QDialogButtonBox
bb = QDialogButtonBox(BB.Ok|BB.Cancel)
bb.accepted.connect(self.accept)
bb.rejected.connect(self.reject)
self.bb = bb
layout.addWidget(bb)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:27,代码来源:mq.py
示例12: _updateSourceTitle
def _updateSourceTitle(self, idx):
numrevs = len(self.sourcelist)
if numrevs <= 1:
title = _('Graft changeset')
else:
title = _('Graft changeset #%d of %d') % (idx + 1, numrevs)
self.srcb.setTitle(title)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:7,代码来源:graft.py
示例13: run
def run(self):
msg = None
if not self.dialog.server:
msg = _("Invalid Settings - The ReviewBoard server is not setup")
elif not self.dialog.user:
msg = _("Invalid Settings - Please provide your ReviewBoard username")
else:
rb = extensions.find("reviewboard")
try:
pwd = self.dialog.password
#if we don't have a password send something here to skip
#the cli getpass in the extension. We will set the password
#later
if not pwd:
pwd = "None"
self.reviewboard = rb.make_rbclient(self.dialog.server,
self.dialog.user,
pwd)
self.loadCombos()
except rb.ReviewBoardError, e:
msg = e.msg
except TypeError:
msg = _("Invalid reviewboard plugin. Please download the "
"Mercurial reviewboard plugin version 3.5 or higher "
"from the website below.\n\n %s") % \
u'http://bitbucket.org/mdelagra/mercurial-reviewboard/'
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:28,代码来源:postreview.py
示例14: accept
def accept(self):
# If the editor has been modified, we implicitly accept the changes
acceptresolution = self.editor.isModified()
if not acceptresolution:
action = QMessageBox.warning(self,
_("Warning"),
_("You have marked all rejected patch chunks as resolved yet "
"you have not modified the file on the edit panel.\n\n"
"This probably means that no code from any of the rejected "
"patch chunks made it into the file.\n\n"
"Are you sure that you want to leave the file as is and "
"consider all the rejected patch chunks as resolved?\n\n"
"Doing so may delete them from a shelve, for example, which "
"would mean that you would lose them forever!\n\n"
"Click Yes to accept the file as is or No to continue "
"resolving the rejected patch chunks."),
QMessageBox.Yes, QMessageBox.No)
if action == QMessageBox.Yes:
acceptresolution = True
if acceptresolution:
if not qscilib.writeFile(self.editor, hglib.tounicode(self.path),
self._textEncoding()):
return
self.saveSettings()
super(RejectsDialog, self).accept()
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:26,代码来源:rejects.py
示例15: _addRevertTargetCombo
def _addRevertTargetCombo(self, rev):
if rev is None:
raise ValueError('Cannot revert to working directory')
self.revcombo = QComboBox()
revnames = ['revision %d' % rev]
repo = self._repoagent.rawRepo()
ctx = repo[rev]
parents = ctx.parents()[:2]
if len(parents) == 1:
parentdesctemplate = ("revision %d's parent (i.e. revision %d)",)
else:
parentdesctemplate = (
_("revision %d's first parent (i.e. revision %d)"),
_("revision %d's second parent (i.e. revision %d)"),
)
for n, pctx in enumerate(parents):
if pctx.node() == nullid:
revdesc = _('null revision (i.e. remove file(s))')
else:
revdesc = parentdesctemplate[n] % (rev, pctx.rev())
revnames.append(revdesc)
self.revcombo.addItems(revnames)
reverttargets = [ctx] + parents
for n, ctx in enumerate(reverttargets):
self.revcombo.setItemData(n, ctx.hex())
self.layout().addWidget(self.revcombo)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:26,代码来源:revert.py
示例16: launchtool
def launchtool(cmd, opts, replace, block):
def quote(match):
key = match.group()[1:]
return util.shellquote(replace[key])
if isinstance(cmd, unicode):
cmd = hglib.fromunicode(cmd)
lopts = []
for opt in opts:
if isinstance(opt, unicode):
lopts.append(hglib.fromunicode(opt))
else:
lopts.append(opt)
args = ' '.join(lopts)
args = re.sub(_regex, quote, args)
cmdline = util.shellquote(cmd) + ' ' + args
cmdline = util.quotecommand(cmdline)
try:
proc = subprocess.Popen(cmdline, shell=True,
creationflags=qtlib.openflags,
stderr=subprocess.PIPE,
stdout=subprocess.PIPE,
stdin=subprocess.PIPE)
if block:
proc.communicate()
except (OSError, EnvironmentError), e:
QMessageBox.warning(None,
_('Tool launch failure'),
_('%s : %s') % (cmd, str(e)))
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:28,代码来源:visdiff.py
示例17: isComplete
def isComplete(self):
'should Next button be sensitive?'
if not self.mergecomplete:
return False
ucount = 0
rcount = 0
for root, path, status in thgrepo.recursiveMergeStatus(self.repo):
if status == 'u':
ucount += 1
if status == 'r':
rcount += 1
if ucount:
if self.field('autoresolve').toBool():
# if autoresolve is enabled, we know these were real conflicts
self.reslabel.setText(_('%d files have <b>merge conflicts</b> '
'that must be <a href="resolve">'
'<b>resolved</b></a>') % ucount)
else:
# else give a calmer indication of conflicts
self.reslabel.setText(_('%d files were modified on both '
'branches and must be <a href="resolve">'
'<b>resolved</b></a>') % ucount)
return False
elif rcount:
self.reslabel.setText(_('No merge conflicts, ready to commit or '
'<a href="resolve"><b>review</b></a>'))
else:
self.reslabel.setText(_('No merge conflicts, ready to commit'))
return True
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:29,代码来源:merge.py
示例18: updateModel
def updateModel(self, wctx, wstatus, patchecked):
self.tv.setSortingEnabled(False)
if self.tv.model():
checked = self.tv.model().getChecked()
else:
checked = patchecked
if self.pats and not checked:
qtlib.WarningMsgBox(_('No appropriate files'),
_('No files found for this operation'),
parent=self)
ms = hglib.readmergestate(self.repo)
tm = WctxModel(self._repoagent, wctx, wstatus, ms, self.pctx,
self.savechecks, self.opts, checked, self,
checkable=self.checkable, defcheck=self.defcheck)
if self.checkable:
tm.checkToggled.connect(self.checkToggled)
tm.checkCountChanged.connect(self.updateCheckCount)
self.savechecks = True
oldtm = self.tv.model()
self.tv.setModel(tm)
if oldtm:
oldtm.deleteLater()
self.tv.setSortingEnabled(True)
self.tv.setColumnHidden(COL_PATH, bool(wctx.p2()) or not self.checkable)
self.tv.setColumnHidden(COL_MERGE_STATE, not tm.anyMerge())
if self.checkable:
self.updateCheckCount()
# remove non-existent file from partials table because model changed
for file in self.partials.keys():
if file not in tm.checked:
del self.partials[file]
for col in (COL_PATH, COL_STATUS, COL_MERGE_STATE):
w = self.tv.sizeHintForColumn(col)
self.tv.setColumnWidth(col, w)
for col in (COL_PATH_DISPLAY, COL_EXTENSION, COL_SIZE):
self.tv.resizeColumnToContents(col)
# reset selection, or select first row
curidx = tm.index(0, 0)
selmodel = self.tv.selectionModel()
flags = QItemSelectionModel.Select | QItemSelectionModel.Rows
if self.reselection:
selected, current = self.reselection
for i, row in enumerate(tm.getAllRows()):
if row[COL_PATH] in selected:
selmodel.select(tm.index(i, 0), flags)
if row[COL_PATH] == current:
curidx = tm.index(i, 0)
else:
selmodel.select(curidx, flags)
selmodel.currentChanged.connect(self.onCurrentChange)
selmodel.selectionChanged.connect(self.onSelectionChange)
if curidx and curidx.isValid():
selmodel.setCurrentIndex(curidx, QItemSelectionModel.Current)
self.onSelectionChange()
self._togglefileshortcut.setEnabled(True)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:60,代码来源:status.py
示例19: update_info
def update_info(self):
self.p1_info.update(self.ctxs[0].node())
merge = len(self.ctxs) == 2
if merge:
self.p2_info.update(self.ctxs[1])
new_rev = hglib.fromunicode(self.rev_combo.currentText())
if new_rev == 'null':
self.target_info.setText(_('remove working directory'))
self.commandChanged.emit()
return
try:
new_ctx = self.repo[new_rev]
if not merge and new_ctx.rev() == self.ctxs[0].rev() \
and not new_ctx.bookmarks():
self.target_info.setText(_('(same as parent)'))
else:
self.target_info.update(self.repo[new_rev])
# only show the path combo when there are multiple paths
# and the target revision has subrepos
showpathcombo = self.path_combo.count() > 1 and \
'.hgsubstate' in new_ctx
self.path_combo_label.setVisible(showpathcombo)
self.path_combo.setVisible(showpathcombo)
except (error.LookupError, error.RepoError, EnvironmentError):
self.target_info.setText(_('unknown revision!'))
self.commandChanged.emit()
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:26,代码来源:update.py
注:本文中的tortoisehg.util.i18n._函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论