当前位置: 首页>>代码示例>>Python>>正文


Python i18n._函数代码示例

本文整理汇总了Python中tortoisehg.hgqt.i18n._函数的典型用法代码示例。如果您正苦于以下问题:Python _函数的具体用法?Python _怎么用?Python _使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了_函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: validatePage

    def validatePage(self):

        if self.cmd.core.running():
            return False

        if len(self.repo.parents()) == 1:
            # commit succeeded, repositoryChanged() called wizard().next()
            if self.skiplast.isChecked():
                self.wizard().close()
            return True

        user = qtlib.getCurrentUsername(self, self.repo)
        if not user:
            return False

        self.setTitle(_('Committing...'))
        self.setSubTitle(_('Please wait while committing merged files.'))

        message = hglib.fromunicode(self.msgEntry.text())
        cmdline = ['commit', '--verbose', '--message', message,
                   '--repository', self.repo.root, '--user', user]
        commandlines = [cmdline]
        pushafter = self.repo.ui.config('tortoisehg', 'cipushafter')
        if pushafter:
            cmd = ['push', '--repository', self.repo.root, pushafter]
            commandlines.append(cmd)
        self.repo.incrementBusyCount()
        self.cmd.setShowOutput(True)
        self.cmd.run(*commandlines)
        return False
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:30,代码来源:merge.py

示例2: interact_handler

 def interact_handler(self, wrapper):
     prompt, password, choices, default = wrapper.data
     prompt = hglib.tounicode(prompt)
     if choices:
         dlg = QMessageBox(QMessageBox.Question,
                     _('TortoiseHg Prompt'), prompt, parent=self.parent())
         dlg.setWindowFlags(Qt.Sheet)
         dlg.setWindowModality(Qt.WindowModal)
         for index, choice in enumerate(choices):
             button = dlg.addButton(hglib.tounicode(choice),
                                    QMessageBox.ActionRole)
             button.response = index
             if index == default:
                 dlg.setDefaultButton(button)
         dlg.exec_()
         button = dlg.clickedButton()
         if button is 0:
             self.responseq.put(None)
         else:
             self.responseq.put(button.response)
     else:
         mode = password and QLineEdit.Password \
                          or QLineEdit.Normal
         text, ok = qtlib.getTextInput(self.parent(),
                      _('TortoiseHg Prompt'),
                      prompt.title(),
                      mode=mode)
         if ok:
             text = hglib.fromunicode(text)
         else:
             text = None
         self.responseq.put(text)
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:32,代码来源:thread.py

示例3: linkActivated

 def linkActivated(self, cmd):
     if cmd == 'resolve':
         dlg = resolve.ResolveDialog(self._repoagent, self)
         dlg.exec_()
         self.checkResolve()
     elif cmd == 'commit':
         dlg = commit.CommitDialog(self._repoagent, [], {}, self)
         dlg.finished.connect(dlg.deleteLater)
         dlg.exec_()
         self.destcsinfo.update(self.repo['.'])
         self.checkStatus()
     elif cmd == 'discard':
         labels = [(QMessageBox.Yes, _('&Discard')),
                   (QMessageBox.No, _('Cancel'))]
         if not qtlib.QuestionMsgBox(_('Confirm Discard'),
                  _('Discard outstanding changes to working directory?'),
                  labels=labels, parent=self):
             return
         def finished(ret):
             self.repo.decrementBusyCount()
             if ret == 0:
                 self.checkStatus()
         cmdline = ['update', '--clean', '--repository', self.repo.root,
                    '--rev', '.']
         self.runner = cmdui.Runner(True, self)
         self.runner.commandFinished.connect(finished)
         self.repo.incrementBusyCount()
         self.runner.run(cmdline)
开发者ID:velorientc,项目名称:git_test7,代码行数:28,代码来源:rebase.py

示例4: __init__

    def __init__(self, repo, patchname, parent):
        super(QRenameDialog, self).__init__(parent)
        self.setWindowTitle(_('Patch rename - %s') % repo.displayname)

        f = self.windowFlags()
        self.setWindowFlags(f & ~Qt.WindowContextHelpButtonHint)
        self.setMinimumWidth(400)
        self.repo = repo
        self.oldpatchname = patchname
        self.newpatchname = ''

        self.setLayout(QVBoxLayout())

        lbl = QLabel(_('Rename patch <b>%s</b> to:') %
                     hglib.tounicode(self.oldpatchname))
        self.layout().addWidget(lbl)

        self.le = QLineEdit(hglib.tounicode(self.oldpatchname))
        self.layout().addWidget(self.le)

        self.cmd = cmdui.Runner(True, self)
        self.cmd.output.connect(self.output)
        self.cmd.makeLogVisible.connect(self.makeLogVisible)
        self.cmd.commandFinished.connect(self.onCommandFinished)

        BB = QDialogButtonBox
        bbox = QDialogButtonBox(BB.Ok|BB.Cancel)
        bbox.accepted.connect(self.accept)
        bbox.rejected.connect(self.reject)
        self.layout().addWidget(bbox)
        self.bbox = bbox

        self.focus = self.le
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:33,代码来源:qrename.py

示例5: nomarkup

def nomarkup(widget, item, value):
    def revline_markup(revnum, revid, summary, highlight=None, branch=None):
        summary = qtlib.markup(summary)
        if revid:
            rev = revid_markup('%s (%s)' % (revnum, revid))
            return '%s %s' % (rev, summary)
        else:
            revnum = qtlib.markup(revnum)
            return '%s - %s' % (revnum, summary)
    csets = []
    if item == 'ishead':
        if value is False:
            text = _('Not a head revision!')
            return qtlib.markup(text, fg='red', weight='bold')
        raise csinfo.UnknownItem(item)
    elif item == 'isclose':
        if value is True:
            text = _('Head is closed!')
            return qtlib.markup(text, fg='red', weight='bold')
        raise csinfo.UnknownItem(item)
    for cset in value:
        if isinstance(cset, basestring):
            csets.append(revid_markup(cset))
        else:
            csets.append(revline_markup(*cset))
    return csets
开发者ID:velorientc,项目名称:git_test7,代码行数:26,代码来源:revpanel.py

示例6: onThreadFinished

    def onThreadFinished(self, ret):
        if self.stbar:
            error = False
            if ret is None:
                self.stbar.clear()
                if self.thread.abortbyuser:
                    status = _('Terminated by user')
                else:
                    status = _('Terminated')
            elif ret == 0:
                status = _('Finished')
            else:
                status = _('Failed!')
                error = True
            self.stbar.showMessage(status, error)

        self.display = None
        if ret == 0 and self.runNext():
            return # run next command
        else:
            self.queue = []
            text = self.thread.rawoutput.join('')
            self.rawoutlines = [hglib.fromunicode(text, 'replace')]

        self.commandFinished.emit(ret)
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:25,代码来源:cmdui.py

示例7: show_patch_cmenu

    def show_patch_cmenu(self, pos):
        """Context menu for selected patch"""
        patchname = self.selected_patch()
        if not patchname:
            return

        menu = QMenu(self)
        def append(label, handler):
            menu.addAction(label).triggered.connect(handler)

        has_pbranch = self.has_pbranch()
        is_current = self.has_patch() and self.cur_branch() == patchname
        is_patch = self.is_patch(patchname)
        is_internal = self.pbranch.isinternal(patchname)
        is_merge = len(self.repo.branchheads(patchname)) > 1

        #if has_pbranch and not is_merge and not is_internal:
        #    append(_('&New'), self.pnew_activated)
        if not is_current:
            append(_('&Goto (update workdir)'), self.goto_activated)
        if is_patch:
            append(_('&Merge'), self.merge_activated)
        #    append(_('&Edit message'), self.edit_message_activated)
        #    append(_('&Rename'), self.rename_activated)
        #    append(_('&Delete'), self.delete_activated)
        #    append(_('&Finish'), self.finish_activated)

        if len(menu.actions()) > 0:
            menu.exec_(pos)
开发者ID:velorientc,项目名称:git_test7,代码行数:29,代码来源:pbranch.py

示例8: edit_pgraph_clicked

 def edit_pgraph_clicked(self):
     opts = {} # TODO: How to find user ID
     mgr = self.pbranch.patchmanager(self.repo.ui, self.repo, opts)
     if not mgr.hasgraphdesc():
         self.pbranch.writefile(mgr.graphdescpath(), '')
     oldtext = mgr.graphdesc()
     # run editor in the repository root
     olddir = os.getcwd()
     os.chdir(self.repo.root)
     try:
         newtext = None
         newtext = self.repo.ui.edit(oldtext, opts.get('user'))
     except error.Abort:
         no_editor_configured =(os.environ.get("HGEDITOR") or
             self.repo.ui.config("ui", "editor") or
             os.environ.get("VISUAL") or
             os.environ.get("EDITOR","editor-not-configured")
             == "editor-not-configured")
         if no_editor_configured:
             qtlib.ErrorMsgBox(_('No editor found'),
                 _('Mercurial was unable to find an editor. Please configure Mercurial to use an editor installed on your system.'))
         else:
             raise
     os.chdir(olddir)
     if newtext is not None:
         mgr.updategraphdesc(newtext)
         self.refresh()
开发者ID:velorientc,项目名称:git_test7,代码行数:27,代码来源:pbranch.py

示例9: pstatus

    def pstatus(self, patch_name):
        """
        [pbranch] Execute 'pstatus' command.

        :param patch_name: Name of patch-branch
        :retv: list of status messages. If empty there is no pending merges
        """
        if self.pbranch is None:
            return None
        status = []
        opts = {}
        mgr = self.pbranch.patchmanager(self.repo.ui, self.repo, opts)
        graph = mgr.graphforopts(opts)
        graph_cur = mgr.graphforopts({'tips': True})
        heads = self.repo.branchheads(patch_name)
        if graph_cur.isinner(patch_name) and not graph.isinner(patch_name):
            status.append(_('will be closed'))
        if len(heads) > 1:
            status.append(_('needs merge of %i heads\n') % len(heads))
        for dep, through in graph.pendingmerges(patch_name):
            if through:
                status.append(_('needs merge with %s (through %s)\n') %
                          (dep, ", ".join(through)))
            else:
                status.append(_('needs merge with %s\n') % dep)
        for dep in graph.pendingrebases(patch_name):
            status.append(_('needs update of diff base to tip of %s\n') % dep)
        return status
开发者ID:velorientc,项目名称:git_test7,代码行数:28,代码来源:pbranch.py

示例10: removeFile

 def removeFile(self, wfile):
     repo = self.repo
     ctx = self.ctx
     if isinstance(ctx, patchctx):
         repo.thgbackup(ctx._path)
         fp = util.atomictempfile(ctx._path, 'wb')
         try:
             if ctx._ph.comments:
                 fp.write('\n'.join(ctx._ph.comments))
                 fp.write('\n\n')
             for file in ctx._fileorder:
                 if file == wfile:
                     continue
                 for chunk in ctx._files[file]:
                     chunk.write(fp)
             fp.close()
         finally:
             del fp
         ctx.invalidate()
     else:
         fullpath = repo.wjoin(wfile)
         repo.thgbackup(fullpath)
         wasadded = wfile in repo[None].added()
         try:
             commands.revert(repo.ui, repo, fullpath, rev='.',
                             no_backup=True)
             if wasadded and os.path.exists(fullpath):
                 os.unlink(fullpath)
         except EnvironmentError:
             qtlib.InfoMsgBox(_("Unable to remove"),
                              _("Unable to remove file %s,\n"
                                "permission denied") %
                                 hglib.tounicode(wfile))
     self.fileModified.emit()
开发者ID:velorientc,项目名称:git_test7,代码行数:34,代码来源:chunks.py

示例11: 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.showMessage.emit(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:gilshwartz,项目名称:tortoisehg-caja,代码行数:30,代码来源:graft.py

示例12: checkPatchname

def checkPatchname(reporoot, activequeue, newpatchname, parent):
    if activequeue == 'patches':
        pn = 'patches'
    else:
        pn = 'patches-%s' % activequeue
    patchfile = os.sep.join([reporoot, ".hg", pn, newpatchname])
    if os.path.exists(patchfile):
        dlg = CheckPatchnameDialog(newpatchname, parent)
        choice = dlg.exec_()
        if choice == 1:
            # add .OLD to existing patchfile
            try:
                os.rename(patchfile, patchfile + '.OLD')
            except (OSError, IOError), inst:
                qtlib.ErrorMsgBox(self.errTitle,
                        _('Could not rename existing patchfile'),
                        hglib.tounicode(str(inst)))
                return False
            return True
        elif choice == 2:
            # overwite existing patchfile
            try:
                os.remove(patchfile)
            except (OSError, IOError), inst:
                qtlib.ErrorMsgBox(self.errTitle,
                        _('Could not delete existing patchfile'),
                        hglib.tounicode(str(inst)))
                return False
            return True
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:29,代码来源:qrename.py

示例13: getCurrentUsername

def getCurrentUsername(widget, repo, opts=None):
    if opts:
        # 1. Override has highest priority
        user = opts.get('user')
        if user:
            return user

    # 2. Read from repository
    try:
        return repo.ui.username()
    except error.Abort:
        pass

    # 3. Get a username from the user
    QMessageBox.information(widget, _('Please enter a username'),
                _('You must identify yourself to Mercurial'),
                QMessageBox.Ok)
    from tortoisehg.hgqt.settings import SettingsDialog
    dlg = SettingsDialog(False, focus='ui.username')
    dlg.exec_()
    repo.invalidateui()
    try:
        return repo.ui.username()
    except error.Abort:
        return None
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:25,代码来源:qtlib.py

示例14: __init__

    def __init__(self, repo, patches, parent):
        super(QDeleteDialog, self).__init__(parent)
        self.setWindowTitle(_('Patch remove - %s') % repo.displayname)
        self.setWindowIcon(qtlib.geticon('hg-qdelete'))
        f = self.windowFlags()
        self.setWindowFlags(f & ~Qt.WindowContextHelpButtonHint)
        self.repo = repo
        self.patches = patches

        self.setLayout(QVBoxLayout())

        msg = _('Remove patches from queue?')
        patchesu = u'<li>'.join([hglib.tounicode(p) for p in patches])
        lbl = QLabel(u'<b>%s<ul><li>%s</ul></b>' % (msg, patchesu))
        self.layout().addWidget(lbl)

        self.keepchk = QCheckBox(_('Keep patch files'))
        self.keepchk.setChecked(True)
        self.layout().addWidget(self.keepchk)

        self.cmd = cmdui.Runner(False, self)
        self.cmd.output.connect(self.output)
        self.cmd.makeLogVisible.connect(self.makeLogVisible)

        BB = QDialogButtonBox
        bbox = QDialogButtonBox(BB.Ok|BB.Cancel)
        bbox.accepted.connect(self.accept)
        bbox.rejected.connect(self.reject)
        self.layout().addWidget(bbox)
        self.bbox = bbox
开发者ID:velorientc,项目名称:git_test7,代码行数:30,代码来源:qdelete.py

示例15: _initAnnotateOptionActions

 def _initAnnotateOptionActions(self):
     self._annoptactions = []
     for name, field in [(_("Show Author"), "author"), (_("Show Date"), "date"), (_("Show Revision"), "rev")]:
         a = QAction(name, self, checkable=True)
         a.setData(field)
         a.triggered.connect(self._updateAnnotateOption)
         self._annoptactions.append(a)
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:7,代码来源:fileview.py


注:本文中的tortoisehg.hgqt.i18n._函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。