本文整理汇总了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)
示例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)
示例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)
示例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)
示例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)
示例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
示例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()