From da0f48617976dd38f368180498cf4835a2987605 Mon Sep 17 00:00:00 2001 From: Jonathan Warren Date: Tue, 18 Jun 2013 13:11:30 -0400 Subject: [PATCH] manually merge github pull request: Unicode chars in localtime prevented the gui from starting --- src/bitmessageqt/__init__.py | 14 +++++++------- src/defaultKnownNodes.py | 2 +- src/messages.dat reader.py | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index cf3c1424..86f24247 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -469,31 +469,31 @@ class MyForm(QtGui.QMainWindow): "MainWindow", "Queued.") elif status == 'msgsent': statusText = _translate("MainWindow", "Message sent. Waiting on acknowledgement. Sent at %1").arg( - unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)))) + unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8')) elif status == 'doingmsgpow': statusText = _translate( "MainWindow", "Need to do work to send message. Work is queued.") elif status == 'ackreceived': statusText = _translate("MainWindow", "Acknowledgement of the message received %1").arg( - unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(lastactiontime))))) + unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8')) elif status == 'broadcastqueued': statusText = _translate( "MainWindow", "Broadcast queued.") elif status == 'broadcastsent': statusText = _translate("MainWindow", "Broadcast on %1").arg(unicode(strftime( - shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(lastactiontime))))) + shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8')) elif status == 'toodifficult': statusText = _translate("MainWindow", "Problem: The work demanded by the recipient is more difficult than you are willing to do. %1").arg( - unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(lastactiontime))))) + unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8')) elif status == 'badkey': statusText = _translate("MainWindow", "Problem: The recipient\'s encryption key is no good. Could not encrypt message. %1").arg( - unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(lastactiontime))))) + unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8')) elif status == 'forcepow': statusText = _translate( "MainWindow", "Forced difficulty override. Send should start soon.") else: statusText = _translate("MainWindow", "Unknown status: %1 %2").arg(status).arg(unicode( - strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(lastactiontime))))) + strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime)),'utf-8')) newItem = myTableWidgetItem(statusText) newItem.setToolTip(statusText) newItem.setData(Qt.UserRole, QByteArray(ackdata)) @@ -547,7 +547,7 @@ class MyForm(QtGui.QMainWindow): self.statusbar = self.statusBar() self.statusbar.insertPermanentWidget(0, self.ui.pushButtonStatusIcon) self.ui.labelStartupTime.setText(_translate("MainWindow", "Since startup on %1").arg( - unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time())))))) + unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))),'utf-8'))) self.numberOfMessagesProcessed = 0 self.numberOfBroadcastsProcessed = 0 self.numberOfPubkeysProcessed = 0 diff --git a/src/defaultKnownNodes.py b/src/defaultKnownNodes.py index 8e7573cd..4f4e80ce 100644 --- a/src/defaultKnownNodes.py +++ b/src/defaultKnownNodes.py @@ -52,7 +52,7 @@ def readDefaultKnownNodes(appdata): for stream, storedValue in knownNodes.items(): for host,value in storedValue.items(): port, storedtime = storedValue[host] - print host, '\t', port, '\t', unicode(strftime('%a, %d %b %Y %I:%M %p',localtime(storedtime))) + print host, '\t', port, '\t', unicode(strftime('%a, %d %b %Y %I:%M %p',localtime(storedtime)),'utf-8') if __name__ == "__main__": diff --git a/src/messages.dat reader.py b/src/messages.dat reader.py index b5ade9ff..90f4bedc 100644 --- a/src/messages.dat reader.py +++ b/src/messages.dat reader.py @@ -53,13 +53,13 @@ def readSubscriptions(): def readPubkeys(): print 'Printing everything in pubkeys table:' - item = '''select hash, havecorrectnonce, transmitdata, time, usedpersonally from pubkeys''' + item = '''select hash, transmitdata, time, usedpersonally from pubkeys''' parameters = '' cur.execute(item, parameters) output = cur.fetchall() for row in output: - hash, havecorrectnonce, transmitdata, time, usedpersonally = row - print 'Hash:', hash.encode('hex'), '\tHave correct nonce:', havecorrectnonce, '\tTime first broadcast:', unicode(strftime('%a, %d %b %Y %I:%M %p',localtime(time))), '\tUsed by me personally:', usedpersonally, '\tFull pubkey message:', transmitdata.encode('hex') + hash, transmitdata, time, usedpersonally = row + print 'Hash:', hash.encode('hex'), '\tTime first broadcast:', unicode(strftime('%a, %d %b %Y %I:%M %p',localtime(time)),'utf-8'), '\tUsed by me personally:', usedpersonally, '\tFull pubkey message:', transmitdata.encode('hex') def readInventory(): print 'Printing everything in inventory table:' @@ -69,7 +69,7 @@ def readInventory(): output = cur.fetchall() for row in output: hash, objecttype, streamnumber, payload, receivedtime = row - print 'Hash:', hash.encode('hex'), objecttype, streamnumber, '\t', payload.encode('hex'), '\t', unicode(strftime('%a, %d %b %Y %I:%M %p',localtime(receivedtime))) + print 'Hash:', hash.encode('hex'), objecttype, streamnumber, '\t', payload.encode('hex'), '\t', unicode(strftime('%a, %d %b %Y %I:%M %p',localtime(receivedtime)),'utf-8') def takeInboxMessagesOutOfTrash():