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


Python hglib.tounicode函数代码示例

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


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

示例1: getlog

    def getlog(self, ctx, gnode):
        if ctx.rev() is None:
            msg = None
            if self.unicodestar:
                # The Unicode symbol is a black star:
                msg = u'\u2605 ' + _('Working Directory') + u' \u2605'
            else:
                msg = '*** ' + _('Working Directory') + ' ***'

            for pctx in ctx.parents():
                if self.repo._branchheads and pctx.node() not in self.repo._branchheads:
                    text = _('Not a head revision!')
                    msg += " " + qtlib.markup(text, fg='red', weight='bold')

            return msg

        msg = ctx.longsummary()

        if ctx.thgmqunappliedpatch():
            effects = qtlib.geteffect('log.unapplied_patch')
            text = qtlib.applyeffects(' %s ' % ctx._patchname, effects)
            # qtlib.markup(msg, fg=UNAPPLIED_PATCH_COLOR)
            msg = qtlib.markup(msg)
            return hglib.tounicode(text + ' ') + msg
        if ctx.hidden():
            return qtlib.markup(msg, fg=HIDDENREV_COLOR)

        parts = []
        if ctx.thgbranchhead():
            branchu = hglib.tounicode(ctx.branch())
            effects = qtlib.geteffect('log.branch')
            parts.append(qtlib.applyeffects(u' %s ' % branchu, effects))

        for mark in ctx.bookmarks():
            style = 'log.bookmark'
            if mark == self.repo._bookmarkcurrent:
                bn = self.repo._bookmarks[self.repo._bookmarkcurrent]
                if bn in self.repo.dirstate.parents():
                    style = 'log.curbookmark'
            marku = hglib.tounicode(mark)
            effects = qtlib.geteffect(style)
            parts.append(qtlib.applyeffects(u' %s ' % marku, effects))

        for tag in ctx.thgtags():
            if self.repo.thgmqtag(tag):
                style = 'log.patch'
            else:
                style = 'log.tag'
            tagu = hglib.tounicode(tag)
            effects = qtlib.geteffect(style)
            parts.append(qtlib.applyeffects(u' %s ' % tagu, effects))

        if msg:
            if ctx.thgwdparent():
                msg = qtlib.markup(msg, weight='bold')
            else:
                msg = qtlib.markup(msg)
            parts.append(hglib.tounicode(msg))

        return ' '.join(parts)
开发者ID:velorientc,项目名称:git_test7,代码行数:60,代码来源:repomodel.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: _workbench

def _workbench(ui, *pats, **opts):
    root = opts.get('root') or paths.find_root()

    # TODO: unclear that _workbench() is called inside qtrun(). maybe this
    # function should receive factory object instead of using global qtrun.
    w = qtrun.createWorkbench()
    if root:
        root = hglib.tounicode(root)
        bundle = opts.get('bundle')
        if bundle:
            w.openRepo(root, False, bundle=hglib.tounicode(bundle))
        else:
            w.showRepo(root)

        if pats:
            q = []
            for f in pats:
                pat = hglib.canonpaths([f])[0]
                if os.path.isdir(f):
                    q.append('file("%s/**")' % pat)
                elif os.path.isfile(f):
                    q.append('file("%s")' % pat)
            w.setRevsetFilter(root, ' or '.join(q))
    if w.repoTabsWidget.count() <= 0:
        w.reporegistry.setVisible(True)
    return w
开发者ID:velorientc,项目名称:git_test7,代码行数:26,代码来源:run.py

示例4: 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

示例5: __init__

    def __init__(self, title, message, parent, choices, default=None,
                 esc=None, files=None):
        QDialog.__init__(self, parent)
        self.setWindowTitle(hglib.tounicode(title))
        self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)

        self.box = QHBoxLayout()
        self.vbox = QVBoxLayout()
        self.vbox.setSpacing(8)

        self.message_lbl = QLabel()
        self.message_lbl.setText(message)
        self.vbox.addWidget(self.message_lbl)

        self.choice_combo = combo = QComboBox()
        self.choices = choices
        combo.addItems([hglib.tounicode(item) for item in choices])
        if default:
            try:
                combo.setCurrentIndex(choices.index(default))
            except:
                # Ignore a missing default value
                pass
        self.vbox.addWidget(combo)
        self.box.addLayout(self.vbox)
        vbox = QVBoxLayout()
        self.ok = QPushButton('&OK')
        self.ok.clicked.connect(self.accept)
        vbox.addWidget(self.ok)
        self.cancel = QPushButton('&Cancel')
        self.cancel.clicked.connect(self.reject)
        vbox.addWidget(self.cancel)
        vbox.addStretch()
        self.box.addLayout(vbox)
        self.setLayout(self.box)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:35,代码来源:qtlib.py

示例6: __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

示例7: 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

示例8: _updatebranchfilter

    def _updatebranchfilter(self):
        """Update the list of branches"""
        curbranch = self.branch()

        if self._abranchAction.isChecked():
            branches = sorted(set([self._repo[n].branch()
                for n in self._repo.heads()
                if not self._repo[n].extra().get('close')]))
        elif self._cbranchAction.isChecked():
            branches = sorted(self._repo.branchtags().keys())
        else:
            branches = self._repo.namedbranches

        # easy access to common branches (Python sorted() is stable)
        priomap = {self._repo.dirstate.branch(): -2, 'default': -1}
        branches = sorted(branches, key=lambda e: priomap.get(e, 0))

        self._branchReloading = True
        self._branchCombo.clear()
        self._branchCombo.addItem(self._allBranchesLabel)
        for branch in branches:
            self._branchCombo.addItem(hglib.tounicode(branch))
            self._branchCombo.setItemData(self._branchCombo.count() - 1,
                                          hglib.tounicode(branch),
                                          Qt.ToolTipRole)
        self._branchCombo.setEnabled(self.filterEnabled and bool(branches))
        self._branchReloading = False

        if curbranch and curbranch not in branches:
            self._emitBranchChanged()  # falls back to "show all"
        else:
            self.setBranch(curbranch)
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:32,代码来源:repofilter.py

示例9: onNewModeToggled

 def onNewModeToggled(self, isChecked):
     if isChecked:
         self.stwidget.tv.setEnabled(True)
         self.qnewOrRefreshBtn.setText(_('QNew'))
         self.qnewOrRefreshBtn.setEnabled(True)
         self.messageEditor.setEnabled(True)
         self.patchNameLE.setEnabled(True)
         self.patchNameLE.setFocus()
         self.patchNameLE.setText(mqutil.defaultNewPatchName(self.repo))
         self.patchNameLE.selectAll()
         self.setMessage('')
     else:
         self.qnewOrRefreshBtn.setText(_('QRefresh'))
         pctx = self.repo.changectx('.')
         if 'qtip' in pctx.tags():
             self.messageEditor.setEnabled(True)
             self.setMessage(hglib.tounicode(pctx.description()))
             name = self.repo.mq.applied[-1].name
             self.patchNameLE.setText(hglib.tounicode(name))
             self.qnewOrRefreshBtn.setEnabled(True)
             self.stwidget.tv.setEnabled(True)
         else:
             self.messageEditor.setEnabled(False)
             self.qnewOrRefreshBtn.setEnabled(False)
             self.stwidget.tv.setEnabled(False)
             self.patchNameLE.setText('')
             self.setMessage('')
         self.patchNameLE.setEnabled(False)
     self.refreshStatus()
开发者ID:velorientc,项目名称:git_test7,代码行数:29,代码来源:mq.py

示例10: onGuardConfigure

 def onGuardConfigure(self):
     item = self.queueListWidget.currentItem()
     patch = item._thgpatch
     if item._thgguards:
         uguards = hglib.tounicode(' '.join(item._thgguards))
     else:
         uguards = ''
     new, ok = qtlib.getTextInput(self,
                   _('Configure guards'),
                   _('Input new guards for %s:') % hglib.tounicode(patch),
                   text=uguards)
     if not ok or new == uguards:
         return
     guards = []
     for guard in hglib.fromunicode(new).split(' '):
         guard = guard.strip()
         if not guard:
             continue
         if not (guard[0] == '+' or guard[0] == '-'):
             self.showMessage.emit(_('Guards must begin with "+" or "-"'))
             continue
         guards.append(guard)
     cmdline = ['qguard', '-R', self.repo.root, '--', patch]
     if guards:
         cmdline += guards
     else:
         cmdline.insert(3, '--none')
     if self.cmd.running():
         return
     self.repo.incrementBusyCount()
     self.qtbar.setEnabled(False)
     self.cmd.run(cmdline)
开发者ID:velorientc,项目名称:git_test7,代码行数:32,代码来源:mq.py

示例11: startMonitoring

 def startMonitoring(self):
     """Start filesystem monitoring to notify changes automatically"""
     if not self._fswatcher:
         self._fswatcher = QFileSystemWatcher(self)
         self._fswatcher.directoryChanged.connect(self._pollChanges)
         self._fswatcher.fileChanged.connect(self._pollChanges)
     self._fswatcher.addPath(hglib.tounicode(self.repo.path))
     self._fswatcher.addPath(hglib.tounicode(self.repo.spath))
     self.addMissingPaths()
     self._fswatcher.blockSignals(False)
开发者ID:velorientc,项目名称:git_test7,代码行数:10,代码来源:thgrepo.py

示例12: init

    def init(self):
        dest = self.getPath()

        if dest == '':
            qtlib.ErrorMsgBox(_('Error executing init'),
                    _('Destination path is empty'),
                    _('Please enter the directory path'))
            self.dest_edit.setFocus()
            return False

        dest = os.path.normpath(dest)
        self.dest_edit.setText(hglib.tounicode(dest))
        udest = self.dest_edit.text()

        if not os.path.exists(dest):
            p = dest
            l = 0
            while not os.path.exists(p):
                l += 1
                p, t = os.path.split(p)
                if not t:
                    break  # already root path
            if l > 1:
                res = qtlib.QuestionMsgBox(_('Init'),
                        _('Are you sure about adding the new repository '
                          '%d extra levels deep?') % l,
                        _('Path exists up to:\n%s\nand you asked for:\n%s')
                            % (p, udest),
                        defaultbutton=QMessageBox.No)
                if not res:
                    self.dest_edit.setFocus()
                    return
            try:
                # create the folder, just like Hg would
                os.makedirs(dest)
            except:
                qtlib.ErrorMsgBox(_('Error executing init'),
                        _('Cannot create folder %s') % udest)
                return False

        _ui = ui.ui()

        # dotencode is the new default repo format in Mercurial 1.7
        if self.make_pre_1_7_chk.isChecked():
            _ui.setconfig('format', 'dotencode', 'False')

        try:
            # create the new repo
            hg.repository(_ui, dest, create=1)
        except error.RepoError, inst:
            qtlib.ErrorMsgBox(_('Error executing init'),
                    _('Unable to create new repository'),
                    hglib.tounicode(str(inst)))
            return False
开发者ID:gilshwartz,项目名称:tortoisehg-caja,代码行数:54,代码来源:hginit.py

示例13: revert

 def revert(self):
     assert(self.curcl.endswith('(pending)'))
     cmdline = ['p4revert', '--verbose',
                '--config', 'extensions.perfarce=',
                '--repository', hglib.tounicode(self.url),
                hglib.tounicode(self.curcl[:-10])]
     self.bb.button(QDialogButtonBox.Ok).setEnabled(False)
     self.bb.button(QDialogButtonBox.Discard).setEnabled(False)
     self.showMessage.emit(_('Reverting p4 changelist...'))
     self._cmdsession = sess = self._repoagent.runCommand(cmdline, self)
     sess.commandFinished.connect(self.commandFinished)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:11,代码来源:p4pending.py

示例14: deleteShelfB

 def deleteShelfB(self):
     shelf = self.currentPatchB()
     ushelf = hglib.tounicode(os.path.basename(shelf))
     if not qtlib.QuestionMsgBox(_('Are you sure?'),
                                 _('Delete shelf file %s?') % ushelf):
         return
     try:
         os.unlink(shelf)
         self.showMessage(_('Shelf deleted'))
     except EnvironmentError, e:
         self.showMessage(hglib.tounicode(str(e)))
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:11,代码来源:shelve.py

示例15: rename

def rename(ui, repoagent, source=None, dest=None, **opts):
    """rename dialog"""
    from tortoisehg.hgqt import rename as renamemod
    repo = repoagent.rawRepo()
    cwd = repo.getcwd()
    if source:
        source = hglib.tounicode(pathutil.canonpath(repo.root, cwd, source))
    if dest:
        dest = hglib.tounicode(pathutil.canonpath(repo.root, cwd, dest))
    iscopy = (opts.get('alias') == 'copy')
    return renamemod.RenameDialog(repoagent, None, source, dest, iscopy)
开发者ID:seewindcn,项目名称:tortoisehg,代码行数:11,代码来源:run.py


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