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


Python QByteArray.append方法代码示例

本文整理汇总了Python中PyQt5.QtCore.QByteArray.append方法的典型用法代码示例。如果您正苦于以下问题:Python QByteArray.append方法的具体用法?Python QByteArray.append怎么用?Python QByteArray.append使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtCore.QByteArray的用法示例。


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

示例1: on_caImportButton_clicked

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
    def on_caImportButton_clicked(self):
        """
        Private slot to import server certificates.
        """
        certs = self.__importCertificate()
        if certs:
            caCerts = self.__getSystemCaCertificates()
            for cert in certs:
                if cert in caCerts:
                    if qVersion() >= "5.0.0":
                        commonStr = ", ".join(cert.subjectInfo(QSslCertificate.CommonName))
                    else:
                        commonStr = cert.subjectInfo(QSslCertificate.CommonName)
                    E5MessageBox.warning(
                        self,
                        self.tr("Import Certificate"),
                        self.tr("""<p>The certificate <b>{0}</b> already exists.""" """ Skipping.</p>""").format(
                            Utilities.decodeString(commonStr)
                        ),
                    )
                else:
                    caCerts.append(cert)

            pems = QByteArray()
            for cert in caCerts:
                pems.append(cert.toPem() + "\n")
            Preferences.Prefs.settings.setValue("Help/SystemCertificates", pems)

            self.caCertificatesTree.clear()
            self.__populateCaCertificatesTree()

            self.__updateDefaultConfiguration()
开发者ID:testmana2,项目名称:test,代码行数:34,代码来源:E5SslCertificatesDialog.py

示例2: readData

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
    def readData(self, maxlen):
        data = QByteArray()
        total = 0

        while maxlen > total:
            chunk = min(self.m_buffer.size() - self.m_pos, maxlen - total)
            data.append(self.m_buffer.mid(self.m_pos, chunk))
            self.m_pos = (self.m_pos + chunk) % self.m_buffer.size()
            total += chunk

        return data.data()
开发者ID:Axel-Erfurt,项目名称:pyqt5,代码行数:13,代码来源:audiooutput.py

示例3: on_serversDeleteButton_clicked

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
 def on_serversDeleteButton_clicked(self):
     """
     Private slot to delete the selected server certificate.
     """
     itm = self.serversCertificatesTree.currentItem()
     res = E5MessageBox.yesNo(
         self,
         self.tr("Delete Server Certificate"),
         self.tr("""<p>Shall the server certificate really be"""
                 """ deleted?</p><p>{0}</p>"""
                 """<p>If the server certificate is deleted, the"""
                 """ normal security checks will be reinstantiated"""
                 """ and the server has to present a valid"""
                 """ certificate.</p>""")
         .format(itm.text(0)))
     if res:
         server = itm.text(1)
         cert = self.serversCertificatesTree.currentItem().data(
             0, self.CertRole)
         
         # delete the selected entry and its parent entry,
         # if it was the only one
         parent = itm.parent()
         parent.takeChild(parent.indexOfChild(itm))
         if parent.childCount() == 0:
             self.serversCertificatesTree.takeTopLevelItem(
                 self.serversCertificatesTree.indexOfTopLevelItem(parent))
         
         # delete the certificate from the user certificate store
         certificateDict = Preferences.toDict(
             Preferences.Prefs.settings.value("Ssl/CaCertificatesDict"))
         if server in certificateDict:
             certs = QSslCertificate.fromData(certificateDict[server])
             if cert in certs:
                 certs.remove(cert)
             if certs:
                 pems = QByteArray()
                 for cert in certs:
                     pems.append(cert.toPem() + '\n')
                 certificateDict[server] = pems
             else:
                 del certificateDict[server]
         Preferences.Prefs.settings.setValue(
             "Ssl/CaCertificatesDict",
             certificateDict)
         
         # delete the certificate from the default certificates
         self.__updateDefaultConfiguration()
开发者ID:Darriall,项目名称:eric,代码行数:50,代码来源:E5SslCertificatesDialog.py

示例4: save

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
 def save(self, fileName, selectedFilter):
     if selectedFilter == self.filters[1]:
         img = self.page().mainFrame().evaluateJavaScript("chart.getImageURI()")
         if img:
             ba = QByteArray()
             ba.append(img[22:])
             by = QByteArray.fromBase64(ba)
             image = QImage.fromData(by, "PNG")
             image.save(fileName)
         else:
             QMessageBox.warning(self.parent(),
                         self.tr("Saving"),
                         self.tr("Image not ready. Please try again later"))
     else:
         if selectedFilter == self.filters[0]:
             with open(fileName, 'wb') as f:
                 f.write(bytes(self.html_data, 'utf-8'))
开发者ID:OpenNumismat,项目名称:open-numismat,代码行数:19,代码来源:StatisticsView.py

示例5: on_serversImportButton_clicked

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
 def on_serversImportButton_clicked(self):
     """
     Private slot to import server certificates.
     """
     certs = self.__importCertificate()
     if certs:
         server = "*"
         certificateDict = Preferences.toDict(
             Preferences.Prefs.settings.value("Ssl/CaCertificatesDict"))
         if server in certificateDict:
             sCerts = QSslCertificate.fromData(certificateDict[server])
         else:
             sCerts = []
         
         pems = QByteArray()
         for cert in certs:
             if cert in sCerts:
                 if qVersion() >= "5.0.0":
                     commonStr = ", ".join(
                         cert.subjectInfo(QSslCertificate.CommonName))
                 else:
                     commonStr = cert.subjectInfo(
                         QSslCertificate.CommonName)
                 E5MessageBox.warning(
                     self,
                     self.tr("Import Certificate"),
                     self.tr(
                         """<p>The certificate <b>{0}</b> already exists."""
                         """ Skipping.</p>""")
                     .format(Utilities.decodeString(commonStr)))
             else:
                 pems.append(cert.toPem() + '\n')
         if server not in certificateDict:
             certificateDict[server] = QByteArray()
         certificateDict[server].append(pems)
         Preferences.Prefs.settings.setValue(
             "Ssl/CaCertificatesDict",
             certificateDict)
         
         self.serversCertificatesTree.clear()
         self.__populateServerCertificatesTree()
         
         self.__updateDefaultConfiguration()
开发者ID:Darriall,项目名称:eric,代码行数:45,代码来源:E5SslCertificatesDialog.py

示例6: sql_2_bytearray

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
    def sql_2_bytearray(self, val):
        """
        sql string representation to QByteArray
        :param val: {str} sql string representation
        :return: {QByteArray}
        """

        from PyQt5.QtCore import QByteArray

        try:
            elemsList = map(chr, map(int, val.split(',')))
        except:
            print 'CONFIGURATIN: COULD NOT CONVERT SETTING TO QBYTEARRAY'
            elemsList = []

        ba = QByteArray()
        for i in xrange(len(elemsList)):
            ba.append(elemsList[i])

        return ba
开发者ID:CompuCell3D,项目名称:CompuCell3D,代码行数:22,代码来源:settingdict.py

示例7: decodeLayerData

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
    def decodeLayerData(self, tileLayer, layerData, format):
        if format in [Map.LayerDataFormat.XML, Map.LayerDataFormat.CSV]:
            raise
            
        _layerData = QByteArray()
        _layerData.append(layerData)
        decodedData = QByteArray.fromBase64(_layerData)
        size = (tileLayer.width() * tileLayer.height()) * 4

        if (format == Map.LayerDataFormat.Base64Gzip or format == Map.LayerDataFormat.Base64Zlib):
            decodedData, size = decompress(decodedData, size)

        if (size != decodedData.length()):
            return DecodeError.CorruptLayerData

        data = decodedData.data()
        x = 0
        y = 0

        for i in range(0, size - 3, 4):
            gid = data[i] | data[i + 1] << 8 | data[i + 2] << 16 | data[i + 3] << 24

            result, ok = self.gidToCell(gid)
            if (not ok):
                self.mInvalidTile = gid
                if self.isEmpty():
                    return DecodeError.TileButNoTilesets
                else:
                    return DecodeError.InvalidTile

            tileLayer.setCell(x, y, result)

            x += 1
            if (x == tileLayer.width()):
                x = 0
                y += 1

        return DecodeError.NoError
开发者ID:theall,项目名称:Python-Tiled,代码行数:40,代码来源:gidmapper.py

示例8: clickAction_MessagePushButton

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
    def clickAction_MessagePushButton(self):
        temp = self.messagelineEdit.text()
        self.append_plainTextEdit_3(temp)
        self.append_plainTextEdit_3("\n")
        bArray = QByteArray()

        if self.sysencoding == "cp949":
            bArray.append(temp.encode(encoding='cp949',errors='ignore'))#독립실행시
        elif self.sysencoding == "UTF-8":
            bArray.append(temp.encode(encoding='utf-8',errors='ignore'))#pycharm
        else:
            bArray.append(temp.encode(encoding='cp949',errors='ignore'))#독립실행시
        bArray.append("\n")
        if( self.process.write(bArray) == -1):
            print("chlidprocess write error")
        self.messagelineEdit.clear()
开发者ID:louisraccoon,项目名称:PyStudy,代码行数:18,代码来源:PyPreviewer.py

示例9: on_caDeleteButton_clicked

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
 def on_caDeleteButton_clicked(self):
     """
     Private slot to delete the selected CA certificate.
     """
     itm = self.caCertificatesTree.currentItem()
     res = E5MessageBox.yesNo(
         self,
         self.tr("Delete CA Certificate"),
         self.tr(
             """<p>Shall the CA certificate really be deleted?</p>"""
             """<p>{0}</p>"""
             """<p>If the CA certificate is deleted, the browser"""
             """ will not trust any certificate issued by this CA.</p>""")
         .format(itm.text(0)))
     if res:
         cert = self.caCertificatesTree.currentItem().data(0, self.CertRole)
         
         # delete the selected entry and its parent entry,
         # if it was the only one
         parent = itm.parent()
         parent.takeChild(parent.indexOfChild(itm))
         if parent.childCount() == 0:
             self.caCertificatesTree.takeTopLevelItem(
                 self.caCertificatesTree.indexOfTopLevelItem(parent))
         
         # delete the certificate from the CA certificate store
         caCerts = self.__getSystemCaCertificates()
         if cert in caCerts:
             caCerts.remove(cert)
         pems = QByteArray()
         for cert in caCerts:
             pems.append(cert.toPem() + '\n')
         Preferences.Prefs.settings.setValue(
             "Help/SystemCertificates", pems)
         
         # delete the certificate from the default certificates
         self.__updateDefaultConfiguration()
开发者ID:Darriall,项目名称:eric,代码行数:39,代码来源:E5SslCertificatesDialog.py

示例10: run

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
    def run(self, argv, error_message, in_build_dir=False):
        """ Execute a command and capture the output. """

        if in_build_dir:
            project = self._project

            saved_cwd = os.getcwd()
            build_dir = project.path_from_user(project.build_dir)
            build_dir = QDir.toNativeSeparators(build_dir)
            os.chdir(build_dir)
            self._message_handler.verbose_message(
                    "{0} is now the current directory".format(build_dir))
        else:
            saved_cwd = None

        self._message_handler.verbose_message(
                "Running '{0}'".format(' '.join(argv)))

        QCoreApplication.processEvents()

        process = QProcess()

        process.readyReadStandardOutput.connect(
                lambda: self._message_handler.progress_message(
                        QTextCodec.codecForLocale().toUnicode(
                                process.readAllStandardOutput()).strip()))

        stderr_output = QByteArray()
        process.readyReadStandardError.connect(
                lambda: stderr_output.append(process.readAllStandardError()))

        process.start(argv[0], argv[1:])
        finished = process.waitForFinished()

        if saved_cwd is not None:
            os.chdir(saved_cwd)
            self._message_handler.verbose_message(
                    "{0} is now the current directory".format(saved_cwd))

        if not finished:
            raise UserException(error_message, process.errorString())

        if process.exitStatus() != QProcess.NormalExit or process.exitCode() != 0:
            raise UserException(error_message,
                    QTextCodec.codecForLocale().toUnicode(stderr_output).strip())
开发者ID:doudz,项目名称:pyqtdeploy,代码行数:47,代码来源:builder.py

示例11: encodeLayerData

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
    def encodeLayerData(self, tileLayer, format):
        if format in [Map.LayerDataFormat.XML, Map.LayerDataFormat.CSV]:
            raise

        tileData = QByteArray()
        for y in range(tileLayer.height()):
            for x in range(tileLayer.width()):
                gid = self.cellToGid(tileLayer.cellAt(x, y))
                tileData.append(bytes([gid&0xff]))
                tileData.append(bytes([(gid >> 8)&0xff]))
                tileData.append(bytes([(gid >> 16)&0xff]))
                tileData.append(bytes([(gid >> 24)&0xff]))
                
        if len(tileData)%4 != 0:
            raise

        if (format == Map.LayerDataFormat.Base64Gzip):
            tileData = compress(tileData, CompressionMethod.Gzip)
        elif (format == Map.LayerDataFormat.Base64Zlib):
            tileData = compress(tileData, CompressionMethod.Zlib)

        return tileData.toBase64()
开发者ID:theall,项目名称:Python-Tiled,代码行数:24,代码来源:gidmapper.py

示例12: sslErrors

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
 def sslErrors(self, errors, server, port=-1):
     """
     Public method to handle SSL errors.
     
     @param errors list of SSL errors (list of QSslError)
     @param server name of the server (string)
     @keyparam port value of the port (integer)
     @return tuple indicating to ignore the SSL errors (one of NotIgnored,
         SystemIgnored or UserIgnored) and indicating a change of the
         default SSL configuration (boolean)
     """
     caMerge = {}
     certificateDict = Globals.toDict(
         Preferences.Prefs.settings.value("Ssl/CaCertificatesDict"))
     for caServer in certificateDict:
         caMerge[caServer] = QSslCertificate.fromData(
             certificateDict[caServer])
     caNew = []
     
     errorStrings = []
     if port != -1:
         server += ":{0:d}".format(port)
     if errors:
         for err in errors:
             if err.error() == QSslError.NoError:
                 continue
             if server in caMerge and err.certificate() in caMerge[server]:
                 continue
             errorStrings.append(err.errorString())
             if not err.certificate().isNull():
                 cert = err.certificate()
                 if cert not in caNew:
                     caNew.append(cert)
     if not errorStrings:
         return E5SslErrorHandler.SystemIgnored, False
     
     errorString = '.</li><li>'.join(errorStrings)
     ret = E5MessageBox.yesNo(
         None,
         self.tr("SSL Errors"),
         self.tr("""<p>SSL Errors for <br /><b>{0}</b>"""
                 """<ul><li>{1}</li></ul></p>"""
                 """<p>Do you want to ignore these errors?</p>""")
         .format(server, errorString),
         icon=E5MessageBox.Warning)
     
     if ret:
         caRet = False
         if len(caNew) > 0:
             certinfos = []
             for cert in caNew:
                 certinfos.append(self.__certToString(cert))
             caRet = E5MessageBox.yesNo(
                 None,
                 self.tr("Certificates"),
                 self.tr(
                     """<p>Certificates:<br/>{0}<br/>"""
                     """Do you want to accept all these certificates?"""
                     """</p>""")
                 .format("".join(certinfos)))
             if caRet:
                 if server not in caMerge:
                     caMerge[server] = []
                 for cert in caNew:
                     caMerge[server].append(cert)
                 
                 sslCfg = QSslConfiguration.defaultConfiguration()
                 caList = sslCfg.caCertificates()
                 for cert in caNew:
                     caList.append(cert)
                 sslCfg.setCaCertificates(caList)
                 sslCfg.setProtocol(QSsl.AnyProtocol)
                 QSslConfiguration.setDefaultConfiguration(sslCfg)
                 
                 certificateDict = {}
                 for server in caMerge:
                     pems = QByteArray()
                     for cert in caMerge[server]:
                         pems.append(cert.toPem() + b'\n')
                     certificateDict[server] = pems
                 Preferences.Prefs.settings.setValue(
                     "Ssl/CaCertificatesDict",
                     certificateDict)
         
         return E5SslErrorHandler.UserIgnored, caRet
     
     else:
         return E5SslErrorHandler.NotIgnored, False
开发者ID:pycom,项目名称:EricShort,代码行数:90,代码来源:E5SslErrorHandler.py

示例13: Connection

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]

#.........这里部分代码省略.........
            self.abort()
            return
        
        self.write("{0}{1}1{1}p".format(
            Connection.ProtocolPing, SeparatorToken))
    
    def __sendGreetingMessage(self):
        """
        Private slot to send a greeting message.
        """
        greeting = QByteArray(self.__greetingMessage.encode("utf-8"))
        data = QByteArray("{0}{1}{2}{1}".format(
            Connection.ProtocolGreeting, SeparatorToken, greeting.size())
            .encode("utf-8")) + greeting
        if self.write(data) == data.size():
            self.__isGreetingMessageSent = True
    
    def __readDataIntoBuffer(self, maxSize=MaxBufferSize):
        """
        Private method to read some data into the buffer.
        
        @param maxSize maximum size of data to read (integer)
        @return size of data read (integer)
        """
        if maxSize > MaxBufferSize:
            return 0
        
        numBytesBeforeRead = self.__buffer.size()
        if numBytesBeforeRead == MaxBufferSize:
            self.abort()
            return 0
        
        while self.bytesAvailable() and self.__buffer.size() < maxSize:
            self.__buffer.append(self.read(1))
            if self.__buffer.endsWith(SeparatorToken):
                break
        
        return self.__buffer.size() - numBytesBeforeRead
    
    def __dataLengthForCurrentDataType(self):
        """
        Private method to get the data length for the current data type.
        
        @return data length (integer)
        """
        if self.bytesAvailable() <= 0 or \
           self.__readDataIntoBuffer() <= 0 or \
           not self.__buffer.endsWith(SeparatorToken):
            return 0
        
        self.__buffer.chop(len(SeparatorToken))
        number = self.__buffer.toInt()[0]
        self.__buffer.clear()
        return number
    
    def __readProtocolHeader(self):
        """
        Private method to read the protocol header.
        
        @return flag indicating a successful read (boolean)
        """
        if self.__transferTimerId:
            self.killTimer(self.__transferTimerId)
            self.__transferTimerId = 0
        
        if self.__readDataIntoBuffer() <= 0:
开发者ID:testmana2,项目名称:test,代码行数:70,代码来源:Connection.py

示例14: __procFinished

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
 def __procFinished(self, exitCode, exitStatus):
     """
     Private slot connected to the finished signal.
     
     @param exitCode exit code of the process (integer)
     @param exitStatus exit status of the process (QProcess.ExitStatus)
     """
     self.inputGroup.setEnabled(False)
     self.inputGroup.hide()
     
     self.contents.clear()
     
     lvers = 1
     for s in self.buf:
         rev_match = False
         if self.rx_rev.exactMatch(s):
             ver = self.rx_rev.cap(1)
             author = self.rx_rev.cap(2)
             date = self.rx_rev.cap(3)
             # number of lines is ignored
             rev_match = True
         elif self.rx_rev2.exactMatch(s):
             ver = self.rx_rev2.cap(1)
             author = self.rx_rev2.cap(2)
             date = self.rx_rev2.cap(3)
             # number of lines is ignored
             rev_match = True
         
         if rev_match:
             dstr = '<b>{0} {1}</b>'.format(self.revString, ver)
             try:
                 lv = self.revisions[lvers]
                 lvers += 1
                 url = QUrl()
                 url.setScheme("file")
                 url.setPath(self.filename)
                 if qVersion() >= "5.0.0":
                     query = lv + '_' + ver
                     url.setQuery(query)
                 else:
                     query = QByteArray()
                     query.append(lv).append('_').append(ver)
                     url.setEncodedQuery(query)
                 dstr += ' [<a href="{0}" name="{1}">{2}</a>]'.format(
                     url.toString(), query,
                     self.tr('diff to {0}').format(lv),
                 )
             except IndexError:
                 pass
             dstr += '<br />\n'
             self.contents.insertHtml(dstr)
             
             dstr = self.tr('<i>author: {0}</i><br />\n').format(author)
             self.contents.insertHtml(dstr)
             
             dstr = self.tr('<i>date: {0}</i><br />\n').format(date)
             self.contents.insertHtml(dstr)
         
         elif self.rx_sep.exactMatch(s) or self.rx_sep2.exactMatch(s):
             self.contents.insertHtml('<hr />\n')
         
         elif self.rx_flags.exactMatch(s):
             dstr = self.flags[self.rx_flags.cap(1)]
             dstr += self.rx_flags.cap(2)
             dstr += '<br />\n'
             self.contents.insertHtml(dstr)
         
         elif self.rx_changed.exactMatch(s):
             dstr = '<br />{0}<br />\n'.format(s)
             self.contents.insertHtml(dstr)
         
         else:
             if s == "":
                 s = self.contents.insertHtml('<br />\n')
             else:
                 self.contents.insertHtml(Utilities.html_encode(s))
                 self.contents.insertHtml('<br />\n')
     
     tc = self.contents.textCursor()
     tc.movePosition(QTextCursor.Start)
     self.contents.setTextCursor(tc)
     self.contents.ensureCursorVisible()
开发者ID:pycom,项目名称:EricShort,代码行数:84,代码来源:SvnLogDialog.py

示例15: __finish

# 需要导入模块: from PyQt5.QtCore import QByteArray [as 别名]
# 或者: from PyQt5.QtCore.QByteArray import append [as 别名]
 def __finish(self):
     """
     Private slot called when the process finished or the user pressed
     the button.
     """
     self.inputGroup.setEnabled(False)
     self.inputGroup.hide()
     
     self.contents.clear()
     
     if not self.logEntries:
         self.errors.append(self.tr("No log available for '{0}'")
                            .format(self.filename))
         self.errorGroup.show()
         return
     
     html = ""
     
     if self.initialText:
         for line in self.initialText:
             html += Utilities.html_encode(line.strip())
             html += '<br />\n'
         html += '{0}<br/>\n'.format(80 * "=")
         
     for entry in self.logEntries:
         fileCopies = {}
         if entry["file_copies"]:
             for fentry in entry["file_copies"].split(", "):
                 newName, oldName = fentry[:-1].split(" (")
                 fileCopies[newName] = oldName
         
         rev, hexRev = entry["change"].split(":")
         dstr = '<p><b>{0} {1}</b>'.format(self.revString, entry["change"])
         if entry["parents"]:
             parents = entry["parents"].split()
         else:
             parents = self.__getParents(rev)
         for parent in parents:
             url = QUrl()
             url.setScheme("file")
             url.setPath(self.filename)
             if qVersion() >= "5.0.0":
                 query = parent.split(":")[0] + '_' + rev
                 url.setQuery(query)
             else:
                 query = QByteArray()
                 query.append(parent.split(":")[0]).append('_').append(rev)
                 url.setEncodedQuery(query)
             dstr += ' [<a href="{0}" name="{1}" id="{1}">{2}</a>]'.format(
                 url.toString(), query,
                 self.tr('diff to {0}').format(parent),
             )
         dstr += '<br />\n'
         html += dstr
         
         if "phase" in entry:
             html += self.tr("Phase: {0}<br />\n")\
                 .format(entry["phase"])
         
         html += self.tr("Branch: {0}<br />\n")\
             .format(entry["branches"])
         
         html += self.tr("Tags: {0}<br />\n").format(entry["tags"])
         
         if "bookmarks" in entry:
             html += self.tr("Bookmarks: {0}<br />\n")\
                 .format(entry["bookmarks"])
         
         html += self.tr("Parents: {0}<br />\n")\
             .format(entry["parents"])
         
         html += self.tr('<i>Author: {0}</i><br />\n')\
             .format(Utilities.html_encode(entry["user"]))
         
         date, time = entry["date"].split()[:2]
         html += self.tr('<i>Date: {0}, {1}</i><br />\n')\
             .format(date, time)
         
         for line in entry["description"]:
             html += Utilities.html_encode(line.strip())
             html += '<br />\n'
         
         if entry["file_adds"]:
             html += '<br />\n'
             for f in entry["file_adds"].strip().split(", "):
                 if f in fileCopies:
                     html += self.tr(
                         'Added {0} (copied from {1})<br />\n')\
                         .format(Utilities.html_encode(f),
                                 Utilities.html_encode(fileCopies[f]))
                 else:
                     html += self.tr('Added {0}<br />\n')\
                         .format(Utilities.html_encode(f))
         
         if entry["files_mods"]:
             html += '<br />\n'
             for f in entry["files_mods"].strip().split(", "):
                 html += self.tr('Modified {0}<br />\n')\
                     .format(Utilities.html_encode(f))
         
#.........这里部分代码省略.........
开发者ID:pycom,项目名称:EricShort,代码行数:103,代码来源:HgLogDialog.py


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