Runnable with both Python3 and Python2, with PyQt4 #2249
|
@ -424,7 +424,7 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
def rerenderTabTreeSubscriptions(self):
|
||||
treeWidget = self.ui.treeWidgetSubscriptions
|
||||
folders = Ui_FolderWidget.folderWeight.keys()
|
||||
folders.remove("new")
|
||||
Ui_FolderWidget.folderWeight.pop("new", None)
|
||||
|
||||
# sort ascending when creating
|
||||
if treeWidget.topLevelItemCount() == 0:
|
||||
|
@ -1702,7 +1702,7 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
addressVersionNumber, streamNumberForAddress,
|
||||
"regenerated deterministic address",
|
||||
dialog.spinBoxNumberOfAddressesToMake.value(),
|
||||
ustr(dialog.lineEditPassphrase.text()),
|
||||
ustr(dialog.lineEditPassphrase.text()).encode("utf-8", "replace"),
|
||||
dialog.checkBoxEighteenByteRipe.isChecked()
|
||||
))
|
||||
self.ui.tabWidget.setCurrentIndex(
|
||||
|
@ -3770,7 +3770,7 @@ class MyForm(settingsmixin.SMainWindow):
|
|||
def setAvatar(self, addressAtCurrentRow):
|
||||
if not os.path.exists(state.appdata + 'avatars/'):
|
||||
os.makedirs(state.appdata + 'avatars/')
|
||||
hash = hashlib.md5(addBMIfNotPresent(addressAtCurrentRow)).hexdigest()
|
||||
hash = hashlib.md5(addBMIfNotPresent(addressAtCurrentRow).encode("utf-8", "replace")).hexdigest()
|
||||
extensions = [
|
||||
'PNG', 'GIF', 'JPG', 'JPEG', 'SVG', 'BMP', 'MNG', 'PBM',
|
||||
'PGM', 'PPM', 'TIFF', 'XBM', 'XPM', 'TGA']
|
||||
|
|
|
@ -153,11 +153,11 @@ class AddressPassPhraseValidatorMixin(object):
|
|||
|
||||
# check through generator
|
||||
if address is None:
|
||||
addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + ustr(passPhrase), passPhrase, False))
|
||||
addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + ustr(passPhrase), passPhrase.encode("utf-8", "replace"), False))
|
||||
else:
|
||||
addressGeneratorQueue.put(
|
||||
('joinChan', addBMIfNotPresent(address),
|
||||
"{} {}".format(str_chan, passPhrase), passPhrase, False))
|
||||
"{} {}".format(str_chan, passPhrase), passPhrase.encode("utf-8", "replace"), False))
|
||||
|
||||
if self.buttonBox.button(QtGui.QDialogButtonBox.Ok).hasFocus():
|
||||
return (self.returnValid(), s, pos)
|
||||
|
|
|
@ -56,13 +56,13 @@ class NewChanDialog(QtGui.QDialog):
|
|||
if ustr(self.chanAddress.text()) == "":
|
||||
addressGeneratorQueue.put(
|
||||
('createChan', 4, 1, str_chan + ' ' + ustr(self.chanPassPhrase.text()),
|
||||
ustr(self.chanPassPhrase.text()),
|
||||
ustr(self.chanPassPhrase.text()).encode("utf-8", "replace"),
|
||||
True))
|
||||
else:
|
||||
addressGeneratorQueue.put(
|
||||
('joinChan', addBMIfNotPresent(ustr(self.chanAddress.text())),
|
||||
str_chan + ' ' + ustr(self.chanPassPhrase.text()),
|
||||
ustr(self.chanPassPhrase.text()),
|
||||
ustr(self.chanPassPhrase.text()).encode("utf-8", "replace"),
|
||||
True))
|
||||
addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True)
|
||||
if addressGeneratorReturnValue and addressGeneratorReturnValue[0] != 'chan name does not match address':
|
||||
|
|
|
@ -38,7 +38,7 @@ def identiconize(address):
|
|||
# stripped from PIL and uses QT instead (by sendiulo, same license)
|
||||
import qidenticon
|
||||
icon_hash = hashlib.md5(
|
||||
addBMIfNotPresent(address) + identiconsuffix).hexdigest()
|
||||
(addBMIfNotPresent(address) + identiconsuffix).encode("utf-8", "replace")).hexdigest()
|
||||
use_two_colors = identicon_lib[:len('qidenticon_two')] == 'qidenticon_two'
|
||||
opacity = int(
|
||||
identicon_lib not in (
|
||||
|
@ -81,7 +81,7 @@ def avatarize(address):
|
|||
falls back to identiconize(address)
|
||||
"""
|
||||
idcon = QtGui.QIcon()
|
||||
icon_hash = hashlib.md5(addBMIfNotPresent(address)).hexdigest()
|
||||
icon_hash = hashlib.md5(addBMIfNotPresent(address).encode("utf-8", "replace")).hexdigest()
|
||||
if address == str_broadcast_subscribers:
|
||||
# don't hash [Broadcast subscribers]
|
||||
icon_hash = address
|
||||
|
|
|
@ -78,7 +78,7 @@ class BMConnectionPool(object):
|
|||
Shortcut for combined list of connections from
|
||||
`inboundConnections` and `outboundConnections` dicts
|
||||
"""
|
||||
return self.inboundConnections.values() + self.outboundConnections.values()
|
||||
return list(self.inboundConnections.values()) + list(self.outboundConnections.values())
|
||||
|
||||
def establishedConnections(self):
|
||||
"""Shortcut for list of connections having fullyEstablished == True"""
|
||||
|
@ -388,7 +388,7 @@ class BMConnectionPool(object):
|
|||
i.set_state("close")
|
||||
for i in (
|
||||
self.connections()
|
||||
+ self.listeningSockets.values() + self.udpSockets.values()
|
||||
+ list(self.listeningSockets.values()) + list(self.udpSockets.values())
|
||||
):
|
||||
if not (i.accepting or i.connecting or i.connected):
|
||||
reaper.append(i)
|
||||
|
|
|
@ -95,7 +95,7 @@ def saveKnownNodes(dirName=None):
|
|||
if dirName is None:
|
||||
dirName = state.appdata
|
||||
with knownNodesLock:
|
||||
with open(os.path.join(dirName, 'knownnodes.dat'), 'wb') as output:
|
||||
with open(os.path.join(dirName, 'knownnodes.dat'), 'w') as output:
|
||||
json_serialize_knownnodes(output)
|
||||
|
||||
|
||||
|
|
Reference in New Issue
Block a user