Merge pull request #137 from Atheros1/master
fuzzgun appIndicator and also additional createAddresses through API functionality
This commit is contained in:
commit
5ff8c4fcb5
53
Makefile
53
Makefile
|
@ -1,5 +1,7 @@
|
||||||
APP=pybitmessage
|
APP=pybitmessage
|
||||||
VERSION=0.3.0
|
VERSION=0.3.0
|
||||||
|
DEST_SHARE=/usr/share
|
||||||
|
DEST_APP=$(DEST_SHARE)/$(APP)
|
||||||
|
|
||||||
all:
|
all:
|
||||||
|
|
||||||
|
@ -9,33 +11,36 @@ source:
|
||||||
tar -cvzf ../$(APP)_$(VERSION).orig.tar.gz ../$(APP)-$(VERSION) --exclude=.git
|
tar -cvzf ../$(APP)_$(VERSION).orig.tar.gz ../$(APP)-$(VERSION) --exclude=.git
|
||||||
|
|
||||||
install:
|
install:
|
||||||
mkdir -m 755 -p /usr/share/applications
|
mkdir -m 755 -p $(DEST_APP)
|
||||||
mkdir -m 755 -p /usr/share/applications/$(APP)
|
mkdir -m 755 -p $(DEST_SHARE)/applications
|
||||||
mkdir -m 755 -p /usr/share/applications/$(APP)/images
|
mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP)
|
||||||
mkdir -m 755 -p /usr/share/applications/$(APP)/pyelliptic
|
mkdir -m 755 -p $(DEST_APP)/images
|
||||||
mkdir -m 755 -p /usr/share/applications/$(APP)/socks
|
mkdir -m 755 -p $(DEST_APP)/pyelliptic
|
||||||
mkdir -m 755 -p /usr/share/pixmaps
|
mkdir -m 755 -p $(DEST_APP)/socks
|
||||||
mkdir -m 755 -p /usr/share/icons
|
mkdir -m 755 -p $(DEST_APP)/bitmessageqt
|
||||||
mkdir -m 755 -p /usr/share/icons/hicolor
|
mkdir -m 755 -p $(DEST_SHARE)/pixmaps
|
||||||
mkdir -m 755 -p /usr/share/icons/hicolor/scalable
|
mkdir -m 755 -p $(DEST_SHARE)/icons
|
||||||
mkdir -m 755 -p /usr/share/icons/hicolor/scalable/apps
|
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor
|
||||||
mkdir -m 755 -p /usr/share/icons/hicolor/24x24
|
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/scalable
|
||||||
mkdir -m 755 -p /usr/share/icons/hicolor/24x24/apps
|
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/scalable/apps
|
||||||
|
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/24x24
|
||||||
|
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/24x24/apps
|
||||||
|
|
||||||
install -m 644 src/*.ui /usr/share/applications/$(APP)
|
install -m 644 src/*.ui $(DEST_APP)
|
||||||
install -m 644 src/*.py /usr/share/applications/$(APP)
|
install -m 644 src/*.py $(DEST_APP)
|
||||||
install -m 644 src/*.qrc /usr/share/applications/$(APP)
|
install -m 644 src/*.qrc $(DEST_APP)
|
||||||
|
|
||||||
install -m 644 src/images/*.png /usr/share/applications/$(APP)/images
|
install -m 644 src/images/*.png $(DEST_APP)/images
|
||||||
install -m 644 src/images/*.ico /usr/share/applications/$(APP)/images
|
install -m 644 src/images/*.ico $(DEST_APP)/images
|
||||||
install -m 644 src/pyelliptic/*.py /usr/share/applications/$(APP)/pyelliptic
|
install -m 644 src/pyelliptic/*.py $(DEST_APP)/pyelliptic
|
||||||
install -m 644 src/socks/*.py /usr/share/applications/$(APP)/socks
|
install -m 644 src/socks/*.py $(DEST_APP)/socks
|
||||||
install -m 755 debian/pybm /usr/bin
|
install -m 644 src/bitmessageqt/*.py $(DEST_APP)/bitmessageqt
|
||||||
|
install -m 755 debian/pybm /usr/bin/pybitmessage
|
||||||
|
|
||||||
install -m 644 desktop/$(APP).desktop /usr/share/applications/$(APP)/$(APP).desktop
|
install -m 644 desktop/$(APP).desktop $(DEST_SHARE)/applications/$(APP)/$(APP).desktop
|
||||||
install -m 644 src/images/can-icon-24px.png /usr/share/icons/hicolor/24x24/apps/$(APP).png
|
install -m 644 src/images/can-icon-24px.png $(DEST_SHARE)/icons/hicolor/24x24/apps/$(APP).png
|
||||||
install -m 644 desktop/can-icon.svg /usr/share/icons/hicolor/scalable/apps/$(APP).svg
|
install -m 644 desktop/can-icon.svg $(DEST_SHARE)/icons/hicolor/scalable/apps/$(APP).svg
|
||||||
install -m 644 desktop/can-icon.svg /usr/share/pixmaps/$(APP).svg
|
install -m 644 desktop/can-icon.svg $(DEST_SHARE)/pixmaps/$(APP).svg
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf debian/$(APP)
|
rm -rf debian/$(APP)
|
||||||
|
|
60
debian/changelog
vendored
60
debian/changelog
vendored
|
@ -1,3 +1,63 @@
|
||||||
|
pybitmessage (0.3.0-1) unstable; urgency=low
|
||||||
|
|
||||||
|
* Added new API function: getStatus
|
||||||
|
|
||||||
|
* Added error-handling around all sock.sendall() functions
|
||||||
|
in the receiveData thread so that if there is a problem
|
||||||
|
sending data, the threads will close gracefully
|
||||||
|
|
||||||
|
* Abandoned and removed the connectionsCount data structure;
|
||||||
|
use the connectedHostsList instead because it has proved to be
|
||||||
|
more accurate than trying to maintain the connectionsCount
|
||||||
|
|
||||||
|
* Added daemon mode. All UI code moved into a module and many
|
||||||
|
shared objects moved into shared.py
|
||||||
|
|
||||||
|
* Truncate display of very long messages to avoid freezing the UI
|
||||||
|
|
||||||
|
* Added encrypted broadcasts for v3 addresses or v2 addresses
|
||||||
|
after 2013-05-28 10:00 UTC
|
||||||
|
|
||||||
|
* No longer self.sock.close() from within receiveDataThreads,
|
||||||
|
let the sendDataThreads do it
|
||||||
|
|
||||||
|
* Swapped out the v2 announcements subscription address for a v3
|
||||||
|
announcements subscription address
|
||||||
|
|
||||||
|
* Vacuum the messages.dat file once a month: will greatly reduce the file size
|
||||||
|
|
||||||
|
* Added a settings table in message.dat
|
||||||
|
|
||||||
|
* Implemented v3 addresses:
|
||||||
|
pubkey messages must now include two var_ints: nonce_trials_per_byte
|
||||||
|
and extra_bytes, and also be signed. When sending a message to a v3
|
||||||
|
address, the sender must use these values in calculating its POW or
|
||||||
|
else the message will not be accepted by the receiver.
|
||||||
|
|
||||||
|
* Display a privacy warning when selecting 'Send Broadcast from this address'
|
||||||
|
|
||||||
|
* Added gitignore file
|
||||||
|
|
||||||
|
* Added code in preparation for a switch from 32-bit time to 64-bit time.
|
||||||
|
Nodes will now advertise themselves as using protocol version 2.
|
||||||
|
|
||||||
|
* Don't necessarily delete entries from the inventory after 2.5 days;
|
||||||
|
leave pubkeys there for 28 days so that we don't process the same ones
|
||||||
|
many times throughout a month. This was causing the 'pubkeys processed'
|
||||||
|
indicator on the 'Network Status' tab to not accurately reflect the
|
||||||
|
number of truly new addresses on the network.
|
||||||
|
|
||||||
|
* Use 32 threads for outgoing connections in order to connect quickly
|
||||||
|
|
||||||
|
* Fix typo when calling os.environ in the sys.platform=='darwin' case
|
||||||
|
|
||||||
|
* Allow the cancelling of a message which is in the process of being
|
||||||
|
sent by trashing it then restarting Bitmessage
|
||||||
|
|
||||||
|
* Bug fix: can't delete address from address book
|
||||||
|
|
||||||
|
-- Bob Mottram (4096 bits) <bob@sluggish.dyndns.org> Tue, 6 May 2013 12:06:00 +0100
|
||||||
|
|
||||||
pybitmessage (0.2.8-1) unstable; urgency=low
|
pybitmessage (0.2.8-1) unstable; urgency=low
|
||||||
|
|
||||||
* Fixed Ubuntu & OS X issue:
|
* Fixed Ubuntu & OS X issue:
|
||||||
|
|
4
debian/control
vendored
4
debian/control
vendored
|
@ -2,7 +2,7 @@ Source: pybitmessage
|
||||||
Section: contrib/comm
|
Section: contrib/comm
|
||||||
Priority: extra
|
Priority: extra
|
||||||
Maintainer: Jonathan Warren <jonathan@bitmessage.org>
|
Maintainer: Jonathan Warren <jonathan@bitmessage.org>
|
||||||
Build-Depends: debhelper (>= 8.0.0), python, openssl, python-qt4, libqt4-dev, python-qt4-dev, sqlite3, libsqlite3-dev
|
Build-Depends: debhelper (>= 8.0.0), python (>= 2.7.0), openssl, python-qt4, libqt4-dev (>= 4.8.0), python-qt4-dev, sqlite3, libsqlite3-dev
|
||||||
Standards-Version: 3.9.2
|
Standards-Version: 3.9.2
|
||||||
Homepage: https://bitmessage.org/
|
Homepage: https://bitmessage.org/
|
||||||
Vcs-Browser: https://github.com/Bitmessage/PyBitmessage
|
Vcs-Browser: https://github.com/Bitmessage/PyBitmessage
|
||||||
|
@ -10,7 +10,7 @@ Vcs-Git: https://github.com/Bitmessage/PyBitmessage.git
|
||||||
|
|
||||||
Package: pybitmessage
|
Package: pybitmessage
|
||||||
Architecture: all
|
Architecture: all
|
||||||
Depends: ${misc:Depends}, python, openssl, python-qt4, libqt4-dev, python-qt4-dev, sqlite3, libsqlite3-dev
|
Depends: ${misc:Depends}, python (>= 2.7.0), openssl, python-qt4, libqt4-dev (>= 4.8.0), python-qt4-dev, sqlite3, libsqlite3-dev
|
||||||
Description: Send encrypted messages to another person or to many subscribers
|
Description: Send encrypted messages to another person or to many subscribers
|
||||||
Bitmessage is a P2P communications protocol used to send encrypted messages
|
Bitmessage is a P2P communications protocol used to send encrypted messages
|
||||||
to another person or to many subscribers. It is decentralized and trustless,
|
to another person or to many subscribers. It is decentralized and trustless,
|
||||||
|
|
2
debian/pybm
vendored
2
debian/pybm
vendored
|
@ -1,4 +1,4 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
cd /usr/share/applications/pybitmessage
|
cd /usr/share/pybitmessage
|
||||||
python bitmessagemain.py
|
python bitmessagemain.py
|
||||||
|
|
||||||
|
|
30
debian/rules
vendored
30
debian/rules
vendored
|
@ -1,8 +1,9 @@
|
||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
APP=pybitmessage
|
APP=pybitmessage
|
||||||
|
|
||||||
DEST_MAIN = $(CURDIR)/debian/$(APP)/usr/bin
|
DEST_MAIN=$(CURDIR)/debian/$(APP)/usr/bin
|
||||||
DEST_SHARE = $(CURDIR)/debian/$(APP)/usr/share
|
DEST_SHARE=$(CURDIR)/debian/$(APP)/usr/share
|
||||||
|
DEST_APP=$(DEST_SHARE)/$(APP)
|
||||||
|
|
||||||
build: build-stamp
|
build: build-stamp
|
||||||
make
|
make
|
||||||
|
@ -21,11 +22,13 @@ install: build clean
|
||||||
dh_installdirs
|
dh_installdirs
|
||||||
mkdir -m 755 -p $(CURDIR)/debian/$(APP)/usr
|
mkdir -m 755 -p $(CURDIR)/debian/$(APP)/usr
|
||||||
mkdir -m 755 -p $(CURDIR)/debian/$(APP)/usr/bin
|
mkdir -m 755 -p $(CURDIR)/debian/$(APP)/usr/bin
|
||||||
|
mkdir -m 755 -p $(DEST_APP)
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/applications
|
mkdir -m 755 -p $(DEST_SHARE)/applications
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP)
|
mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP)
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP)/images
|
mkdir -m 755 -p $(DEST_APP)/images
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP)/pyelliptic
|
mkdir -m 755 -p $(DEST_APP)/pyelliptic
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/applications/$(APP)/socks
|
mkdir -m 755 -p $(DEST_APP)/socks
|
||||||
|
mkdir -m 755 -p $(DEST_APP)/bitmessageqt
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/pixmaps
|
mkdir -m 755 -p $(DEST_SHARE)/pixmaps
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/icons
|
mkdir -m 755 -p $(DEST_SHARE)/icons
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor
|
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor
|
||||||
|
@ -34,15 +37,16 @@ install: build clean
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/24x24
|
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/24x24
|
||||||
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/24x24/apps
|
mkdir -m 755 -p $(DEST_SHARE)/icons/hicolor/24x24/apps
|
||||||
|
|
||||||
install -m 644 $(CURDIR)/src/*.ui $(DEST_SHARE)/applications/$(APP)
|
install -m 644 $(CURDIR)/src/*.ui $(DEST_APP)
|
||||||
install -m 644 $(CURDIR)/src/*.py $(DEST_SHARE)/applications/$(APP)
|
install -m 644 $(CURDIR)/src/*.py $(DEST_APP)
|
||||||
install -m 644 $(CURDIR)/src/*.qrc $(DEST_SHARE)/applications/$(APP)
|
install -m 644 $(CURDIR)/src/*.qrc $(DEST_APP)
|
||||||
|
|
||||||
install -m 644 $(CURDIR)/src/images/*.png $(DEST_SHARE)/applications/$(APP)/images
|
install -m 644 $(CURDIR)/src/images/*.png $(DEST_APP)/images
|
||||||
install -m 644 $(CURDIR)/src/images/*.ico $(DEST_SHARE)/applications/$(APP)/images
|
install -m 644 $(CURDIR)/src/images/*.ico $(DEST_APP)/images
|
||||||
install -m 644 $(CURDIR)/src/pyelliptic/*.py $(DEST_SHARE)/applications/$(APP)/pyelliptic
|
install -m 644 $(CURDIR)/src/pyelliptic/*.py $(DEST_APP)/pyelliptic
|
||||||
install -m 644 $(CURDIR)/src/socks/*.py $(DEST_SHARE)/applications/$(APP)/socks
|
install -m 644 $(CURDIR)/src/socks/*.py $(DEST_APP)/socks
|
||||||
install -m 755 $(CURDIR)/debian/pybm $(DEST_MAIN)
|
install -m 644 $(CURDIR)/src/bitmessageqt/*.py $(DEST_APP)/bitmessageqt
|
||||||
|
install -m 755 $(CURDIR)/debian/pybm $(DEST_MAIN)/pybitmessage
|
||||||
|
|
||||||
install -m 644 $(CURDIR)/desktop/$(APP).desktop $(DEST_SHARE)/applications/$(APP)/$(APP).desktop
|
install -m 644 $(CURDIR)/desktop/$(APP).desktop $(DEST_SHARE)/applications/$(APP)/$(APP).desktop
|
||||||
install -m 644 $(CURDIR)/src/images/can-icon-24px.png $(DEST_SHARE)/icons/hicolor/24x24/apps/$(APP).png
|
install -m 644 $(CURDIR)/src/images/can-icon-24px.png $(DEST_SHARE)/icons/hicolor/24x24/apps/$(APP).png
|
||||||
|
|
|
@ -3,7 +3,7 @@ Type=Application
|
||||||
Name=PyBitmessage
|
Name=PyBitmessage
|
||||||
GenericName=PyBitmessage
|
GenericName=PyBitmessage
|
||||||
Comment=Send encrypted messages to another person or to many subscribers
|
Comment=Send encrypted messages to another person or to many subscribers
|
||||||
Exec=pybm %U
|
Exec=pybitmessage %U
|
||||||
Icon=pybitmessage
|
Icon=pybitmessage
|
||||||
Terminal=false
|
Terminal=false
|
||||||
Categories=Network
|
Categories=Network
|
||||||
|
|
|
@ -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 '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 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')
|
#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.'
|
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)
|
#jsonDeterministicAddresses = api.createDeterministicAddresses(passphrase, 2, 3, 1, False)
|
||||||
#print jsonDeterministicAddresses
|
#print jsonDeterministicAddresses
|
||||||
#print json.loads(jsonDeterministicAddresses)
|
#print json.loads(jsonDeterministicAddresses)
|
||||||
|
|
|
@ -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.'
|
print 'incoming connection is from a host in shared.connectedHostsList (we are already connected to it). Ignoring it.'
|
||||||
a.close()
|
a.close()
|
||||||
a,(HOST,PORT) = sock.accept()"""
|
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 = {}
|
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 = sendDataThread()
|
||||||
sd.setup(a,HOST,PORT,-1,objectsOfWhichThisRemoteNodeIsAlreadyAware)
|
sd.setup(a,HOST,PORT,-1,objectsOfWhichThisRemoteNodeIsAlreadyAware)
|
||||||
sd.start()
|
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).
|
#This thread is created either by the synSenderThread(for outgoing connections) or the singleListenerThread(for incoming connectiosn).
|
||||||
class receiveDataThread(threading.Thread):
|
class receiveDataThread(threading.Thread):
|
||||||
|
@ -297,7 +297,9 @@ class receiveDataThread(threading.Thread):
|
||||||
try:
|
try:
|
||||||
del shared.connectedHostsList[self.HOST]
|
del shared.connectedHostsList[self.HOST]
|
||||||
except Exception, err:
|
except Exception, err:
|
||||||
|
shared.printLock.acquire()
|
||||||
print 'Could not delete', self.HOST, 'from shared.connectedHostsList.', err
|
print 'Could not delete', self.HOST, 'from shared.connectedHostsList.', err
|
||||||
|
shared.printLock.release()
|
||||||
shared.UISignalQueue.put(('updateNetworkStatusTab','no data'))
|
shared.UISignalQueue.put(('updateNetworkStatusTab','no data'))
|
||||||
shared.printLock.acquire()
|
shared.printLock.acquire()
|
||||||
print 'The size of the connectedHostsList is now:', len(shared.connectedHostsList)
|
print 'The size of the connectedHostsList is now:', len(shared.connectedHostsList)
|
||||||
|
@ -2046,7 +2048,6 @@ class sendDataThread(threading.Thread):
|
||||||
shared.printLock.release()
|
shared.printLock.release()
|
||||||
self.versionSent = 1
|
self.versionSent = 1
|
||||||
|
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
while True:
|
while True:
|
||||||
deststream,command,data = self.mailbox.get()
|
deststream,command,data = self.mailbox.get()
|
||||||
|
@ -3201,13 +3202,27 @@ class addressGenerator(threading.Thread):
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
while True:
|
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:
|
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')
|
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 addressVersionNumber == 3:
|
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 == "":
|
if deterministicPassphrase == "":
|
||||||
#statusbar = 'Generating one new address'
|
|
||||||
#self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"),statusbar)
|
|
||||||
shared.UISignalQueue.put(('updateStatusBar','Generating one new address'))
|
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
|
#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,
|
#find one that starts with either \x00 or \x00\x00. Then when we pack them into a Bitmessage address,
|
||||||
|
@ -3236,7 +3251,6 @@ class addressGenerator(threading.Thread):
|
||||||
print 'Generated address with ripe digest:', ripe.digest().encode('hex')
|
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.'
|
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())
|
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.
|
#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
|
#https://en.bitcoin.it/wiki/Wallet_import_format
|
||||||
|
@ -3254,8 +3268,8 @@ class addressGenerator(threading.Thread):
|
||||||
shared.config.set(address,'label',label)
|
shared.config.set(address,'label',label)
|
||||||
shared.config.set(address,'enabled','true')
|
shared.config.set(address,'enabled','true')
|
||||||
shared.config.set(address,'decoy','false')
|
shared.config.set(address,'decoy','false')
|
||||||
shared.config.set(address,'noncetrialsperbyte',shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte'))
|
shared.config.set(address,'noncetrialsperbyte',str(nonceTrialsPerByte))
|
||||||
shared.config.set(address,'payloadlengthextrabytes',shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes'))
|
shared.config.set(address,'payloadlengthextrabytes',str(payloadLengthExtraBytes))
|
||||||
shared.config.set(address,'privSigningKey',privSigningKeyWIF)
|
shared.config.set(address,'privSigningKey',privSigningKeyWIF)
|
||||||
shared.config.set(address,'privEncryptionKey',privEncryptionKeyWIF)
|
shared.config.set(address,'privEncryptionKey',privEncryptionKeyWIF)
|
||||||
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
|
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
|
||||||
|
@ -3328,8 +3342,8 @@ class addressGenerator(threading.Thread):
|
||||||
shared.config.set(address,'label',label)
|
shared.config.set(address,'label',label)
|
||||||
shared.config.set(address,'enabled','true')
|
shared.config.set(address,'enabled','true')
|
||||||
shared.config.set(address,'decoy','false')
|
shared.config.set(address,'decoy','false')
|
||||||
shared.config.set(address,'noncetrialsperbyte',shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte'))
|
shared.config.set(address,'noncetrialsperbyte',str(nonceTrialsPerByte))
|
||||||
shared.config.set(address,'payloadlengthextrabytes',shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes'))
|
shared.config.set(address,'payloadlengthextrabytes',str(payloadLengthExtraBytes))
|
||||||
shared.config.set(address,'privSigningKey',privSigningKeyWIF)
|
shared.config.set(address,'privSigningKey',privSigningKeyWIF)
|
||||||
shared.config.set(address,'privEncryptionKey',privEncryptionKeyWIF)
|
shared.config.set(address,'privEncryptionKey',privEncryptionKeyWIF)
|
||||||
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
|
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
|
||||||
|
@ -3444,7 +3458,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
return a+b
|
return a+b
|
||||||
elif method == 'statusBar':
|
elif method == 'statusBar':
|
||||||
message, = params
|
message, = params
|
||||||
#apiSignalQueue.put(('updateStatusBar',message))
|
|
||||||
shared.UISignalQueue.put(('updateStatusBar',message))
|
shared.UISignalQueue.put(('updateStatusBar',message))
|
||||||
elif method == 'listAddresses':
|
elif method == 'listAddresses':
|
||||||
data = '{"addresses":['
|
data = '{"addresses":['
|
||||||
|
@ -3464,13 +3477,26 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
elif len(params) == 1:
|
elif len(params) == 1:
|
||||||
label, = params
|
label, = params
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
|
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
|
||||||
|
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
|
||||||
elif len(params) == 2:
|
elif len(params) == 2:
|
||||||
label, eighteenByteRipe = params
|
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')
|
label = label.decode('base64')
|
||||||
apiAddressGeneratorReturnQueue.queue.clear()
|
apiAddressGeneratorReturnQueue.queue.clear()
|
||||||
streamNumberForAddress = 1
|
streamNumberForAddress = 1
|
||||||
#apiSignalQueue.put(('createRandomAddress',(label, eighteenByteRipe))) #params should be a twopul which equals (eighteenByteRipe, label)
|
shared.addressGeneratorQueue.put((3,streamNumberForAddress,label,1,"",eighteenByteRipe,nonceTrialsPerByte,payloadLengthExtraBytes))
|
||||||
shared.addressGeneratorQueue.put((3,streamNumberForAddress,label,1,"",eighteenByteRipe))
|
|
||||||
return apiAddressGeneratorReturnQueue.get()
|
return apiAddressGeneratorReturnQueue.get()
|
||||||
elif method == 'createDeterministicAddresses':
|
elif method == 'createDeterministicAddresses':
|
||||||
if len(params) == 0:
|
if len(params) == 0:
|
||||||
|
@ -3481,20 +3507,40 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
addressVersionNumber = 0
|
addressVersionNumber = 0
|
||||||
streamNumber = 0
|
streamNumber = 0
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
|
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
|
||||||
|
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
|
||||||
elif len(params) == 2:
|
elif len(params) == 2:
|
||||||
passphrase, numberOfAddresses = params
|
passphrase, numberOfAddresses = params
|
||||||
addressVersionNumber = 0
|
addressVersionNumber = 0
|
||||||
streamNumber = 0
|
streamNumber = 0
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
|
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
|
||||||
|
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
|
||||||
elif len(params) == 3:
|
elif len(params) == 3:
|
||||||
passphrase, numberOfAddresses, addressVersionNumber = params
|
passphrase, numberOfAddresses, addressVersionNumber = params
|
||||||
streamNumber = 0
|
streamNumber = 0
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
|
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
|
||||||
|
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
|
||||||
elif len(params) == 4:
|
elif len(params) == 4:
|
||||||
passphrase, numberOfAddresses, addressVersionNumber, streamNumber = params
|
passphrase, numberOfAddresses, addressVersionNumber, streamNumber = params
|
||||||
eighteenByteRipe = False
|
eighteenByteRipe = False
|
||||||
|
nonceTrialsPerByte = shared.config.get('bitmessagesettings','defaultnoncetrialsperbyte')
|
||||||
|
payloadLengthExtraBytes = shared.config.get('bitmessagesettings','defaultpayloadlengthextrabytes')
|
||||||
elif len(params) == 5:
|
elif len(params) == 5:
|
||||||
passphrase, numberOfAddresses, addressVersionNumber, streamNumber, eighteenByteRipe = params
|
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:
|
if len(passphrase) == 0:
|
||||||
return 'API Error 0001: The specified passphrase is blank.'
|
return 'API Error 0001: The specified passphrase is blank.'
|
||||||
passphrase = passphrase.decode('base64')
|
passphrase = passphrase.decode('base64')
|
||||||
|
@ -3512,8 +3558,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.'
|
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()
|
apiAddressGeneratorReturnQueue.queue.clear()
|
||||||
print 'Requesting that the addressGenerator create', numberOfAddresses, 'addresses.'
|
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,nonceTrialsPerByte,payloadLengthExtraBytes))
|
||||||
shared.addressGeneratorQueue.put((addressVersionNumber,streamNumber,'unused API address',numberOfAddresses,passphrase,eighteenByteRipe))
|
|
||||||
data = '{"addresses":['
|
data = '{"addresses":['
|
||||||
queueReturn = apiAddressGeneratorReturnQueue.get()
|
queueReturn = apiAddressGeneratorReturnQueue.get()
|
||||||
for item in queueReturn:
|
for item in queueReturn:
|
||||||
|
@ -3547,7 +3592,6 @@ class MySimpleXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
|
||||||
shared.sqlReturnQueue.get()
|
shared.sqlReturnQueue.get()
|
||||||
shared.sqlSubmitQueue.put('commit')
|
shared.sqlSubmitQueue.put('commit')
|
||||||
shared.sqlLock.release()
|
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.'))
|
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.'
|
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':
|
elif method == 'sendMessage':
|
||||||
|
|
|
@ -424,10 +424,6 @@ class MyForm(QtGui.QMainWindow):
|
||||||
self.numberOfBroadcastsProcessed = 0
|
self.numberOfBroadcastsProcessed = 0
|
||||||
self.numberOfPubkeysProcessed = 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()
|
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("writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.writeNewAddressToTable)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
|
||||||
|
@ -442,23 +438,107 @@ class MyForm(QtGui.QMainWindow):
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
|
||||||
self.UISignalThread.start()
|
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.rerenderComboBoxSendFrom()
|
||||||
#self.singleListenerThread.start()
|
|
||||||
#QtCore.QObject.connect(self.singleListenerThread, QtCore.SIGNAL("passObjectThrough(PyQt_PyObject)"), self.connectObjectToSignals)
|
|
||||||
|
|
||||||
|
#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()
|
"""# application indicator show or hide
|
||||||
#self.singleCleanerThread.start()
|
def appIndicatorShowBitmessage(self):
|
||||||
#QtCore.QObject.connect(self.singleCleanerThread, QtCore.SIGNAL("updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByHash)
|
#if self.actionShow == None:
|
||||||
#QtCore.QObject.connect(self.singleCleanerThread, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
|
# return
|
||||||
|
print self.actionShow.isChecked()
|
||||||
|
if not self.actionShow.isChecked():
|
||||||
|
self.hide()
|
||||||
|
#self.setWindowState(self.windowState() & QtCore.Qt.WindowMinimized)
|
||||||
|
else:
|
||||||
|
self.appIndicatorShowOrHideWindow()"""
|
||||||
|
|
||||||
#self.workerThread = singleWorker()
|
# Show the program window and select send tab
|
||||||
#self.workerThread.start()
|
def appIndicatorSend(self):
|
||||||
#QtCore.QObject.connect(self.workerThread, QtCore.SIGNAL("updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByHash)
|
self.actionShow.setChecked(True)
|
||||||
#QtCore.QObject.connect(self.workerThread, QtCore.SIGNAL("updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByAckdata)
|
self.appIndicatorShowOrHideWindow()
|
||||||
#QtCore.QObject.connect(self.workerThread, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
|
self.ui.tabWidget.setCurrentIndex(1)
|
||||||
|
|
||||||
|
# Show the program window and select subscriptions tab
|
||||||
|
def appIndicatorSubscribe(self):
|
||||||
|
self.actionShow.setChecked(True)
|
||||||
|
self.appIndicatorShowOrHideWindow()
|
||||||
|
self.ui.tabWidget.setCurrentIndex(4)
|
||||||
|
|
||||||
|
# Show the program window and select the address book tab
|
||||||
|
def appIndicatorAddressBook(self):
|
||||||
|
self.actionShow.setChecked(True)
|
||||||
|
self.appIndicatorShowOrHideWindow()
|
||||||
|
self.ui.tabWidget.setCurrentIndex(5)
|
||||||
|
|
||||||
|
# create application indicator
|
||||||
|
def createAppIndicator(self,app):
|
||||||
|
self.tray = QSystemTrayIcon(QtGui.QIcon("images/can-icon-24px.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)
|
||||||
|
m.addAction(self.actionStatus)
|
||||||
|
|
||||||
|
# separator
|
||||||
|
actionSeparator = QtGui.QAction('',m,checkable=False)
|
||||||
|
actionSeparator.setSeparator(True)
|
||||||
|
m.addAction(actionSeparator)
|
||||||
|
|
||||||
|
# show bitmessage
|
||||||
|
self.actionShow = QtGui.QAction('Show Bitmessage',m,checkable=True)
|
||||||
|
self.actionShow.setChecked(True)
|
||||||
|
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)
|
||||||
|
actionSend.triggered.connect(self.appIndicatorSend)
|
||||||
|
m.addAction(actionSend)
|
||||||
|
|
||||||
|
# Subscribe
|
||||||
|
actionSubscribe = QtGui.QAction('Subscribe',m,checkable=False)
|
||||||
|
actionSubscribe.triggered.connect(self.appIndicatorSubscribe)
|
||||||
|
m.addAction(actionSubscribe)
|
||||||
|
|
||||||
|
# Address book
|
||||||
|
actionAddressBook = QtGui.QAction('Address Book',m,checkable=False)
|
||||||
|
actionAddressBook.triggered.connect(self.appIndicatorAddressBook)
|
||||||
|
m.addAction(actionAddressBook)
|
||||||
|
|
||||||
|
# separator
|
||||||
|
actionSeparator = QtGui.QAction('',m,checkable=False)
|
||||||
|
actionSeparator.setSeparator(True)
|
||||||
|
m.addAction(actionSeparator)
|
||||||
|
|
||||||
|
# Quit
|
||||||
|
m.addAction("Quit", self.close)
|
||||||
|
self.tray.setContextMenu(m)
|
||||||
|
self.tray.show()
|
||||||
|
if shared.config.getboolean('bitmessagesettings', 'startintray'):
|
||||||
|
self.hide()
|
||||||
|
#myapp.trayIcon.show()#This option seems to have been obsoleted by https://github.com/Bitmessage/PyBitmessage/pull/133/files
|
||||||
|
self.actionShow.setChecked(False)
|
||||||
|
|
||||||
def tableWidgetInboxKeyPressEvent(self,event):
|
def tableWidgetInboxKeyPressEvent(self,event):
|
||||||
if event.key() == QtCore.Qt.Key_Delete:
|
if event.key() == QtCore.Qt.Key_Delete:
|
||||||
|
@ -507,11 +587,15 @@ class MyForm(QtGui.QMainWindow):
|
||||||
os.startfile(shared.appdata + 'keys.dat')
|
os.startfile(shared.appdata + 'keys.dat')
|
||||||
|
|
||||||
def changeEvent(self, event):
|
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 shared.config.getboolean('bitmessagesettings', 'minimizetotray') and not 'darwin' in sys.platform:
|
||||||
if event.type() == QtCore.QEvent.WindowStateChange:
|
if event.type() == QtCore.QEvent.WindowStateChange:
|
||||||
if self.windowState() & QtCore.Qt.WindowMinimized:
|
if self.windowState() & QtCore.Qt.WindowMinimized:
|
||||||
self.hide()
|
self.hide()
|
||||||
self.trayIcon.show()
|
|
||||||
|
#self.trayIcon.show() #This may have been obsoleted by https://github.com/Bitmessage/PyBitmessage/issues/135
|
||||||
#self.hidden = True
|
#self.hidden = True
|
||||||
if 'win32' in sys.platform or 'win64' in sys.platform:
|
if 'win32' in sys.platform or 'win64' in sys.platform:
|
||||||
self.setWindowFlags(Qt.ToolTip)
|
self.setWindowFlags(Qt.ToolTip)
|
||||||
|
@ -522,7 +606,10 @@ class MyForm(QtGui.QMainWindow):
|
||||||
|
|
||||||
def __icon_activated(self, reason):
|
def __icon_activated(self, reason):
|
||||||
if reason == QtGui.QSystemTrayIcon.Trigger:
|
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.trayIcon.hide()
|
||||||
self.setWindowFlags(Qt.Window)
|
self.setWindowFlags(Qt.Window)
|
||||||
self.show()
|
self.show()
|
||||||
|
@ -537,7 +624,7 @@ class MyForm(QtGui.QMainWindow):
|
||||||
#self.setWindowFlags(Qt.Window)
|
#self.setWindowFlags(Qt.Window)
|
||||||
#self.show()
|
#self.show()
|
||||||
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
|
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
|
||||||
self.activateWindow()
|
self.activateWindow()"""
|
||||||
|
|
||||||
def incrementNumberOfMessagesProcessed(self):
|
def incrementNumberOfMessagesProcessed(self):
|
||||||
self.numberOfMessagesProcessed += 1
|
self.numberOfMessagesProcessed += 1
|
||||||
|
@ -601,16 +688,22 @@ class MyForm(QtGui.QMainWindow):
|
||||||
if color == 'red':
|
if color == 'red':
|
||||||
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/redicon.png"))
|
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/redicon.png"))
|
||||||
shared.statusIconColor = 'red'
|
shared.statusIconColor = 'red'
|
||||||
|
#if self.actionStatus != None:
|
||||||
|
self.actionStatus.setText('Not Connected')
|
||||||
if color == 'yellow':
|
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.':
|
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.statusBar().showMessage('')
|
||||||
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png"))
|
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png"))
|
||||||
shared.statusIconColor = 'yellow'
|
shared.statusIconColor = 'yellow'
|
||||||
|
#if self.actionStatus != None:
|
||||||
|
self.actionStatus.setText('Connected')
|
||||||
if color == 'green':
|
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.':
|
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.statusBar().showMessage('')
|
||||||
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/greenicon.png"))
|
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/greenicon.png"))
|
||||||
shared.statusIconColor = 'green'
|
shared.statusIconColor = 'green'
|
||||||
|
#if self.actionStatus != None:
|
||||||
|
self.actionStatus.setText('Connected')
|
||||||
|
|
||||||
def updateSentItemStatusByHash(self,toRipe,textToDisplay):
|
def updateSentItemStatusByHash(self,toRipe,textToDisplay):
|
||||||
for i in range(self.ui.tableWidgetSent.rowCount()):
|
for i in range(self.ui.tableWidgetSent.rowCount()):
|
||||||
|
@ -1312,10 +1405,13 @@ class MyForm(QtGui.QMainWindow):
|
||||||
else:
|
else:
|
||||||
event.ignore()'''
|
event.ignore()'''
|
||||||
shared.doCleanShutdown()
|
shared.doCleanShutdown()
|
||||||
self.trayIcon.hide()
|
#self.trayIcon.hide()
|
||||||
|
self.tray.hide()
|
||||||
self.statusBar().showMessage('All done. Closing user interface...')
|
self.statusBar().showMessage('All done. Closing user interface...')
|
||||||
event.accept()
|
event.accept()
|
||||||
|
shared.printLock.acquire()
|
||||||
print 'Done. (passed event.accept())'
|
print 'Done. (passed event.accept())'
|
||||||
|
shared.printLock.release()
|
||||||
os._exit(0)
|
os._exit(0)
|
||||||
|
|
||||||
def on_action_InboxMessageForceHtml(self):
|
def on_action_InboxMessageForceHtml(self):
|
||||||
|
@ -1944,17 +2040,13 @@ class UISignaler(QThread):
|
||||||
else:
|
else:
|
||||||
sys.stderr.write('Command sent to UISignaler not recognized: %s\n' % command)
|
sys.stderr.write('Command sent to UISignaler not recognized: %s\n' % command)
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
app = QtGui.QApplication(sys.argv)
|
app = QtGui.QApplication(sys.argv)
|
||||||
app.setStyleSheet("QStatusBar::item { border: 0px solid black }")
|
app.setStyleSheet("QStatusBar::item { border: 0px solid black }")
|
||||||
myapp = MyForm()
|
myapp = MyForm()
|
||||||
myapp.show()
|
myapp.show()
|
||||||
if shared.config.getboolean('bitmessagesettings', 'startintray'):
|
if sys.platform[0:3] == 'win':
|
||||||
myapp.hide()
|
myapp.setWindowFlags(Qt.ToolTip)
|
||||||
myapp.trayIcon.show()
|
myapp.createAppIndicator(app)
|
||||||
#self.hidden = True
|
|
||||||
#self.setWindowState(self.windowState() & QtCore.Qt.WindowMinimized)
|
|
||||||
#self.hide()
|
|
||||||
if 'win32' in sys.platform or 'win64' in sys.platform:
|
|
||||||
myapp.setWindowFlags(Qt.ToolTip)
|
|
||||||
sys.exit(app.exec_())
|
sys.exit(app.exec_())
|
|
@ -149,7 +149,9 @@ def doCleanShutdown():
|
||||||
print 'Completed pickle.dump. Closing output...'
|
print 'Completed pickle.dump. Closing output...'
|
||||||
output.close()
|
output.close()
|
||||||
knownNodesLock.release()
|
knownNodesLock.release()
|
||||||
|
printLock.acquire()
|
||||||
print 'Finished closing knownnodes.dat output file.'
|
print 'Finished closing knownnodes.dat output file.'
|
||||||
|
printLock.release()
|
||||||
UISignalQueue.put(('updateStatusBar','Done saving the knownNodes list of peers to disk.'))
|
UISignalQueue.put(('updateStatusBar','Done saving the knownNodes list of peers to disk.'))
|
||||||
|
|
||||||
broadcastToSendDataQueues((0, 'shutdown', 'all'))
|
broadcastToSendDataQueues((0, 'shutdown', 'all'))
|
||||||
|
@ -166,7 +168,9 @@ def doCleanShutdown():
|
||||||
sqlSubmitQueue.put('')
|
sqlSubmitQueue.put('')
|
||||||
sqlReturnQueue.get()
|
sqlReturnQueue.get()
|
||||||
sqlLock.release()
|
sqlLock.release()
|
||||||
|
printLock.acquire()
|
||||||
print 'Finished flushing inventory.'
|
print 'Finished flushing inventory.'
|
||||||
|
printLock.release()
|
||||||
sqlSubmitQueue.put('exit')
|
sqlSubmitQueue.put('exit')
|
||||||
|
|
||||||
if safeConfigGetBoolean('bitmessagesettings','daemon'):
|
if safeConfigGetBoolean('bitmessagesettings','daemon'):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user