Merge remote-tracking branch 'upstream/master'

This commit is contained in:
fuzzgun 2013-05-14 17:03:13 +01:00
commit f0a2c65b2e
4 changed files with 143 additions and 87 deletions

View File

@ -25,12 +25,12 @@ print jsonAddresses
print 'Now that we have our address data in a nice Python data structure, let\'s look at the first address (index 0) and print its label:'
print jsonAddresses['addresses'][0]['label']
print 'Uncomment the next two lines to create a new random address.'
print 'Uncomment the next two lines to create a new random address with slightly a slightly higher difficulty setting than normal.'
#addressLabel = 'new address label'.encode('base64')
#print api.createRandomAddress(addressLabel)
#print api.createRandomAddress(addressLabel,False,1.05,1.1111)
print 'Uncomment these next four lines to create new deterministic addresses.'
#passphrase = 'asdfasdfqwer'.encode('base64')
#passphrase = 'asdfasdfqwser'.encode('base64')
#jsonDeterministicAddresses = api.createDeterministicAddresses(passphrase, 2, 3, 1, False)
#print jsonDeterministicAddresses
#print json.loads(jsonDeterministicAddresses)

View File

@ -210,20 +210,20 @@ class singleListener(threading.Thread):
print 'incoming connection is from a host in shared.connectedHostsList (we are already connected to it). Ignoring it.'
a.close()
a,(HOST,PORT) = sock.accept()"""
rd = receiveDataThread()
rd.daemon = True # close the main program even if there are threads left
#self.emit(SIGNAL("passObjectThrough(PyQt_PyObject)"),rd)
objectsOfWhichThisRemoteNodeIsAlreadyAware = {}
rd.setup(a,HOST,PORT,-1,objectsOfWhichThisRemoteNodeIsAlreadyAware)
shared.printLock.acquire()
print self, 'connected to', HOST,'during INCOMING request.'
shared.printLock.release()
rd.start()
sd = sendDataThread()
sd.setup(a,HOST,PORT,-1,objectsOfWhichThisRemoteNodeIsAlreadyAware)
sd.start()
rd = receiveDataThread()
rd.daemon = True # close the main program even if there are threads left
rd.setup(a,HOST,PORT,-1,objectsOfWhichThisRemoteNodeIsAlreadyAware)
rd.start()
shared.printLock.acquire()
print self, 'connected to', HOST,'during INCOMING request.'
shared.printLock.release()
#This thread is created either by the synSenderThread(for outgoing connections) or the singleListenerThread(for incoming connectiosn).
class receiveDataThread(threading.Thread):
@ -297,7 +297,9 @@ class receiveDataThread(threading.Thread):
try:
del shared.connectedHostsList[self.HOST]
except Exception, err:
shared.printLock.acquire()
print 'Could not delete', self.HOST, 'from shared.connectedHostsList.', err
shared.printLock.release()
shared.UISignalQueue.put(('updateNetworkStatusTab','no data'))
shared.printLock.acquire()
print 'The size of the connectedHostsList is now:', len(shared.connectedHostsList)
@ -2046,7 +2048,6 @@ class sendDataThread(threading.Thread):
shared.printLock.release()
self.versionSent = 1
def run(self):
while True:
deststream,command,data = self.mailbox.get()
@ -2222,8 +2223,11 @@ def signal_handler(signal, frame):
def connectToStream(streamNumber):
selfInitiatedConnections[streamNumber] = {}
for i in range(32):
if sys.platform[0:3] == 'win':
maximumNumberOfHalfOpenConnections = 9
else:
maximumNumberOfHalfOpenConnections = 32
for i in range(maximumNumberOfHalfOpenConnections):
a = outgoingSynSender()
a.setup(streamNumber)
a.start()
@ -3201,13 +3205,27 @@ class addressGenerator(threading.Thread):
def run(self):
while True:
addressVersionNumber,streamNumber,label,numberOfAddressesToMake,deterministicPassphrase,eighteenByteRipe = shared.addressGeneratorQueue.get()
queueValue = shared.addressGeneratorQueue.get()
nonceTrialsPerByte = 0
payloadLengthExtraBytes = 0
if len(queueValue) == 6:
addressVersionNumber,streamNumber,label,numberOfAddressesToMake,deterministicPassphrase,eighteenByteRipe = queueValue
elif len(queueValue) == 8:
addressVersionNumber,streamNumber,label,numberOfAddressesToMake,deterministicPassphrase,eighteenByteRipe,nonceTrialsPerByte,payloadLengthExtraBytes = queueValue
else:
sys.stderr.write('Programming error: A structure with the wrong number of values was passed into the addressGeneratorQueue. Here is the queueValue: %s\n' % queueValue)
if addressVersionNumber < 3 or addressVersionNumber > 3:
sys.stderr.write('Program error: For some reason the address generator queue has been given a request to create version', addressVersionNumber,' addresses which it cannot do.\n')
if addressVersionNumber == 3:
sys.stderr.write('Program error: For some reason the address generator queue has been given a request to create at least one version %s address which it cannot do.\n' % addressVersionNumber)
if nonceTrialsPerByte == 0:
nonceTrialsPerByte = shared.config.getint('bitmessagesettings','defaultnoncetrialsperbyte')
if nonceTrialsPerByte < shared.networkDefaultProofOfWorkNonceTrialsPerByte:
nonceTrialsPerByte = shared.networkDefaultProofOfWorkNonceTrialsPerByte
if payloadLengthExtraBytes == 0:
payloadLengthExtraBytes = shared.config.getint('bitmessagesettings','defaultpayloadlengthextrabytes')
if payloadLengthExtraBytes < shared.networkDefaultPayloadLengthExtraBytes:
payloadLengthExtraBytes = shared.networkDefaultPayloadLengthExtraBytes
if addressVersionNumber == 3: #currently the only one supported.
if deterministicPassphrase == "":
#statusbar = 'Generating one new address'
#self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"),statusbar)
shared.UISignalQueue.put(('updateStatusBar','Generating one new address'))
#This next section is a little bit strange. We're going to generate keys over and over until we
#find one that starts with either \x00 or \x00\x00. Then when we pack them into a Bitmessage address,
@ -3236,7 +3254,6 @@ class addressGenerator(threading.Thread):
print 'Generated address with ripe digest:', ripe.digest().encode('hex')
print 'Address generator calculated', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix, 'addresses at', numberOfAddressesWeHadToMakeBeforeWeFoundOneWithTheCorrectRipePrefix/(time.time()-startTime),'addresses per second before finding one with the correct ripe-prefix.'
address = encodeAddress(3,streamNumber,ripe.digest())
#self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"),'Finished generating address. Writing to keys.dat')
#An excellent way for us to store our keys is in Wallet Import Format. Let us convert now.
#https://en.bitcoin.it/wiki/Wallet_import_format
@ -3254,8 +3271,8 @@ class addressGenerator(threading.Thread):
shared.config.set(address,'label',label)
shared.config.set(address,'enabled','true')
shared.config.set(address,'decoy','false')
shared.config.set(address,'noncetrialsperbyte',shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte'))
shared.config.set(address,'payloadlengthextrabytes',shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes'))
shared.config.set(address,'noncetrialsperbyte',str(nonceTrialsPerByte))
shared.config.set(address,'payloadlengthextrabytes',str(payloadLengthExtraBytes))
shared.config.set(address,'privSigningKey',privSigningKeyWIF)
shared.config.set(address,'privEncryptionKey',privEncryptionKeyWIF)
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
@ -3328,8 +3345,8 @@ class addressGenerator(threading.Thread):
shared.config.set(address,'label',label)
shared.config.set(address,'enabled','true')
shared.config.set(address,'decoy','false')
shared.config.set(address,'noncetrialsperbyte',shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte'))
shared.config.set(address,'payloadlengthextrabytes',shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes'))
shared.config.set(address,'noncetrialsperbyte',str(nonceTrialsPerByte))
shared.config.set(address,'payloadlengthextrabytes',str(payloadLengthExtraBytes))
shared.config.set(address,'privSigningKey',privSigningKeyWIF)
shared.config.set(address,'privEncryptionKey',privEncryptionKeyWIF)
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
@ -3444,7 +3461,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return a+b
elif method == 'statusBar':
message, = params
#apiSignalQueue.put(('updateStatusBar',message))
shared.UISignalQueue.put(('updateStatusBar',message))
elif method == 'listAddresses':
data = '{"addresses":['
@ -3464,13 +3480,26 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
elif len(params) == 1:
label, = params
eighteenByteRipe = False
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
elif len(params) == 2:
label, eighteenByteRipe = params
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
elif len(params) == 3:
label, eighteenByteRipe, totalDifficulty = params
nonceTrialsPerByte = int(shared.networkDefaultProofOfWorkNonceTrialsPerByte * totalDifficulty)
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
elif len(params) == 4:
label, eighteenByteRipe, totalDifficulty, smallMessageDifficulty = params
nonceTrialsPerByte = int(shared.networkDefaultProofOfWorkNonceTrialsPerByte * totalDifficulty)
payloadLengthExtraBytes = int(shared.networkDefaultPayloadLengthExtraBytes * smallMessageDifficulty)
else:
return 'API Error 0000: Too many parameters!'
label = label.decode('base64')
apiAddressGeneratorReturnQueue.queue.clear()
streamNumberForAddress = 1
#apiSignalQueue.put(('createRandomAddress',(label, eighteenByteRipe))) #params should be a twopul which equals (eighteenByteRipe, label)
shared.addressGeneratorQueue.put((3,streamNumberForAddress,label,1,"",eighteenByteRipe))
shared.addressGeneratorQueue.put((3,streamNumberForAddress,label,1,"",eighteenByteRipe,nonceTrialsPerByte,payloadLengthExtraBytes))
return apiAddressGeneratorReturnQueue.get()
elif method == 'createDeterministicAddresses':
if len(params) == 0:
@ -3481,20 +3510,40 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
addressVersionNumber = 0
streamNumber = 0
eighteenByteRipe = False
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
elif len(params) == 2:
passphrase, numberOfAddresses = params
addressVersionNumber = 0
streamNumber = 0
eighteenByteRipe = False
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
elif len(params) == 3:
passphrase, numberOfAddresses, addressVersionNumber = params
streamNumber = 0
eighteenByteRipe = False
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
elif len(params) == 4:
passphrase, numberOfAddresses, addressVersionNumber, streamNumber = params
eighteenByteRipe = False
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
elif len(params) == 5:
passphrase, numberOfAddresses, addressVersionNumber, streamNumber, eighteenByteRipe = params
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
elif len(params) == 6:
passphrase, numberOfAddresses, addressVersionNumber, streamNumber, eighteenByteRipe, totalDifficulty = params
nonceTrialsPerByte = int(shared.networkDefaultProofOfWorkNonceTrialsPerByte * totalDifficulty)
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
elif len(params) == 7:
passphrase, numberOfAddresses, addressVersionNumber, streamNumber, eighteenByteRipe, totalDifficulty, smallMessageDifficulty = params
nonceTrialsPerByte = int(shared.networkDefaultProofOfWorkNonceTrialsPerByte * totalDifficulty)
payloadLengthExtraBytes = int(shared.networkDefaultPayloadLengthExtraBytes * smallMessageDifficulty)
else:
return 'API Error 0000: Too many parameters!'
if len(passphrase) == 0:
return 'API Error 0001: The specified passphrase is blank.'
passphrase = passphrase.decode('base64')
@ -3512,8 +3561,7 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
return 'API Error 0005: You have (accidentally?) specified too many addresses to make. Maximum 999. This check only exists to prevent mischief; if you really want to create more addresses than this, contact the Bitmessage developers and we can modify the check or you can do it yourself by searching the source code for this message.'
apiAddressGeneratorReturnQueue.queue.clear()
print 'Requesting that the addressGenerator create', numberOfAddresses, 'addresses.'
#apiSignalQueue.put(('createDeterministicAddresses',(passphrase, numberOfAddresses, addressVersionNumber, streamNumber, eighteenByteRipe)))
shared.addressGeneratorQueue.put((addressVersionNumber,streamNumber,'unused API address',numberOfAddresses,passphrase,eighteenByteRipe))
shared.addressGeneratorQueue.put((addressVersionNumber,streamNumber,'unused API address',numberOfAddresses,passphrase,eighteenByteRipe,nonceTrialsPerByte,payloadLengthExtraBytes))
data = '{"addresses":['
queueReturn = apiAddressGeneratorReturnQueue.get()
for item in queueReturn:
@ -3547,7 +3595,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
shared.sqlReturnQueue.get()
shared.sqlSubmitQueue.put('commit')
shared.sqlLock.release()
#apiSignalQueue.put(('updateStatusBar','Per API: Trashed message (assuming message existed). UI not updated.'))
shared.UISignalQueue.put(('updateStatusBar','Per API: Trashed message (assuming message existed). UI not updated.'))
return 'Trashed message (assuming message existed). UI not updated. To double check, run getAllInboxMessages to see that the message disappeared, or restart Bitmessage and look in the normal Bitmessage GUI.'
elif method == 'sendMessage':

View File

@ -32,6 +32,7 @@ import time
import os
from pyelliptic.openssl import OpenSSL
import pickle
import platform
class MyForm(QtGui.QMainWindow):
@ -437,10 +438,6 @@ class MyForm(QtGui.QMainWindow):
self.numberOfBroadcastsProcessed = 0
self.numberOfPubkeysProcessed = 0
#Below this point, it would be good if all of the necessary global data structures were initialized.
self.rerenderComboBoxSendFrom()
self.UISignalThread = UISignaler()
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.writeNewAddressToTable)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
@ -455,32 +452,30 @@ class MyForm(QtGui.QMainWindow):
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
self.UISignalThread.start()
#self.connectToStream(1)
#Below this point, it would be good if all of the necessary global data structures were initialized.
#self.singleListenerThread = singleListener()
#self.singleListenerThread.start()
#QtCore.QObject.connect(self.singleListenerThread, QtCore.SIGNAL("passObjectThrough(PyQt_PyObject)"), self.connectObjectToSignals)
self.rerenderComboBoxSendFrom()
#Show or hide the application window after clicking an item within the tray icon or, on Windows, the try icon itself.
def appIndicatorShowOrHideWindow(self):
if not self.actionShow.isChecked():
self.hide()
else:
if sys.platform[0:3] == 'win':
self.setWindowFlags(Qt.Window)
self.show()
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
self.activateWindow()
else:
self.show()
self.setWindowState(self.windowState() & QtCore.Qt.WindowMaximized)
#Here is what I believe might be required for darwin:
#self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
#self.activateWindow()
#self.singleCleanerThread = singleCleaner()
#self.singleCleanerThread.start()
#QtCore.QObject.connect(self.singleCleanerThread, QtCore.SIGNAL("updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByHash)
#QtCore.QObject.connect(self.singleCleanerThread, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
#self.workerThread = singleWorker()
#self.workerThread.start()
#QtCore.QObject.connect(self.workerThread, QtCore.SIGNAL("updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByHash)
#QtCore.QObject.connect(self.workerThread, QtCore.SIGNAL("updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByAckdata)
#QtCore.QObject.connect(self.workerThread, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
# an appindicator action which indicates the connection status
actionStatus = None
# an appindicator action which shows of hides the program window
actionShow = None
# pointer to the application
app = None
#app = None
# The most recent message
newMessageItem = None
@ -492,28 +487,29 @@ class MyForm(QtGui.QMainWindow):
def appIndicatorShow(self):
if self.actionShow == None:
return
self.actionShow.setChecked(True)
self.show()
self.setWindowState(self.windowState() & QtCore.Qt.WindowMaximized)
if not self.actionShow.isChecked():
self.actionShow.setChecked(True)
self.appIndicatorShowOrHideWindow()
# unchecks the show item on the application indicator
def appIndicatorHide(self):
if self.actionShow == None:
return
self.actionShow.setChecked(False)
self.hide()
self.setWindowState(self.windowState() & QtCore.Qt.WindowMinimized)
if self.actionShow.isChecked():
self.actionShow.setChecked(False)
self.appIndicatorShowOrHideWindow()
# application indicator show or hide
"""# application indicator show or hide
def appIndicatorShowBitmessage(self):
if self.actionShow == None:
return
#if self.actionShow == None:
# return
print self.actionShow.isChecked()
if not self.actionShow.isChecked():
self.hide()
self.setWindowState(self.windowState() & QtCore.Qt.WindowMinimized)
#self.setWindowState(self.windowState() & QtCore.Qt.WindowMinimized)
else:
self.show()
self.setWindowState(self.windowState() & QtCore.Qt.WindowMaximized)
self.appIndicatorShowOrHideWindow()"""
# Show the program window and select inbox tab
def appIndicatorInbox(self, mm_app, source_id):
@ -558,10 +554,13 @@ class MyForm(QtGui.QMainWindow):
self.appIndicatorShow()
self.ui.tabWidget.setCurrentIndex(5)
# initialise application indicator
# create application indicator
def appIndicatorInit(self,app):
self.app = app
self.app.tray = QSystemTrayIcon(QtGui.QIcon("images/can-icon-24px-red.png"), self.app)
self.tray = QSystemTrayIcon(QtGui.QIcon("images/can-icon-24px-red.png"), app)
if sys.platform[0:3] == 'win':
traySignal = "activated(QSystemTrayIcon::ActivationReason)"
QtCore.QObject.connect(self.tray, QtCore.SIGNAL(traySignal), self.__icon_activated)
m = QMenu()
self.actionStatus = QtGui.QAction('Not Connected',m,checkable=False)
@ -575,8 +574,9 @@ class MyForm(QtGui.QMainWindow):
# show bitmessage
self.actionShow = QtGui.QAction('Show Bitmessage',m,checkable=True)
self.actionShow.setChecked(not shared.config.getboolean('bitmessagesettings', 'startintray'))
self.actionShow.triggered.connect(self.appIndicatorShowBitmessage)
m.addAction(self.actionShow)
self.actionShow.triggered.connect(self.appIndicatorShowOrHideWindow)
if not sys.platform[0:3] == 'win':
m.addAction(self.actionShow)
# Send
actionSend = QtGui.QAction('Send',m,checkable=False)
@ -600,15 +600,16 @@ class MyForm(QtGui.QMainWindow):
# Quit
m.addAction("Quit", self.quit)
self.app.tray.setContextMenu(m)
self.app.tray.show()
self.tray.setContextMenu(m)
self.tray.show()
# Ubuntu Messaging menu object
mmapp = None
# is the operating system Ubuntu?
def isUbuntu(self):
for entry in os.uname():
for entry in platform.uname():
if "Ubuntu" in entry:
return True
return False
@ -804,6 +805,9 @@ class MyForm(QtGui.QMainWindow):
os.startfile(shared.appdata + 'keys.dat')
def changeEvent(self, event):
if event.type() == QtCore.QEvent.WindowStateChange:
if self.windowState() & QtCore.Qt.WindowMinimized:
self.actionShow.setChecked(False)
if shared.config.getboolean('bitmessagesettings', 'minimizetotray') and not 'darwin' in sys.platform:
if event.type() == QtCore.QEvent.WindowStateChange:
if self.windowState() & QtCore.Qt.WindowMinimized:
@ -817,7 +821,10 @@ class MyForm(QtGui.QMainWindow):
def __icon_activated(self, reason):
if reason == QtGui.QSystemTrayIcon.Trigger:
if 'linux' in sys.platform:
self.actionShow.setChecked(not self.actionShow.isChecked())
self.appIndicatorShowOrHideWindow()
"""if 'linux' in sys.platform:
self.trayIcon.hide()
self.setWindowFlags(Qt.Window)
self.show()
@ -832,7 +839,7 @@ class MyForm(QtGui.QMainWindow):
#self.setWindowFlags(Qt.Window)
#self.show()
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
self.activateWindow()
self.activateWindow()"""
def incrementNumberOfMessagesProcessed(self):
self.numberOfMessagesProcessed += 1
@ -900,7 +907,6 @@ class MyForm(QtGui.QMainWindow):
if color == 'red':
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/redicon.png"))
shared.statusIconColor = 'red'
# if the connection is lost then show a notification
if self.connected:
self.notifierShow('PyBitmessage','Connection lost')
@ -908,33 +914,31 @@ class MyForm(QtGui.QMainWindow):
if self.actionStatus != None:
self.actionStatus.setText('Not Connected')
self.app.tray.setIcon(QtGui.QIcon("images/can-icon-24px-red.png"))
self.tray.setIcon(QtGui.QIcon("images/can-icon-24px-red.png"))
self.trayIcon.show()
if color == 'yellow':
if self.statusBar().currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.':
self.statusBar().showMessage('')
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png"))
shared.statusIconColor = 'yellow'
# if a new connection has been established then show a notification
if not self.connected:
self.notifierShow('PyBitmessage','Connected')
self.connected = True
if self.actionStatus != None:
self.actionStatus.setText('Connection Ok')
self.app.tray.setIcon(QtGui.QIcon("images/can-icon-24px-yellow.png"))
self.actionStatus.setText('Connected')
self.tray.setIcon(QtGui.QIcon("images/can-icon-24px-yellow.png"))
if color == 'green':
if self.statusBar().currentMessage() == 'Warning: You are currently not connected. Bitmessage will do the work necessary to send the message but it won\'t send until you connect.':
self.statusBar().showMessage('')
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/greenicon.png"))
shared.statusIconColor = 'green'
self.connected = True
if self.actionStatus != None:
self.actionStatus.setText('Connection Good')
self.app.tray.setIcon(QtGui.QIcon("images/can-icon-24px-green.png"))
self.actionStatus.setText('Connected')
self.tray.setIcon(QtGui.QIcon("images/can-icon-24px-green.png"))
def updateSentItemStatusByHash(self,toRipe,textToDisplay):
for i in range(self.ui.tableWidgetSent.rowCount()):
@ -1638,6 +1642,7 @@ class MyForm(QtGui.QMainWindow):
return
'''
shared.doCleanShutdown()
self.tray.hide()
# unregister the messaging system
if self.mmapp is not None:
self.mmapp.unregister()
@ -1648,12 +1653,12 @@ class MyForm(QtGui.QMainWindow):
# window close event
def closeEvent(self, event):
self.appIndicatorHide()
minimizeonclose = True
minimizeonclose = False
try:
minimizeonclose = shared.config.getboolean('bitmessagesettings', 'minimizeonclose')
except Exception:
print 'Is there a minimizeonclose entry in keys.dat?'
pass
if minimizeonclose:
# minimize the application

View File

@ -149,7 +149,9 @@ def doCleanShutdown():
print 'Completed pickle.dump. Closing output...'
output.close()
knownNodesLock.release()
printLock.acquire()
print 'Finished closing knownnodes.dat output file.'
printLock.release()
UISignalQueue.put(('updateStatusBar','Done saving the knownNodes list of peers to disk.'))
broadcastToSendDataQueues((0, 'shutdown', 'all'))
@ -165,8 +167,10 @@ def doCleanShutdown():
sqlSubmitQueue.put('SELECT address FROM subscriptions')
sqlSubmitQueue.put('')
sqlReturnQueue.get()
sqlLock.release()
sqlLock.release()
printLock.acquire()
print 'Finished flushing inventory.'
printLock.release()
sqlSubmitQueue.put('exit')
if safeConfigGetBoolean('bitmessagesettings','daemon'):