Merge pull request #550 from Atheros1/master

Various fixes
This commit is contained in:
Jonathan Warren 2013-11-06 20:43:24 -08:00
commit 113745a3a7
6 changed files with 61 additions and 26 deletions

View File

@ -1,4 +1,5 @@
Copyright (c) 2012 Jonathan Warren Copyright (c) 2012-2013 Jonathan Warren
Copyright (c) 2013 The Bitmessage Developers
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal

View File

@ -1,5 +1,6 @@
The MIT License (MIT) The MIT License (MIT)
Copyright (c) 2013 Bitmessage Copyright (c) 2012-2013 Jonathan Warren
Copyright (c) 2013 The Bitmessage Developers
Permission is hereby granted, free of charge, to any person obtaining a copy of Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in this software and associated documentation files (the "Software"), to deal in

View File

@ -1218,7 +1218,14 @@ class MyForm(QtGui.QMainWindow):
if withMessagingMenu: if withMessagingMenu:
n = Notify.Notification.new( n = Notify.Notification.new(
title, subtitle, 'notification-message-email') title, subtitle, 'notification-message-email')
n.show() try:
n.show()
except:
# n.show() has been known to throw this exception:
# gi._glib.GError: GDBus.Error:org.freedesktop.Notifications.
# MaxNotificationsExceeded: Exceeded maximum number of
# notifications
pass
return return
else: else:
self.tray.showMessage(title, subtitle, 1, 2000) self.tray.showMessage(title, subtitle, 1, 2000)

View File

@ -2,8 +2,8 @@
# Form implementation generated from reading ui file 'about.ui' # Form implementation generated from reading ui file 'about.ui'
# #
# Created: Mon Mar 11 11:19:35 2013 # Created: Wed Nov 06 23:01:43 2013
# by: PyQt4 UI code generator 4.9.4 # by: PyQt4 UI code generator 4.10.2
# #
# WARNING! All changes made in this file will be lost! # WARNING! All changes made in this file will be lost!
@ -12,7 +12,16 @@ from PyQt4 import QtCore, QtGui
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError: except AttributeError:
_fromUtf8 = lambda s: s def _fromUtf8(s):
return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig)
class Ui_aboutDialog(object): class Ui_aboutDialog(object):
def setupUi(self, aboutDialog): def setupUi(self, aboutDialog):
@ -35,7 +44,7 @@ class Ui_aboutDialog(object):
self.labelVersion.setGeometry(QtCore.QRect(190, 126, 161, 20)) self.labelVersion.setGeometry(QtCore.QRect(190, 126, 161, 20))
self.labelVersion.setObjectName(_fromUtf8("labelVersion")) self.labelVersion.setObjectName(_fromUtf8("labelVersion"))
self.label_2 = QtGui.QLabel(aboutDialog) self.label_2 = QtGui.QLabel(aboutDialog)
self.label_2.setGeometry(QtCore.QRect(10, 150, 341, 20)) self.label_2.setGeometry(QtCore.QRect(10, 150, 341, 41))
self.label_2.setAlignment(QtCore.Qt.AlignCenter) self.label_2.setAlignment(QtCore.Qt.AlignCenter)
self.label_2.setObjectName(_fromUtf8("label_2")) self.label_2.setObjectName(_fromUtf8("label_2"))
self.label_3 = QtGui.QLabel(aboutDialog) self.label_3 = QtGui.QLabel(aboutDialog)
@ -44,7 +53,7 @@ class Ui_aboutDialog(object):
self.label_3.setOpenExternalLinks(True) self.label_3.setOpenExternalLinks(True)
self.label_3.setObjectName(_fromUtf8("label_3")) self.label_3.setObjectName(_fromUtf8("label_3"))
self.label_5 = QtGui.QLabel(aboutDialog) self.label_5 = QtGui.QLabel(aboutDialog)
self.label_5.setGeometry(QtCore.QRect(10, 180, 341, 20)) self.label_5.setGeometry(QtCore.QRect(10, 190, 341, 20))
self.label_5.setAlignment(QtCore.Qt.AlignCenter) self.label_5.setAlignment(QtCore.Qt.AlignCenter)
self.label_5.setObjectName(_fromUtf8("label_5")) self.label_5.setObjectName(_fromUtf8("label_5"))
@ -54,10 +63,10 @@ class Ui_aboutDialog(object):
QtCore.QMetaObject.connectSlotsByName(aboutDialog) QtCore.QMetaObject.connectSlotsByName(aboutDialog)
def retranslateUi(self, aboutDialog): def retranslateUi(self, aboutDialog):
aboutDialog.setWindowTitle(QtGui.QApplication.translate("aboutDialog", "About", None, QtGui.QApplication.UnicodeUTF8)) aboutDialog.setWindowTitle(_translate("aboutDialog", "About", None))
self.label.setText(QtGui.QApplication.translate("aboutDialog", "PyBitmessage", None, QtGui.QApplication.UnicodeUTF8)) self.label.setText(_translate("aboutDialog", "PyBitmessage", None))
self.labelVersion.setText(QtGui.QApplication.translate("aboutDialog", "version ?", None, QtGui.QApplication.UnicodeUTF8)) self.labelVersion.setText(_translate("aboutDialog", "version ?", None))
self.label_2.setText(QtGui.QApplication.translate("aboutDialog", "Copyright © 2013 Jonathan Warren", None, QtGui.QApplication.UnicodeUTF8)) self.label_2.setText(_translate("aboutDialog", "<html><head/><body><p>Copyright © 2012-2013 Jonathan Warren<br/>Copyright © 2013 The Bitmessage Developers</p></body></html>", None))
self.label_3.setText(QtGui.QApplication.translate("aboutDialog", "<html><head/><body><p>Distributed under the MIT/X11 software license; see <a href=\"http://www.opensource.org/licenses/mit-license.php\"><span style=\" text-decoration: underline; color:#0000ff;\">http://www.opensource.org/licenses/mit-license.php</span></a></p></body></html>", None, QtGui.QApplication.UnicodeUTF8)) self.label_3.setText(_translate("aboutDialog", "<html><head/><body><p>Distributed under the MIT/X11 software license; see <a href=\"http://www.opensource.org/licenses/mit-license.php\"><span style=\" text-decoration: underline; color:#0000ff;\">http://www.opensource.org/licenses/mit-license.php</span></a></p></body></html>", None))
self.label_5.setText(QtGui.QApplication.translate("aboutDialog", "This is Beta software.", None, QtGui.QApplication.UnicodeUTF8)) self.label_5.setText(_translate("aboutDialog", "This is Beta software.", None))

View File

@ -70,11 +70,11 @@
<x>10</x> <x>10</x>
<y>150</y> <y>150</y>
<width>341</width> <width>341</width>
<height>20</height> <height>41</height>
</rect> </rect>
</property> </property>
<property name="text"> <property name="text">
<string>Copyright © 2013 Jonathan Warren</string> <string>&lt;html&gt;&lt;head/&gt;&lt;body&gt;&lt;p&gt;Copyright © 2012-2013 Jonathan Warren&lt;br/&gt;Copyright © 2013 The Bitmessage Developers&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property> </property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
@ -103,7 +103,7 @@
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>10</x> <x>10</x>
<y>180</y> <y>190</y>
<width>341</width> <width>341</width>
<height>20</height> <height>20</height>
</rect> </rect>

View File

@ -147,17 +147,26 @@ class singleWorker(threading.Thread):
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
streamNumber, 'advertiseobject', inventoryHash)) streamNumber, 'advertiseobject', inventoryHash))
shared.UISignalQueue.put(('updateStatusBar', '')) shared.UISignalQueue.put(('updateStatusBar', ''))
shared.config.set( try:
myAddress, 'lastpubkeysendtime', str(int(time.time()))) shared.config.set(
with open(shared.appdata + 'keys.dat', 'wb') as configfile: myAddress, 'lastpubkeysendtime', str(int(time.time())))
shared.config.write(configfile) with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile)
except:
# The user deleted the address out of the keys.dat file before this
# finished.
pass
# If this isn't a chan address, this function assembles the pubkey data, # If this isn't a chan address, this function assembles the pubkey data,
# does the necessary POW and sends it out. If it *is* a chan then it # does the necessary POW and sends it out. If it *is* a chan then it
# assembles the pubkey and stores is in the pubkey table so that we can # assembles the pubkey and stores is in the pubkey table so that we can
# send messages to "ourselves". # send messages to "ourselves".
def sendOutOrStoreMyV3Pubkey(self, hash): def sendOutOrStoreMyV3Pubkey(self, hash):
myAddress = shared.myAddressesByHash[hash] try:
myAddress = shared.myAddressesByHash[hash]
except:
#The address has been deleted.
return
if shared.safeConfigGetBoolean(myAddress, 'chan'): if shared.safeConfigGetBoolean(myAddress, 'chan'):
with shared.printLock: with shared.printLock:
print 'This is a chan address. Not sending pubkey.' print 'This is a chan address. Not sending pubkey.'
@ -224,14 +233,22 @@ class singleWorker(threading.Thread):
shared.broadcastToSendDataQueues(( shared.broadcastToSendDataQueues((
streamNumber, 'advertiseobject', inventoryHash)) streamNumber, 'advertiseobject', inventoryHash))
shared.UISignalQueue.put(('updateStatusBar', '')) shared.UISignalQueue.put(('updateStatusBar', ''))
shared.config.set( try:
myAddress, 'lastpubkeysendtime', str(int(time.time()))) shared.config.set(
with open(shared.appdata + 'keys.dat', 'wb') as configfile: myAddress, 'lastpubkeysendtime', str(int(time.time())))
shared.config.write(configfile) with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile)
except:
# The user deleted the address out of the keys.dat file before this
# finished.
pass
# If this isn't a chan address, this function assembles the pubkey data, # If this isn't a chan address, this function assembles the pubkey data,
# does the necessary POW and sends it out. # does the necessary POW and sends it out.
def sendOutOrStoreMyV4Pubkey(self, myAddress): def sendOutOrStoreMyV4Pubkey(self, myAddress):
if not shared.config.has_section(myAddress):
#The address has been deleted.
return
if shared.safeConfigGetBoolean(myAddress, 'chan'): if shared.safeConfigGetBoolean(myAddress, 'chan'):
with shared.printLock: with shared.printLock:
print 'This is a chan address. Not sending pubkey.' print 'This is a chan address. Not sending pubkey.'