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


Python QByteArray.size方法代码示例

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


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

示例1: dataReceive

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import size [as 别名]
    def dataReceive(self):
        while self.udpSocket.hasPendingDatagrams():
            try:
                if self.broadFlag == False:
                    continue

                datagram = QByteArray()
                datagram.resize(self.udpSocket.pendingDatagramSize())

                msglist = self.udpSocket.readDatagram(datagram.size())
                msg = msglist[0]
                if len(msg) <= 21:
                    print "msg data smaller" 
                    continue
                timetemp = msg[0:17]
                datanumth = msg[17:19]
                datatotalnum = msg[19:21]
                datacontent = msg[21:]

                self.addToLocal(timetemp,datanumth,datatotalnum,datacontent)

                del msg 
                del datacontent 
            except Exception, e:
                del datacontent 
                self.logger.error(e.message) 
开发者ID:siwenhu,项目名称:client_broadcast,代码行数:28,代码来源:socketthreadtwo.py

示例2: dataReceive

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import size [as 别名]
    def dataReceive(self):
        while self.udpSocket.hasPendingDatagrams():
            try:
                datagram = QByteArray()
                datagram.resize(self.udpSocket.pendingDatagramSize())

                msglist = self.udpSocket.readDatagram(datagram.size())
                if self.broadFlag == False:
                    continue
                if len(msglist[0]) <= 21:
                    self.logger.info("msg data smaller") 
                    continue
                msg = msglist[0]
                timetemp = msg[0:17]
                datanumth = msg[17:19]
                datatotalnum = msg[19:21]
                datacontent = msg[21:]

                self.addToLocal(timetemp,datanumth,datatotalnum,datacontent)

                #del msg 
                #del datacontent 
            except Exception, e:
                #del datacontent 
                f = open("/opt/morningcloud/massclouds/record.txt", 'a')
                traceback.print_exc(file=f)
                f.flush()
                f.close()
                self.logger.error(e.message) 
开发者ID:siwenhu,项目名称:client_broadcast,代码行数:31,代码来源:main.py

示例3: read

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import size [as 别名]
 def read(self, size):
     content = self.content
     self.content = ""
     # content = string while the input parameter size in QByteArray
     data = QByteArray(content)
     data.chop(data.size() - size)
     return str(data)
开发者ID:cccs-ip,项目名称:inasafe,代码行数:9,代码来源:test_osm_downloader.py

示例4: dataReceiveTwo

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import size [as 别名]
 def dataReceiveTwo(self):
     while self.udpSocketTwo.hasPendingDatagrams():
         datagram = QByteArray()
         datagram.resize(self.udpSocketTwo.pendingDatagramSize())
         msglist = self.udpSocketTwo.readDatagram(datagram.size())
         msg = str(msglist[0])
         
     self.parseMsg(msg)
开发者ID:siwenhu,项目名称:test_client_broadcast,代码行数:10,代码来源:socketthreadtwo.py

示例5: dataReceiveTest

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import size [as 别名]
    def dataReceiveTest(self):
        while self.udpSocket.hasPendingDatagrams():
            try:
                datagram = QByteArray()
                datagram.resize(self.udpSocket.pendingDatagramSize())

                self.udpSocket.readDatagram(datagram.size())

            except Exception, e:
                #del datacontent 
                f = open("/opt/morningcloud/massclouds/record.txt", 'a')
                traceback.print_exc(file=f)
                f.flush()
                f.close()
                self.logger.error(e.message) 
开发者ID:siwenhu,项目名称:client_broadcast,代码行数:17,代码来源:main.py

示例6: dataReceive

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import size [as 别名]
    def dataReceive(self):
        self.datareceivenum+=1
        while self.udpSocket.hasPendingDatagrams():
            datagram = QByteArray()
            datagram.resize(self.udpSocket.pendingDatagramSize())

            msglist = self.udpSocket.readDatagram(datagram.size())
            if self.broadFlag == False:
                continue
            msg = msglist[0]
            timetemp = msg[0:17]
            datanumth = msg[17:19]
            datatotalnum = msg[19:21]
            datacontent = msg[21:]
            
            self.addToLocal(timetemp,datanumth,datatotalnum,datacontent)
            self.datanum+=1
开发者ID:siwenhu,项目名称:test_client_broadcast,代码行数:19,代码来源:socketthreadtwo.py

示例7: size

# 需要导入模块: from PyQt4.QtCore import QByteArray [as 别名]
# 或者: from PyQt4.QtCore.QByteArray import size [as 别名]
 def size(self):
     data = QByteArray(self.content)
     return data.size()
开发者ID:cccs-ip,项目名称:inasafe,代码行数:5,代码来源:test_osm_downloader.py


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