Runnable with both Python3 and Python2, with both PyQt5 and PyQt4 by using Qt.py #2250

Open
kashikoibumi wants to merge 127 commits from kashikoibumi/py3qt into v0.6
2 changed files with 7 additions and 8 deletions
Showing only changes of commit e5c065416f - Show all commits

View File

@ -1055,7 +1055,7 @@ class objectProcessor(threading.Thread):
logger.info('ackdata checksum wrong. Not sending ackdata.')
return False
command = command.rstrip(b'\x00')
if command != 'object':
if command != b'object':
return False
return True

View File

@ -2,7 +2,6 @@
Message encoding end decoding functions
"""
import string
import zlib
import messagetypes
@ -100,14 +99,14 @@ class MsgDecode(object):
def decodeExtended(self, data):
"""Handle extended encoding"""
dc = zlib.decompressobj()
tmp = ""
tmp = b""
while len(tmp) <= config.safeGetInt("zlib", "maxsize"):
try:
got = dc.decompress(
data, config.safeGetInt("zlib", "maxsize")
+ 1 - len(tmp))
# EOF
if got == "":
if got == b"":
break
tmp += got
data = dc.unconsumed_tail
@ -143,7 +142,7 @@ class MsgDecode(object):
def decodeSimple(self, data):
"""Handle simple encoding"""
bodyPositionIndex = string.find(data, '\nBody:')
bodyPositionIndex = data.find(b'\nBody:')
if bodyPositionIndex > 1:
subject = data[8:bodyPositionIndex]
# Only save and show the first 500 characters of the subject.
@ -151,10 +150,10 @@ class MsgDecode(object):
subject = subject[:500]
body = data[bodyPositionIndex + 6:]
else:
subject = ''
subject = b''
body = data
# Throw away any extra lines (headers) after the subject.
if subject:
subject = subject.splitlines()[0]
self.subject = subject
self.body = body
self.subject = subject.decode("utf-8", "replace")
self.body = body.decode("utf-8", "replace")