Skip to content

Commit 936369d

Browse files
committed
manual implement Github issue #223
1 parent a6c9ff2 commit 936369d

2 files changed

Lines changed: 11 additions & 8 deletions

File tree

src/bitmessagemain.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,17 @@ def run(self):
6868
if shared.shutdown:
6969
break
7070
random.seed()
71+
shared.knownNodesLock.acquire()
7172
HOST, = random.sample(shared.knownNodes[self.streamNumber], 1)
73+
shared.knownNodesLock.release()
7274
alreadyAttemptedConnectionsListLock.acquire()
7375
while HOST in alreadyAttemptedConnectionsList or HOST in shared.connectedHostsList:
7476
alreadyAttemptedConnectionsListLock.release()
7577
# print 'choosing new sample'
7678
random.seed()
77-
HOST, = random.sample(shared.knownNodes[
78-
self.streamNumber], 1)
79+
shared.knownNodesLock.acquire()
80+
HOST, = random.sample(shared.knownNodes[self.streamNumber], 1)
81+
shared.knownNodesLock.release()
7982
time.sleep(1)
8083
# Clear out the alreadyAttemptedConnectionsList every half
8184
# hour so that this program will again attempt a connection

src/bitmessageqt/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1076,8 +1076,8 @@ def setStatusIcon(self, color):
10761076
shared.statusIconColor = 'red'
10771077
# if the connection is lost then show a notification
10781078
if self.connected:
1079-
self.notifierShow('Bitmessage', _translate(
1080-
"MainWindow", "Connection lost"))
1079+
self.notifierShow('Bitmessage', unicode(_translate(
1080+
"MainWindow", "Connection lost").toUtf8(),'utf-8'))
10811081
self.connected = False
10821082

10831083
if self.actionStatus is not None:
@@ -1109,8 +1109,8 @@ def setStatusIcon(self, color):
11091109
QIcon(":/newPrefix/images/greenicon.png"))
11101110
shared.statusIconColor = 'green'
11111111
if not self.connected:
1112-
self.notifierShow('Bitmessage', _translate(
1113-
"MainWindow", "Connected"))
1112+
self.notifierShow('Bitmessage', unicode(_translate(
1113+
"MainWindow", "Connected").toUtf8(),'utf-8'))
11141114
self.connected = True
11151115

11161116
if self.actionStatus is not None:
@@ -1582,12 +1582,12 @@ def displayNewInboxMessage(self, inventoryHash, toAddress, fromAddress, subject,
15821582
newItem = QtGui.QTableWidgetItem(unicode(fromAddress, 'utf-8'))
15831583
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
15841584
if shared.config.getboolean('bitmessagesettings', 'showtraynotifications'):
1585-
self.notifierShow('New Message', 'From ' + fromAddress)
1585+
self.notifierShow(unicode(_translate("MainWindow",'New Message').toUtf8(),'utf-8'), unicode(_translate("MainWindow",'From ').toUtf8(),'utf-8') + unicode(fromAddress, 'utf-8'))
15861586
else:
15871587
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
15881588
newItem.setToolTip(unicode(unicode(fromLabel, 'utf-8')))
15891589
if shared.config.getboolean('bitmessagesettings', 'showtraynotifications'):
1590-
self.notifierShow('New Message', 'From ' + fromLabel)
1590+
self.notifierShow(unicode(_translate("MainWindow",'New Message').toUtf8(),'utf-8'), unicode(_translate("MainWindow",'From ').toUtf8(),'utf-8') + unicode(fromLabel, 'utf-8'))
15911591
newItem.setData(Qt.UserRole, str(fromAddress))
15921592
newItem.setFont(font)
15931593
self.ui.tableWidgetInbox.setItem(0, 1, newItem)

0 commit comments

Comments
 (0)