launched autopep8 --in-place --recursive --jobs=0 -aaaaa __init__.py

This commit is contained in:
Gatien Bovyn 2013-06-12 23:12:32 +02:00
parent a5dd8c9187
commit 4f3b6751b3

View File

@ -6,7 +6,7 @@ except:
try:
from PyQt4.QtCore import *
from PyQt4.QtGui import *
except Exception, err:
except Exception as err:
print 'PyBitmessage requires PyQt. You can download it from http://www.riverbankcomputing.com/software/pyqt/download or by searching Google for \'PyQt Download\' (without quotes).'
print 'Error message:', err
sys.exit()
@ -39,6 +39,7 @@ import pickle
import platform
import string
class MyForm(QtGui.QMainWindow):
str_broadcast_subscribers = '[Broadcast subscribers]'
@ -48,189 +49,256 @@ class MyForm(QtGui.QMainWindow):
self.ui = Ui_MainWindow()
self.ui.setupUi(self)
#Ask the user if we may delete their old version 1 addresses if they have any.
# Ask the user if we may delete their old version 1 addresses if they
# have any.
configSections = shared.config.sections()
for addressInKeysFile in configSections:
if addressInKeysFile <> 'bitmessagesettings':
status,addressVersionNumber,streamNumber,hash = decodeAddress(addressInKeysFile)
if addressInKeysFile != 'bitmessagesettings':
status, addressVersionNumber, streamNumber, hash = decodeAddress(
addressInKeysFile)
if addressVersionNumber == 1:
displayMsg = "One of your addresses, "+addressInKeysFile+", is an old version 1 address. Version 1 addresses are no longer supported. May we delete it now?"
reply = QtGui.QMessageBox.question(self, 'Message',displayMsg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
displayMsg = QtGui.QApplication.translate(
"MainWindow", "One of your addresses, %1, is an old version 1 address. Version 1 addresses are no longer supported. "
+ "May we delete it now?").arg(addressInKeysFile)
reply = QtGui.QMessageBox.question(
self, 'Message', displayMsg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
shared.config.remove_section(addressInKeysFile)
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile)
#Configure Bitmessage to start on startup (or remove the configuration) based on the setting in the keys.dat file
# Configure Bitmessage to start on startup (or remove the
# configuration) based on the setting in the keys.dat file
if 'win32' in sys.platform or 'win64' in sys.platform:
#Auto-startup for Windows
# Auto-startup for Windows
RUN_PATH = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run"
self.settings = QSettings(RUN_PATH, QSettings.NativeFormat)
self.settings.remove("PyBitmessage") #In case the user moves the program and the registry entry is no longer valid, this will delete the old registry entry.
self.settings.remove(
"PyBitmessage") # In case the user moves the program and the registry entry is no longer valid, this will delete the old registry entry.
if shared.config.getboolean('bitmessagesettings', 'startonlogon'):
self.settings.setValue("PyBitmessage",sys.argv[0])
self.settings.setValue("PyBitmessage", sys.argv[0])
elif 'darwin' in sys.platform:
#startup for mac
# startup for mac
pass
elif 'linux' in sys.platform:
#startup for linux
# startup for linux
pass
self.ui.labelSendBroadcastWarning.setVisible(False)
#FILE MENU and other buttons
QtCore.QObject.connect(self.ui.actionExit, QtCore.SIGNAL("triggered()"), self.quit)
QtCore.QObject.connect(self.ui.actionManageKeys, QtCore.SIGNAL("triggered()"), self.click_actionManageKeys)
QtCore.QObject.connect(self.ui.actionDeleteAllTrashedMessages, QtCore.SIGNAL("triggered()"), self.click_actionDeleteAllTrashedMessages)
QtCore.QObject.connect(self.ui.actionRegenerateDeterministicAddresses, QtCore.SIGNAL("triggered()"), self.click_actionRegenerateDeterministicAddresses)
QtCore.QObject.connect(self.ui.pushButtonNewAddress, QtCore.SIGNAL("clicked()"), self.click_NewAddressDialog)
QtCore.QObject.connect(self.ui.comboBoxSendFrom, QtCore.SIGNAL("activated(int)"),self.redrawLabelFrom)
QtCore.QObject.connect(self.ui.pushButtonAddAddressBook, QtCore.SIGNAL("clicked()"), self.click_pushButtonAddAddressBook)
QtCore.QObject.connect(self.ui.pushButtonAddSubscription, QtCore.SIGNAL("clicked()"), self.click_pushButtonAddSubscription)
QtCore.QObject.connect(self.ui.pushButtonAddBlacklist, QtCore.SIGNAL("clicked()"), self.click_pushButtonAddBlacklist)
QtCore.QObject.connect(self.ui.pushButtonSend, QtCore.SIGNAL("clicked()"), self.click_pushButtonSend)
QtCore.QObject.connect(self.ui.pushButtonLoadFromAddressBook, QtCore.SIGNAL("clicked()"), self.click_pushButtonLoadFromAddressBook)
QtCore.QObject.connect(self.ui.radioButtonBlacklist, QtCore.SIGNAL("clicked()"), self.click_radioButtonBlacklist)
QtCore.QObject.connect(self.ui.radioButtonWhitelist, QtCore.SIGNAL("clicked()"), self.click_radioButtonWhitelist)
QtCore.QObject.connect(self.ui.pushButtonStatusIcon, QtCore.SIGNAL("clicked()"), self.click_pushButtonStatusIcon)
QtCore.QObject.connect(self.ui.actionSettings, QtCore.SIGNAL("triggered()"), self.click_actionSettings)
QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL("triggered()"), self.click_actionAbout)
QtCore.QObject.connect(self.ui.actionHelp, QtCore.SIGNAL("triggered()"), self.click_actionHelp)
# FILE MENU and other buttons
QtCore.QObject.connect(self.ui.actionExit, QtCore.SIGNAL(
"triggered()"), self.quit)
QtCore.QObject.connect(self.ui.actionManageKeys, QtCore.SIGNAL(
"triggered()"), self.click_actionManageKeys)
QtCore.QObject.connect(self.ui.actionDeleteAllTrashedMessages, QtCore.SIGNAL(
"triggered()"), self.click_actionDeleteAllTrashedMessages)
QtCore.QObject.connect(self.ui.actionRegenerateDeterministicAddresses, QtCore.SIGNAL(
"triggered()"), self.click_actionRegenerateDeterministicAddresses)
QtCore.QObject.connect(self.ui.pushButtonNewAddress, QtCore.SIGNAL(
"clicked()"), self.click_NewAddressDialog)
QtCore.QObject.connect(self.ui.comboBoxSendFrom, QtCore.SIGNAL(
"activated(int)"), self.redrawLabelFrom)
QtCore.QObject.connect(self.ui.pushButtonAddAddressBook, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonAddAddressBook)
QtCore.QObject.connect(self.ui.pushButtonAddSubscription, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonAddSubscription)
QtCore.QObject.connect(self.ui.pushButtonAddBlacklist, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonAddBlacklist)
QtCore.QObject.connect(self.ui.pushButtonSend, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonSend)
QtCore.QObject.connect(self.ui.pushButtonLoadFromAddressBook, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonLoadFromAddressBook)
QtCore.QObject.connect(self.ui.radioButtonBlacklist, QtCore.SIGNAL(
"clicked()"), self.click_radioButtonBlacklist)
QtCore.QObject.connect(self.ui.radioButtonWhitelist, QtCore.SIGNAL(
"clicked()"), self.click_radioButtonWhitelist)
QtCore.QObject.connect(self.ui.pushButtonStatusIcon, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonStatusIcon)
QtCore.QObject.connect(self.ui.actionSettings, QtCore.SIGNAL(
"triggered()"), self.click_actionSettings)
QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL(
"triggered()"), self.click_actionAbout)
QtCore.QObject.connect(self.ui.actionHelp, QtCore.SIGNAL(
"triggered()"), self.click_actionHelp)
#Popup menu for the Inbox tab
# Popup menu for the Inbox tab
self.ui.inboxContextMenuToolbar = QtGui.QToolBar()
# Actions
self.actionReply = self.ui.inboxContextMenuToolbar.addAction("Reply", self.on_action_InboxReply)
self.actionAddSenderToAddressBook = self.ui.inboxContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Add sender to your Address Book"), self.on_action_InboxAddSenderToAddressBook)
self.actionTrashInboxMessage = self.ui.inboxContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Move to Trash"), self.on_action_InboxTrash)
self.actionForceHtml = self.ui.inboxContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "View HTML code as formatted text"), self.on_action_InboxMessageForceHtml)
self.ui.tableWidgetInbox.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuInbox)
self.popMenuInbox = QtGui.QMenu( self )
self.popMenuInbox.addAction( self.actionForceHtml )
self.actionReply = self.ui.inboxContextMenuToolbar.addAction(
"Reply", self.on_action_InboxReply)
self.actionAddSenderToAddressBook = self.ui.inboxContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Add sender to your Address Book"), self.on_action_InboxAddSenderToAddressBook)
self.actionTrashInboxMessage = self.ui.inboxContextMenuToolbar.addAction(
QtGui.QApplication.translate("MainWindow", "Move to Trash"), self.on_action_InboxTrash)
self.actionForceHtml = self.ui.inboxContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "View HTML code as formatted text"), self.on_action_InboxMessageForceHtml)
self.ui.tableWidgetInbox.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
self.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'), self.on_context_menuInbox)
self.popMenuInbox = QtGui.QMenu(self)
self.popMenuInbox.addAction(self.actionForceHtml)
self.popMenuInbox.addSeparator()
self.popMenuInbox.addAction( self.actionReply )
self.popMenuInbox.addAction( self.actionAddSenderToAddressBook )
self.popMenuInbox.addAction(self.actionReply)
self.popMenuInbox.addAction(self.actionAddSenderToAddressBook)
self.popMenuInbox.addSeparator()
self.popMenuInbox.addAction( self.actionTrashInboxMessage )
self.popMenuInbox.addAction(self.actionTrashInboxMessage)
#Popup menu for the Your Identities tab
# Popup menu for the Your Identities tab
self.ui.addressContextMenuToolbar = QtGui.QToolBar()
# Actions
self.actionNew = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "New"), self.on_action_YourIdentitiesNew)
self.actionEnable = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Enable"), self.on_action_YourIdentitiesEnable)
self.actionDisable = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Disable"), self.on_action_YourIdentitiesDisable)
self.actionClipboard = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Copy address to clipboard"), self.on_action_YourIdentitiesClipboard)
self.actionSpecialAddressBehavior = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Special address behavior..."), self.on_action_SpecialAddressBehaviorDialog)
self.ui.tableWidgetYourIdentities.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
self.connect(self.ui.tableWidgetYourIdentities, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuYourIdentities)
self.popMenu = QtGui.QMenu( self )
self.popMenu.addAction( self.actionNew )
self.actionNew = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "New"), self.on_action_YourIdentitiesNew)
self.actionEnable = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Enable"), self.on_action_YourIdentitiesEnable)
self.actionDisable = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Disable"), self.on_action_YourIdentitiesDisable)
self.actionClipboard = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Copy address to clipboard"), self.on_action_YourIdentitiesClipboard)
self.actionSpecialAddressBehavior = self.ui.addressContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Special address behavior..."), self.on_action_SpecialAddressBehaviorDialog)
self.ui.tableWidgetYourIdentities.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
self.connect(self.ui.tableWidgetYourIdentities, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'), self.on_context_menuYourIdentities)
self.popMenu = QtGui.QMenu(self)
self.popMenu.addAction(self.actionNew)
self.popMenu.addSeparator()
self.popMenu.addAction( self.actionClipboard )
self.popMenu.addAction(self.actionClipboard)
self.popMenu.addSeparator()
self.popMenu.addAction( self.actionEnable )
self.popMenu.addAction( self.actionDisable )
self.popMenu.addAction( self.actionSpecialAddressBehavior )
self.popMenu.addAction(self.actionEnable)
self.popMenu.addAction(self.actionDisable)
self.popMenu.addAction(self.actionSpecialAddressBehavior)
#Popup menu for the Address Book page
# Popup menu for the Address Book page
self.ui.addressBookContextMenuToolbar = QtGui.QToolBar()
# Actions
self.actionAddressBookSend = self.ui.addressBookContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Send message to this address"), self.on_action_AddressBookSend)
self.actionAddressBookClipboard = self.ui.addressBookContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Copy address to clipboard"), self.on_action_AddressBookClipboard)
self.actionAddressBookNew = self.ui.addressBookContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Add New Address"), self.on_action_AddressBookNew)
self.actionAddressBookDelete = self.ui.addressBookContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Delete"), self.on_action_AddressBookDelete)
self.ui.tableWidgetAddressBook.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
self.connect(self.ui.tableWidgetAddressBook, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuAddressBook)
self.popMenuAddressBook = QtGui.QMenu( self )
self.popMenuAddressBook.addAction( self.actionAddressBookSend )
self.popMenuAddressBook.addAction( self.actionAddressBookClipboard )
self.actionAddressBookSend = self.ui.addressBookContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Send message to this address"), self.on_action_AddressBookSend)
self.actionAddressBookClipboard = self.ui.addressBookContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Copy address to clipboard"), self.on_action_AddressBookClipboard)
self.actionAddressBookNew = self.ui.addressBookContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Add New Address"), self.on_action_AddressBookNew)
self.actionAddressBookDelete = self.ui.addressBookContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Delete"), self.on_action_AddressBookDelete)
self.ui.tableWidgetAddressBook.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
self.connect(self.ui.tableWidgetAddressBook, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'), self.on_context_menuAddressBook)
self.popMenuAddressBook = QtGui.QMenu(self)
self.popMenuAddressBook.addAction(self.actionAddressBookSend)
self.popMenuAddressBook.addAction(self.actionAddressBookClipboard)
self.popMenuAddressBook.addSeparator()
self.popMenuAddressBook.addAction( self.actionAddressBookNew )
self.popMenuAddressBook.addAction( self.actionAddressBookDelete )
self.popMenuAddressBook.addAction(self.actionAddressBookNew)
self.popMenuAddressBook.addAction(self.actionAddressBookDelete)
#Popup menu for the Subscriptions page
# Popup menu for the Subscriptions page
self.ui.subscriptionsContextMenuToolbar = QtGui.QToolBar()
# Actions
self.actionsubscriptionsNew = self.ui.subscriptionsContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "New"), self.on_action_SubscriptionsNew)
self.actionsubscriptionsDelete = self.ui.subscriptionsContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Delete"), self.on_action_SubscriptionsDelete)
self.actionsubscriptionsClipboard = self.ui.subscriptionsContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Copy address to clipboard"), self.on_action_SubscriptionsClipboard)
self.actionsubscriptionsEnable = self.ui.subscriptionsContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Enable"), self.on_action_SubscriptionsEnable)
self.actionsubscriptionsDisable = self.ui.subscriptionsContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Disable"), self.on_action_SubscriptionsDisable)
self.ui.tableWidgetSubscriptions.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
self.connect(self.ui.tableWidgetSubscriptions, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuSubscriptions)
self.popMenuSubscriptions = QtGui.QMenu( self )
self.popMenuSubscriptions.addAction( self.actionsubscriptionsNew )
self.popMenuSubscriptions.addAction( self.actionsubscriptionsDelete )
self.actionsubscriptionsNew = self.ui.subscriptionsContextMenuToolbar.addAction(
QtGui.QApplication.translate("MainWindow", "New"), self.on_action_SubscriptionsNew)
self.actionsubscriptionsDelete = self.ui.subscriptionsContextMenuToolbar.addAction(
QtGui.QApplication.translate("MainWindow", "Delete"), self.on_action_SubscriptionsDelete)
self.actionsubscriptionsClipboard = self.ui.subscriptionsContextMenuToolbar.addAction(
QtGui.QApplication.translate("MainWindow", "Copy address to clipboard"), self.on_action_SubscriptionsClipboard)
self.actionsubscriptionsEnable = self.ui.subscriptionsContextMenuToolbar.addAction(
QtGui.QApplication.translate("MainWindow", "Enable"), self.on_action_SubscriptionsEnable)
self.actionsubscriptionsDisable = self.ui.subscriptionsContextMenuToolbar.addAction(
QtGui.QApplication.translate("MainWindow", "Disable"), self.on_action_SubscriptionsDisable)
self.ui.tableWidgetSubscriptions.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
self.connect(self.ui.tableWidgetSubscriptions, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'), self.on_context_menuSubscriptions)
self.popMenuSubscriptions = QtGui.QMenu(self)
self.popMenuSubscriptions.addAction(self.actionsubscriptionsNew)
self.popMenuSubscriptions.addAction(self.actionsubscriptionsDelete)
self.popMenuSubscriptions.addSeparator()
self.popMenuSubscriptions.addAction( self.actionsubscriptionsEnable )
self.popMenuSubscriptions.addAction( self.actionsubscriptionsDisable )
self.popMenuSubscriptions.addAction(self.actionsubscriptionsEnable)
self.popMenuSubscriptions.addAction(self.actionsubscriptionsDisable)
self.popMenuSubscriptions.addSeparator()
self.popMenuSubscriptions.addAction( self.actionsubscriptionsClipboard )
self.popMenuSubscriptions.addAction(self.actionsubscriptionsClipboard)
#Popup menu for the Sent page
# Popup menu for the Sent page
self.ui.sentContextMenuToolbar = QtGui.QToolBar()
# Actions
self.actionTrashSentMessage = self.ui.sentContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Move to Trash"), self.on_action_SentTrash)
self.actionSentClipboard = self.ui.sentContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Copy destination address to clipboard"), self.on_action_SentClipboard)
self.actionForceSend = self.ui.sentContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Force send"), self.on_action_ForceSend)
self.ui.tableWidgetSent.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
self.connect(self.ui.tableWidgetSent, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuSent)
#self.popMenuSent = QtGui.QMenu( self )
#self.popMenuSent.addAction( self.actionSentClipboard )
#self.popMenuSent.addAction( self.actionTrashSentMessage )
self.actionTrashSentMessage = self.ui.sentContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Move to Trash"), self.on_action_SentTrash)
self.actionSentClipboard = self.ui.sentContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Copy destination address to clipboard"), self.on_action_SentClipboard)
self.actionForceSend = self.ui.sentContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Force send"), self.on_action_ForceSend)
self.ui.tableWidgetSent.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
self.connect(self.ui.tableWidgetSent, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'), self.on_context_menuSent)
# self.popMenuSent = QtGui.QMenu( self )
# self.popMenuSent.addAction( self.actionSentClipboard )
# self.popMenuSent.addAction( self.actionTrashSentMessage )
#Popup menu for the Blacklist page
# Popup menu for the Blacklist page
self.ui.blacklistContextMenuToolbar = QtGui.QToolBar()
# Actions
self.actionBlacklistNew = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Add new entry"), self.on_action_BlacklistNew)
self.actionBlacklistDelete = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Delete"), self.on_action_BlacklistDelete)
self.actionBlacklistClipboard = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Copy address to clipboard"), self.on_action_BlacklistClipboard)
self.actionBlacklistEnable = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Enable"), self.on_action_BlacklistEnable)
self.actionBlacklistDisable = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate("MainWindow", "Disable"), self.on_action_BlacklistDisable)
self.ui.tableWidgetBlacklist.setContextMenuPolicy( QtCore.Qt.CustomContextMenu )
self.connect(self.ui.tableWidgetBlacklist, QtCore.SIGNAL('customContextMenuRequested(const QPoint&)'), self.on_context_menuBlacklist)
self.popMenuBlacklist = QtGui.QMenu( self )
#self.popMenuBlacklist.addAction( self.actionBlacklistNew )
self.popMenuBlacklist.addAction( self.actionBlacklistDelete )
self.actionBlacklistNew = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Add new entry"), self.on_action_BlacklistNew)
self.actionBlacklistDelete = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Delete"), self.on_action_BlacklistDelete)
self.actionBlacklistClipboard = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Copy address to clipboard"), self.on_action_BlacklistClipboard)
self.actionBlacklistEnable = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Enable"), self.on_action_BlacklistEnable)
self.actionBlacklistDisable = self.ui.blacklistContextMenuToolbar.addAction(QtGui.QApplication.translate(
"MainWindow", "Disable"), self.on_action_BlacklistDisable)
self.ui.tableWidgetBlacklist.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
self.connect(self.ui.tableWidgetBlacklist, QtCore.SIGNAL(
'customContextMenuRequested(const QPoint&)'), self.on_context_menuBlacklist)
self.popMenuBlacklist = QtGui.QMenu(self)
# self.popMenuBlacklist.addAction( self.actionBlacklistNew )
self.popMenuBlacklist.addAction(self.actionBlacklistDelete)
self.popMenuBlacklist.addSeparator()
self.popMenuBlacklist.addAction( self.actionBlacklistClipboard )
self.popMenuBlacklist.addAction(self.actionBlacklistClipboard)
self.popMenuBlacklist.addSeparator()
self.popMenuBlacklist.addAction( self.actionBlacklistEnable )
self.popMenuBlacklist.addAction( self.actionBlacklistDisable )
self.popMenuBlacklist.addAction(self.actionBlacklistEnable)
self.popMenuBlacklist.addAction(self.actionBlacklistDisable)
#Initialize the user's list of addresses on the 'Your Identities' tab.
# Initialize the user's list of addresses on the 'Your Identities' tab.
configSections = shared.config.sections()
for addressInKeysFile in configSections:
if addressInKeysFile <> 'bitmessagesettings':
isEnabled = shared.config.getboolean(addressInKeysFile, 'enabled')
newItem = QtGui.QTableWidgetItem(unicode(shared.config.get(addressInKeysFile, 'label'),'utf-8)'))
if addressInKeysFile != 'bitmessagesettings':
isEnabled = shared.config.getboolean(
addressInKeysFile, 'enabled')
newItem = QtGui.QTableWidgetItem(unicode(
shared.config.get(addressInKeysFile, 'label'), 'utf-8)'))
if not isEnabled:
newItem.setTextColor(QtGui.QColor(128,128,128))
newItem.setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetYourIdentities.insertRow(0)
self.ui.tableWidgetYourIdentities.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(addressInKeysFile)
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not isEnabled:
newItem.setTextColor(QtGui.QColor(128,128,128))
if shared.safeConfigGetBoolean(addressInKeysFile,'mailinglist'):
newItem.setTextColor(QtGui.QColor(137,04,177))#magenta
newItem.setTextColor(QtGui.QColor(128, 128, 128))
if shared.safeConfigGetBoolean(addressInKeysFile, 'mailinglist'):
newItem.setTextColor(QtGui.QColor(137, 04, 177)) # magenta
self.ui.tableWidgetYourIdentities.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(str(addressStream(addressInKeysFile)))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
newItem = QtGui.QTableWidgetItem(str(
addressStream(addressInKeysFile)))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not isEnabled:
newItem.setTextColor(QtGui.QColor(128,128,128))
newItem.setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetYourIdentities.setItem(0, 2, newItem)
if isEnabled:
status,addressVersionNumber,streamNumber,hash = decodeAddress(addressInKeysFile)
status, addressVersionNumber, streamNumber, hash = decodeAddress(
addressInKeysFile)
#Load inbox from messages database file
# Load inbox from messages database file
font = QFont()
font.setBold(True)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, fromaddress, subject, received, message, read FROM inbox where folder='inbox' ORDER BY received''')
shared.sqlSubmitQueue.put(
'''SELECT msgid, toaddress, fromaddress, subject, received, message, read FROM inbox where folder='inbox' ORDER BY received''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
@ -251,70 +319,80 @@ class MyForm(QtGui.QMainWindow):
fromLabel = ''
t = (fromAddress,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn <> []:
if queryreturn != []:
for row in queryreturn:
fromLabel, = row
if fromLabel == '': #If this address wasn't in our address book..
if fromLabel == '': # If this address wasn't in our address book...
t = (fromAddress,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''select label from subscriptions where address=?''')
shared.sqlSubmitQueue.put(
'''select label from subscriptions where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn <> []:
if queryreturn != []:
for row in queryreturn:
fromLabel, = row
self.ui.tableWidgetInbox.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(toLabel,'utf-8'))
newItem.setToolTip(unicode(toLabel,'utf-8'))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
newItem.setData(Qt.UserRole,str(toAddress))
if shared.safeConfigGetBoolean(toAddress,'mailinglist'):
newItem.setTextColor(QtGui.QColor(137,04,177))
self.ui.tableWidgetInbox.setItem(0,0,newItem)
newItem.setData(Qt.UserRole, str(toAddress))
if shared.safeConfigGetBoolean(toAddress, 'mailinglist'):
newItem.setTextColor(QtGui.QColor(137, 04, 177))
self.ui.tableWidgetInbox.setItem(0, 0, newItem)
if fromLabel == '':
newItem = QtGui.QTableWidgetItem(unicode(fromAddress,'utf-8'))
newItem.setToolTip(unicode(fromAddress,'utf-8'))
newItem = QtGui.QTableWidgetItem(
unicode(fromAddress, 'utf-8'))
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(fromLabel,'utf-8'))
newItem.setToolTip(unicode(fromLabel,'utf-8'))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromLabel, 'utf-8'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
newItem.setData(Qt.UserRole,str(fromAddress))
newItem.setData(Qt.UserRole, str(fromAddress))
self.ui.tableWidgetInbox.setItem(0,1,newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject,'utf-8'))
newItem.setToolTip(unicode(subject,'utf-8'))
newItem.setData(Qt.UserRole,unicode(message,'utf-8)'))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetInbox.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8'))
newItem.setToolTip(unicode(subject, 'utf-8'))
newItem.setData(Qt.UserRole, unicode(message, 'utf-8)'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0,2,newItem)
newItem = myTableWidgetItem(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'),localtime(int(received))),'utf-8'))
newItem.setToolTip(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'),localtime(int(received))),'utf-8'))
newItem.setData(Qt.UserRole,QByteArray(msgid))
newItem.setData(33,int(received))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetInbox.setItem(0, 2, newItem)
newItem = myTableWidgetItem(unicode(strftime(shared.config.get(
'bitmessagesettings', 'timeformat'), localtime(int(received))), 'utf-8'))
newItem.setToolTip(unicode(strftime(shared.config.get(
'bitmessagesettings', 'timeformat'), localtime(int(received))), 'utf-8'))
newItem.setData(Qt.UserRole, QByteArray(msgid))
newItem.setData(33, int(received))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not read:
newItem.setFont(font)
self.ui.tableWidgetInbox.setItem(0,3,newItem)
self.ui.tableWidgetInbox.sortItems(3,Qt.DescendingOrder)
self.ui.tableWidgetInbox.setItem(0, 3, newItem)
self.ui.tableWidgetInbox.sortItems(3, Qt.DescendingOrder)
self.ui.tableWidgetInbox.keyPressEvent = self.tableWidgetInboxKeyPressEvent
#Load Sent items from database
# Load Sent items from database
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime FROM sent where folder = 'sent' ORDER BY lastactiontime''')
shared.sqlSubmitQueue.put(
'''SELECT toaddress, fromaddress, subject, message, status, ackdata, lastactiontime FROM sent where folder = 'sent' ORDER BY lastactiontime''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
@ -332,71 +410,88 @@ class MyForm(QtGui.QMainWindow):
toLabel = ''
t = (toAddress,)
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(
'''select label from addressbook where address=?''')
shared.sqlSubmitQueue.put(t)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
if queryreturn <> []:
if queryreturn != []:
for row in queryreturn:
toLabel, = row
self.ui.tableWidgetSent.insertRow(0)
if toLabel == '':
newItem = QtGui.QTableWidgetItem(unicode(toAddress,'utf-8'))
newItem.setToolTip(unicode(toAddress,'utf-8'))
newItem = QtGui.QTableWidgetItem(unicode(toAddress, 'utf-8'))
newItem.setToolTip(unicode(toAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(toLabel,'utf-8'))
newItem.setToolTip(unicode(toLabel,'utf-8'))
newItem.setData(Qt.UserRole,str(toAddress))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetSent.setItem(0,0,newItem)
newItem = QtGui.QTableWidgetItem(unicode(toLabel, 'utf-8'))
newItem.setToolTip(unicode(toLabel, 'utf-8'))
newItem.setData(Qt.UserRole, str(toAddress))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 0, newItem)
if fromLabel == '':
newItem = QtGui.QTableWidgetItem(unicode(fromAddress,'utf-8'))
newItem.setToolTip(unicode(fromAddress,'utf-8'))
newItem = QtGui.QTableWidgetItem(
unicode(fromAddress, 'utf-8'))
newItem.setToolTip(unicode(fromAddress, 'utf-8'))
else:
newItem = QtGui.QTableWidgetItem(unicode(fromLabel,'utf-8'))
newItem.setToolTip(unicode(fromLabel,'utf-8'))
newItem.setData(Qt.UserRole,str(fromAddress))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetSent.setItem(0,1,newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject,'utf-8'))
newItem.setToolTip(unicode(subject,'utf-8'))
newItem.setData(Qt.UserRole,unicode(message,'utf-8)'))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetSent.setItem(0,2,newItem)
newItem = QtGui.QTableWidgetItem(unicode(fromLabel, 'utf-8'))
newItem.setToolTip(unicode(fromLabel, 'utf-8'))
newItem.setData(Qt.UserRole, str(fromAddress))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 1, newItem)
newItem = QtGui.QTableWidgetItem(unicode(subject, 'utf-8'))
newItem.setToolTip(unicode(subject, 'utf-8'))
newItem.setData(Qt.UserRole, unicode(message, 'utf-8)'))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 2, newItem)
if status == 'awaitingpubkey':
statusText = QtGui.QApplication.translate("MainWindow", "Waiting on their encryption key. Will request it again soon.")
statusText = QtGui.QApplication.translate(
"MainWindow", "Waiting on their encryption key. Will request it again soon.")
elif status == 'doingpowforpubkey':
statusText = QtGui.QApplication.translate("MainWindow", "Encryption key request queued.")
statusText = QtGui.QApplication.translate(
"MainWindow", "Encryption key request queued.")
elif status == 'msgqueued':
statusText = QtGui.QApplication.translate("MainWindow", "Queued.")
statusText = QtGui.QApplication.translate(
"MainWindow", "Queued.")
elif status == 'msgsent':
statusText = QtGui.QApplication.translate("MainWindow", "Message sent. Waiting on acknowledgement. Sent at %1").arg(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'),localtime(lastactiontime))))
statusText = QtGui.QApplication.translate("MainWindow", "Message sent. Waiting on acknowledgement. Sent at %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(lastactiontime))))
elif status == 'doingmsgpow':
statusText = QtGui.QApplication.translate("MainWindow", "Need to do work to send message. Work is queued.")
statusText = QtGui.QApplication.translate(
"MainWindow", "Need to do work to send message. Work is queued.")
elif status == 'ackreceived':
statusText = QtGui.QApplication.translate("MainWindow", "Acknowledgement of the message received %1").arg(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'),localtime(int(lastactiontime)))))
statusText = QtGui.QApplication.translate("MainWindow", "Acknowledgement of the message received %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(lastactiontime)))))
elif status == 'broadcastqueued':
statusText = QtGui.QApplication.translate("MainWindow", "Broadcast queued.")
statusText = QtGui.QApplication.translate(
"MainWindow", "Broadcast queued.")
elif status == 'broadcastsent':
statusText = QtGui.QApplication.translate("MainWindow", "Broadcast on %1").arg(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'),localtime(int(lastactiontime)))))
statusText = QtGui.QApplication.translate("MainWindow", "Broadcast on %1").arg(unicode(strftime(
shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(lastactiontime)))))
elif status == 'toodifficult':
statusText = QtGui.QApplication.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)))))
statusText = QtGui.QApplication.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)))))
elif status == 'forcepow':
statusText = QtGui.QApplication.translate("MainWindow", "Forced difficulty override. Send should start soon.")
statusText = QtGui.QApplication.translate(
"MainWindow", "Forced difficulty override. Send should start soon.")
else:
statusText = QtGui.QApplication.translate("Unknown status: %1 %2").arg(status).arg(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'),localtime(int(lastactiontime)))))
newItem = myTableWidgetItem(statusText)
statusText = QtGui.QApplication.translate("MainWindow", "Unknown status: %1 %2").arg(status).arg(unicode(
strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(lastactiontime)))))
newItem = myTableWidgetItem(statusText)
newItem.setToolTip(statusText)
newItem.setData(Qt.UserRole,QByteArray(ackdata))
newItem.setData(33,int(lastactiontime))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetSent.setItem(0,3,newItem)
self.ui.tableWidgetSent.sortItems(3,Qt.DescendingOrder)
newItem.setData(Qt.UserRole, QByteArray(ackdata))
newItem.setData(33, int(lastactiontime))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetSent.setItem(0, 3, newItem)
self.ui.tableWidgetSent.sortItems(3, Qt.DescendingOrder)
self.ui.tableWidgetSent.keyPressEvent = self.tableWidgetSentKeyPressEvent
#Initialize the address book
# Initialize the address book
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('SELECT * FROM addressbook')
shared.sqlSubmitQueue.put('')
@ -405,77 +500,98 @@ class MyForm(QtGui.QMainWindow):
for row in queryreturn:
label, address = row
self.ui.tableWidgetAddressBook.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(label,'utf-8'))
self.ui.tableWidgetAddressBook.setItem(0,0,newItem)
newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetAddressBook.setItem(0,1,newItem)
newItem = QtGui.QTableWidgetItem(unicode(label, 'utf-8'))
self.ui.tableWidgetAddressBook.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetAddressBook.setItem(0, 1, newItem)
#Initialize the Subscriptions
# Initialize the Subscriptions
self.rerenderSubscriptions()
#Initialize the Blacklist or Whitelist
# Initialize the Blacklist or Whitelist
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
self.loadBlackWhiteList()
else:
self.ui.tabWidget.setTabText(6,'Whitelist')
self.ui.tabWidget.setTabText(6, 'Whitelist')
self.ui.radioButtonWhitelist.click()
self.loadBlackWhiteList()
QtCore.QObject.connect(self.ui.tableWidgetYourIdentities, QtCore.SIGNAL(
"itemChanged(QTableWidgetItem *)"), self.tableWidgetYourIdentitiesItemChanged)
QtCore.QObject.connect(self.ui.tableWidgetAddressBook, QtCore.SIGNAL(
"itemChanged(QTableWidgetItem *)"), self.tableWidgetAddressBookItemChanged)
QtCore.QObject.connect(self.ui.tableWidgetSubscriptions, QtCore.SIGNAL(
"itemChanged(QTableWidgetItem *)"), self.tableWidgetSubscriptionsItemChanged)
QtCore.QObject.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL(
"itemSelectionChanged ()"), self.tableWidgetInboxItemClicked)
QtCore.QObject.connect(self.ui.tableWidgetSent, QtCore.SIGNAL(
"itemSelectionChanged ()"), self.tableWidgetSentItemClicked)
QtCore.QObject.connect(self.ui.tableWidgetYourIdentities, QtCore.SIGNAL("itemChanged(QTableWidgetItem *)"), self.tableWidgetYourIdentitiesItemChanged)
QtCore.QObject.connect(self.ui.tableWidgetAddressBook, QtCore.SIGNAL("itemChanged(QTableWidgetItem *)"), self.tableWidgetAddressBookItemChanged)
QtCore.QObject.connect(self.ui.tableWidgetSubscriptions, QtCore.SIGNAL("itemChanged(QTableWidgetItem *)"), self.tableWidgetSubscriptionsItemChanged)
QtCore.QObject.connect(self.ui.tableWidgetInbox, QtCore.SIGNAL("itemSelectionChanged ()"), self.tableWidgetInboxItemClicked)
QtCore.QObject.connect(self.ui.tableWidgetSent, QtCore.SIGNAL("itemSelectionChanged ()"), self.tableWidgetSentItemClicked)
#Put the colored icon on the status bar
#self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png"))
# Put the colored icon on the status bar
# self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png"))
self.statusbar = self.statusBar()
self.statusbar.insertPermanentWidget(0,self.ui.pushButtonStatusIcon)
self.ui.labelStartupTime.setText(QtGui.QApplication.translate("MainWindow", "Since startup on %1").arg(unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'),localtime(int(time.time()))))))
self.statusbar.insertPermanentWidget(0, self.ui.pushButtonStatusIcon)
self.ui.labelStartupTime.setText(QtGui.QApplication.translate("MainWindow", "Since startup on %1").arg(
unicode(strftime(shared.config.get('bitmessagesettings', 'timeformat'), localtime(int(time.time()))))))
self.numberOfMessagesProcessed = 0
self.numberOfBroadcastsProcessed = 0
self.numberOfPubkeysProcessed = 0
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)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByHash)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByAckdata)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewInboxMessage)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewSentMessage)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("updateNetworkStatusTab()"), self.updateNetworkStatusTab)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("incrementNumberOfMessagesProcessed()"), self.incrementNumberOfMessagesProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("incrementNumberOfPubkeysProcessed()"), self.incrementNumberOfPubkeysProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("incrementNumberOfBroadcastsProcessed()"), self.incrementNumberOfBroadcastsProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("rerenderInboxFromLabels()"), self.rerenderInboxFromLabels)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("rerenderSubscriptions()"), self.rerenderSubscriptions)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL("removeInboxRowByMsgid(PyQt_PyObject)"), self.removeInboxRowByMsgid)
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(
"updateSentItemStatusByHash(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByHash)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), self.updateSentItemStatusByAckdata)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewInboxMessage)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewSentMessage)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"updateNetworkStatusTab()"), self.updateNetworkStatusTab)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"incrementNumberOfMessagesProcessed()"), self.incrementNumberOfMessagesProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"incrementNumberOfPubkeysProcessed()"), self.incrementNumberOfPubkeysProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"incrementNumberOfBroadcastsProcessed()"), self.incrementNumberOfBroadcastsProcessed)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"rerenderInboxFromLabels()"), self.rerenderInboxFromLabels)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"rerenderSubscriptions()"), self.rerenderSubscriptions)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"removeInboxRowByMsgid(PyQt_PyObject)"), self.removeInboxRowByMsgid)
self.UISignalThread.start()
#Below this point, it would be good if all of the necessary global data structures were initialized.
# Below this point, it would be good if all of the necessary global data
# structures were initialized.
self.rerenderComboBoxSendFrom()
#Show or hide the application window after clicking an item within the tray icon or, on Windows, the try icon itself.
# 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)
#else:
#self.showMaximized()
# else:
# self.showMaximized()
self.show()
self.setWindowState(self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
self.setWindowState(
self.windowState() & ~QtCore.Qt.WindowMinimized | QtCore.Qt.WindowActive)
self.activateWindow()
# pointer to the application
#app = None
# app = None
# The most recent message
newMessageItem = None
@ -484,7 +600,7 @@ class MyForm(QtGui.QMainWindow):
# show the application window
def appIndicatorShow(self):
if self.actionShow == None:
if self.actionShow is None:
return
if not self.actionShow.isChecked():
self.actionShow.setChecked(True)
@ -492,7 +608,7 @@ class MyForm(QtGui.QMainWindow):
# unchecks the show item on the application indicator
def appIndicatorHide(self):
if self.actionShow == None:
if self.actionShow is None:
return
if self.actionShow.isChecked():
self.actionShow.setChecked(False)
@ -531,11 +647,11 @@ class MyForm(QtGui.QMainWindow):
try:
self.ui.tableWidgetInbox.setCurrentItem(selectedItem)
except Exception:
self.ui.tableWidgetInbox.setCurrentCell(0,0)
self.ui.tableWidgetInbox.setCurrentCell(0, 0)
self.tableWidgetInboxItemClicked()
else:
# just select the first item
self.ui.tableWidgetInbox.setCurrentCell(0,0)
self.ui.tableWidgetInbox.setCurrentCell(0, 0)
self.tableWidgetInboxItemClicked()
# Show the program window and select send tab
@ -554,51 +670,60 @@ class MyForm(QtGui.QMainWindow):
self.ui.tabWidget.setCurrentIndex(5)
# create application indicator
def appIndicatorInit(self,app):
self.tray = QSystemTrayIcon(QtGui.QIcon(":/newPrefix/images/can-icon-24px-red.png"), app)
def appIndicatorInit(self, app):
self.tray = QSystemTrayIcon(QtGui.QIcon(
":/newPrefix/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)
QtCore.QObject.connect(self.tray, QtCore.SIGNAL(
traySignal), self.__icon_activated)
m = QMenu()
self.actionStatus = QtGui.QAction(QtGui.QApplication.translate("MainWindow", "Not Connected"),m,checkable=False)
self.actionStatus = QtGui.QAction(QtGui.QApplication.translate(
"MainWindow", "Not Connected"), m, checkable=False)
m.addAction(self.actionStatus)
# separator
actionSeparator = QtGui.QAction('',m,checkable=False)
actionSeparator = QtGui.QAction('', m, checkable=False)
actionSeparator.setSeparator(True)
m.addAction(actionSeparator)
# show bitmessage
self.actionShow = QtGui.QAction(QtGui.QApplication.translate("MainWindow", "Show Bitmessage"),m,checkable=True)
self.actionShow.setChecked(not shared.config.getboolean('bitmessagesettings', 'startintray'))
self.actionShow = QtGui.QAction(QtGui.QApplication.translate(
"MainWindow", "Show Bitmessage"), m, checkable=True)
self.actionShow.setChecked(not shared.config.getboolean(
'bitmessagesettings', 'startintray'))
self.actionShow.triggered.connect(self.appIndicatorShowOrHideWindow)
if not sys.platform[0:3] == 'win':
m.addAction(self.actionShow)
m.addAction(self.actionShow)
# Send
actionSend = QtGui.QAction(QtGui.QApplication.translate("MainWindow", "Send"),m,checkable=False)
actionSend = QtGui.QAction(QtGui.QApplication.translate(
"MainWindow", "Send"), m, checkable=False)
actionSend.triggered.connect(self.appIndicatorSend)
m.addAction(actionSend)
# Subscribe
actionSubscribe = QtGui.QAction(QtGui.QApplication.translate("MainWindow", "Subscribe"),m,checkable=False)
actionSubscribe = QtGui.QAction(QtGui.QApplication.translate(
"MainWindow", "Subscribe"), m, checkable=False)
actionSubscribe.triggered.connect(self.appIndicatorSubscribe)
m.addAction(actionSubscribe)
# Address book
actionAddressBook = QtGui.QAction(QtGui.QApplication.translate("MainWindow", "Address Book"),m,checkable=False)
actionAddressBook = QtGui.QAction(QtGui.QApplication.translate(
"MainWindow", "Address Book"), m, checkable=False)
actionAddressBook.triggered.connect(self.appIndicatorAddressBook)
m.addAction(actionAddressBook)
# separator
actionSeparator = QtGui.QAction('',m,checkable=False)
actionSeparator = QtGui.QAction('', m, checkable=False)
actionSeparator.setSeparator(True)
m.addAction(actionSeparator)
# Quit
m.addAction(QtGui.QApplication.translate("MainWindow", "Quit"), self.quit)
m.addAction(QtGui.QApplication.translate(
"MainWindow", "Quit"), self.quit)
self.tray.setContextMenu(m)
self.tray.show()
@ -631,7 +756,8 @@ class MyForm(QtGui.QMainWindow):
return
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''SELECT toaddress, read FROM inbox WHERE msgid=?''')
shared.sqlSubmitQueue.put(
'''SELECT toaddress, read FROM inbox WHERE msgid=?''')
shared.sqlSubmitQueue.put(inventoryHash)
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
@ -651,7 +777,8 @@ class MyForm(QtGui.QMainWindow):
unreadSubscriptions = 0
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('''SELECT msgid, toaddress, read FROM inbox where folder='inbox' ''')
shared.sqlSubmitQueue.put(
'''SELECT msgid, toaddress, read FROM inbox where folder='inbox' ''')
shared.sqlSubmitQueue.put('')
queryreturn = shared.sqlReturnQueue.get()
shared.sqlLock.release()
@ -677,21 +804,24 @@ class MyForm(QtGui.QMainWindow):
unreadMessages = unreadMessages + 1
return unreadMessages, unreadSubscriptions
# show the number of unread messages and subscriptions on the messaging menu
# show the number of unread messages and subscriptions on the messaging
# menu
def ubuntuMessagingMenuUnread(self, drawAttention):
unreadMessages, unreadSubscriptions = self.getUnread()
# unread messages
if unreadMessages > 0:
self.mmapp.append_source("Messages", None, "Messages (" + str(unreadMessages) + ")")
self.mmapp.append_source(
"Messages", None, "Messages (" + str(unreadMessages) + ")")
if drawAttention:
self.mmapp.draw_attention("Messages")
# unread subscriptions
if unreadSubscriptions > 0:
self.mmapp.append_source("Subscriptions", None, "Subscriptions (" + str(unreadSubscriptions) + ")")
self.mmapp.append_source("Subscriptions", None, "Subscriptions (" + str(
unreadSubscriptions) + ")")
if drawAttention:
self.mmapp.draw_attention("Subscriptions")
# initialise the Ubuntu messaging menu
def ubuntuMessagingMenuInit(self):
global withMessagingMenu
@ -702,13 +832,14 @@ class MyForm(QtGui.QMainWindow):
# has messageing menu been installed
if not withMessagingMenu:
print 'WARNING: MessagingMenu is not available. Is libmessaging-menu-dev installed?'
print 'WARNING: MessagingMenu is not available. Is libmessaging-menu-dev installed?'
return
# create the menu server
if withMessagingMenu:
try:
self.mmapp = MessagingMenu.App(desktop_id='pybitmessage.desktop')
self.mmapp = MessagingMenu.App(
desktop_id='pybitmessage.desktop')
self.mmapp.register()
self.mmapp.connect('activate-source', self.appIndicatorInbox)
self.ubuntuMessagingMenuUnread(True)
@ -726,7 +857,7 @@ class MyForm(QtGui.QMainWindow):
# has messageing menu been installed
if not withMessagingMenu:
print 'WARNING: messaging menu disabled or libmessaging-menu-dev not installed'
print 'WARNING: messaging menu disabled or libmessaging-menu-dev not installed'
return
# remember this item to that the messaging menu can find it
@ -756,18 +887,19 @@ class MyForm(QtGui.QMainWindow):
def notifierShow(self, title, subtitle):
global withMessagingMenu
if withMessagingMenu:
n = Notify.Notification.new(title, subtitle,'notification-message-email')
n = Notify.Notification.new(
title, subtitle, 'notification-message-email')
n.show()
return
else:
self.tray.showMessage(title, subtitle, 1, 2000)
def tableWidgetInboxKeyPressEvent(self,event):
def tableWidgetInboxKeyPressEvent(self, event):
if event.key() == QtCore.Qt.Key_Delete:
self.on_action_InboxTrash()
return QtGui.QTableWidget.keyPressEvent(self.ui.tableWidgetInbox, event)
def tableWidgetSentKeyPressEvent(self,event):
def tableWidgetSentKeyPressEvent(self, event):
if event.key() == QtCore.Qt.Key_Delete:
self.on_action_SentTrash()
return QtGui.QTableWidget.keyPressEvent(self.ui.tableWidgetSent, event)
@ -775,40 +907,52 @@ class MyForm(QtGui.QMainWindow):
def click_actionManageKeys(self):
if 'darwin' in sys.platform or 'linux' in sys.platform:
if shared.appdata == '':
#reply = QtGui.QMessageBox.information(self, 'keys.dat?','You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file.', QMessageBox.Ok)
reply = QtGui.QMessageBox.information(self, 'keys.dat?',QtGui.QApplication.translate("MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file."), QMessageBox.Ok)
# reply = QtGui.QMessageBox.information(self, 'keys.dat?','You
# may manage your keys by editing the keys.dat file stored in
# the same directory as this program. It is important that you
# back up this file.', QMessageBox.Ok)
reply = QtGui.QMessageBox.information(self, 'keys.dat?', QtGui.QApplication.translate(
"MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file."), QMessageBox.Ok)
else:
QtGui.QMessageBox.information(self, 'keys.dat?',QtGui.QApplication.translate("MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file.").arg(shared.appdata), QMessageBox.Ok)
QtGui.QMessageBox.information(self, 'keys.dat?', QtGui.QApplication.translate(
"MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file.").arg(shared.appdata), QMessageBox.Ok)
elif sys.platform == 'win32' or sys.platform == 'win64':
if shared.appdata == '':
reply = QtGui.QMessageBox.question(self, QtGui.QApplication.translate("MainWindow", "Open keys.dat?"),QtGui.QApplication.translate("MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
reply = QtGui.QMessageBox.question(self, QtGui.QApplication.translate("MainWindow", "Open keys.dat?"), QtGui.QApplication.translate(
"MainWindow", "You may manage your keys by editing the keys.dat file stored in the same directory as this program. It is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
else:
reply = QtGui.QMessageBox.question(self, QtGui.QApplication.translate("MainWindow", "Open keys.dat?"),QtGui.QApplication.translate("MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)").arg(shared.appdata), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
reply = QtGui.QMessageBox.question(self, QtGui.QApplication.translate("MainWindow", "Open keys.dat?"), QtGui.QApplication.translate(
"MainWindow", "You may manage your keys by editing the keys.dat file stored in\n %1 \nIt is important that you back up this file. Would you like to open the file now? (Be sure to close Bitmessage before making any changes.)").arg(shared.appdata), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No)
if reply == QtGui.QMessageBox.Yes:
self.openKeysFile()
def click_actionDeleteAllTrashedMessages(self):
if QtGui.QMessageBox.question(self, QtGui.QApplication.translate("MainWindow", "Delete trash?"),QtGui.QApplication.translate("MainWindow", "Are you sure you want to delete all trashed messages?"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
if QtGui.QMessageBox.question(self, QtGui.QApplication.translate("MainWindow", "Delete trash?"), QtGui.QApplication.translate("MainWindow", "Are you sure you want to delete all trashed messages?"), QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) == QtGui.QMessageBox.No:
return
shared.sqlLock.acquire()
shared.sqlSubmitQueue.put('deleteandvacuume')
shared.sqlLock.release()
def click_actionRegenerateDeterministicAddresses(self):
self.regenerateAddressesDialogInstance = regenerateAddressesDialog(self)
self.regenerateAddressesDialogInstance = regenerateAddressesDialog(
self)
if self.regenerateAddressesDialogInstance.exec_():
if self.regenerateAddressesDialogInstance.ui.lineEditPassphrase.text() == "":
QMessageBox.about(self, QtGui.QApplication.translate("MainWindow", "bad passphrase"), QtGui.QApplication.translate("MainWindow", "You must type your passphrase. If you don\'t have one then this is not the form for you."))
QMessageBox.about(self, QtGui.QApplication.translate("MainWindow", "bad passphrase"), QtGui.QApplication.translate(
"MainWindow", "You must type your passphrase. If you don\'t have one then this is not the form for you."))
else:
streamNumberForAddress = int(self.regenerateAddressesDialogInstance.ui.lineEditStreamNumber.text())
addressVersionNumber = int(self.regenerateAddressesDialogInstance.ui.lineEditAddressVersionNumber.text())
#self.addressGenerator = addressGenerator()
#self.addressGenerator.setup(addressVersionNumber,streamNumberForAddress,"unused address",self.regenerateAddressesDialogInstance.ui.spinBoxNumberOfAddressesToMake.value(),self.regenerateAddressesDialogInstance.ui.lineEditPassphrase.text().toUtf8(),self.regenerateAddressesDialogInstance.ui.checkBoxEighteenByteRipe.isChecked())
#QtCore.QObject.connect(self.addressGenerator, SIGNAL("writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.writeNewAddressToTable)
#QtCore.QObject.connect(self.addressGenerator, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
#self.addressGenerator.start()
shared.addressGeneratorQueue.put(('createDeterministicAddresses',addressVersionNumber,streamNumberForAddress,"regenerated deterministic address",self.regenerateAddressesDialogInstance.ui.spinBoxNumberOfAddressesToMake.value(),self.regenerateAddressesDialogInstance.ui.lineEditPassphrase.text().toUtf8(),self.regenerateAddressesDialogInstance.ui.checkBoxEighteenByteRipe.isChecked()))
streamNumberForAddress = int(
self.regenerateAddressesDialogInstance.ui.lineEditStreamNumber.text())
addressVersionNumber = int(
self.regenerateAddressesDialogInstance.ui.lineEditAddressVersionNumber.text())
# self.addressGenerator = addressGenerator()
# self.addressGenerator.setup(addressVersionNumber,streamNumberForAddress,"unused address",self.regenerateAddressesDialogInstance.ui.spinBoxNumberOfAddressesToMake.value(),self.regenerateAddressesDialogInstance.ui.lineEditPassphrase.text().toUtf8(),self.regenerateAddressesDialogInstance.ui.checkBoxEighteenByteRipe.isChecked())
# QtCore.QObject.connect(self.addressGenerator, SIGNAL("writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.writeNewAddressToTable)
# QtCore.QObject.connect(self.addressGenerator, QtCore.SIGNAL("updateStatusBar(PyQt_PyObject)"), self.updateStatusBar)
# self.addressGenerator.start()
shared.addressGeneratorQueue.put(('createDeterministicAddresses', addressVersionNumber, streamNumberForAddress, "regenerated deterministic address", self.regenerateAddressesDialogInstance.ui.spinBoxNumberOfAddressesToMake.value(
), self.regenerateAddressesDialogInstance.ui.lineEditPassphrase.text().toUtf8(), self.regenerateAddressesDialogInstance.ui.checkBoxEighteenByteRipe.isChecked()))
self.ui.tabWidget.setCurrentIndex(3)
def openKeysFile(self):
@ -828,9 +972,10 @@ class MyForm(QtGui.QMainWindow):
if 'win32' in sys.platform or 'win64' in sys.platform:
self.setWindowFlags(Qt.ToolTip)
elif event.oldState() & QtCore.Qt.WindowMinimized:
#The window state has just been changed to Normal/Maximised/FullScreen
# The window state has just been changed to
# Normal/Maximised/FullScreen
pass
#QtGui.QWidget.changeEvent(self, event)
# QtGui.QWidget.changeEvent(self, event)
def __icon_activated(self, reason):
if reason == QtGui.QSystemTrayIcon.Trigger:
@ -839,19 +984,22 @@ class MyForm(QtGui.QMainWindow):
def incrementNumberOfMessagesProcessed(self):
self.numberOfMessagesProcessed += 1
self.ui.labelMessageCount.setText(QtGui.QApplication.translate("MainWindow", "Processed %1 person-to-person messages.").arg(str(self.numberOfMessagesProcessed)))
self.ui.labelMessageCount.setText(QtGui.QApplication.translate(
"MainWindow", "Processed %1 person-to-person messages.").arg(str(self.numberOfMessagesProcessed)))
def incrementNumberOfBroadcastsProcessed(self):
self.numberOfBroadcastsProcessed += 1
self.ui.labelBroadcastCount.setText(QtGui.QApplication.translate("MainWindow", "Processed %1 broadcast messages.").arg(str(self.numberOfBroadcastsProcessed)))
self.ui.labelBroadcastCount.setText(QtGui.QApplication.translate(
"MainWindow", "Processed %1 broadcast messages.").arg(str(self.numberOfBroadcastsProcessed)))
def incrementNumberOfPubkeysProcessed(self):
self.numberOfPubkeysProcessed += 1
self.ui.labelPubkeyCount.setText(QtGui.QApplication.translate("MainWindow", "Processed %1 public keys.").arg(str(self.numberOfPubkeysProcessed)))
self.ui.labelPubkeyCount.setText(QtGui.QApplication.translate(
"MainWindow", "Processed %1 public keys.").arg(str(self.numberOfPubkeysProcessed)))
def updateNetworkStatusTab(self):
#print 'updating network status tab'
totalNumberOfConnectionsFromAllStreams = 0 #One would think we could use len(sendDataQueues) for this but the number doesn't always match: just because we have a sendDataThread running doesn't mean that the connection has been fully established (with the exchange of version messages).
# print 'updating network status tab'
totalNumberOfConnectionsFromAllStreams = 0 # One would think we could use len(sendDataQueues) for this but the number doesn't always match: just because we have a sendDataThread running doesn't mean that the connection has been fully established (with the exchange of version messages).
streamNumberTotals = {}
for host, streamNumber in shared.connectedHostsList.items():
if not streamNumber in streamNumberTotals:
@ -864,14 +1012,16 @@ class MyForm(QtGui.QMainWindow):
for streamNumber, connectionCount in streamNumberTotals.items():
self.ui.tableWidgetConnectionCount.insertRow(0)
if streamNumber == 0:
newItem = QtGui.QTableWidgetItem("?")
newItem = QtGui.QTableWidgetItem("?")
else:
newItem = QtGui.QTableWidgetItem(str(streamNumber))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetConnectionCount.setItem(0,0,newItem)
newItem = QtGui.QTableWidgetItem(str(connectionCount))
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetConnectionCount.setItem(0,1,newItem)
newItem = QtGui.QTableWidgetItem(str(streamNumber))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetConnectionCount.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(str(connectionCount))
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetConnectionCount.setItem(0, 1, newItem)
"""for currentRow in range(self.ui.tableWidgetConnectionCount.rowCount()):
rowStreamNumber = int(self.ui.tableWidgetConnectionCount.item(currentRow,0).text())
if streamNumber == rowStreamNumber:
@ -888,8 +1038,9 @@ class MyForm(QtGui.QMainWindow):
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
self.ui.tableWidgetConnectionCount.setItem(0,1,newItem)
totalNumberOfConnectionsFromAllStreams += connectionCount"""
self.ui.labelTotalConnections.setText(QtGui.QApplication.translate("MainWindow", "Total Connections: %1").arg(str(len(shared.connectedHostsList))))
if len(shared.connectedHostsList) > 0 and shared.statusIconColor == 'red': #FYI: The 'singlelistener' thread sets the icon color to green when it receives an incoming connection, meaning that the user's firewall is configured correctly.
self.ui.labelTotalConnections.setText(QtGui.QApplication.translate(
"MainWindow", "Total Connections: %1").arg(str(len(shared.connectedHostsList))))
if len(shared.connectedHostsList) > 0 and shared.statusIconColor == 'red': # FYI: The 'singlelistener' thread sets the icon color to green when it receives an incoming connection, meaning that the user's firewall is configured correctly.
self.setStatusIcon('yellow')
elif len(shared.connectedHostsList) == 0:
self.setStatusIcon('red')
@ -897,225 +1048,280 @@ class MyForm(QtGui.QMainWindow):
# Indicates whether or not there is a connection to the Bitmessage network
connected = False
def setStatusIcon(self,color):
def setStatusIcon(self, color):
global withMessagingMenu
#print 'setting status icon color'
# print 'setting status icon color'
if color == 'red':
self.ui.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/redicon.png"))
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('Bitmessage',QtGui.QApplication.translate("MainWindow", "Connection lost"))
self.notifierShow('Bitmessage', QtGui.QApplication.translate(
"MainWindow", "Connection lost"))
self.connected = False
if self.actionStatus != None:
self.actionStatus.setText(QtGui.QApplication.translate("MainWindow", "Not Connected"))
self.tray.setIcon(QtGui.QIcon(":/newPrefix/images/can-icon-24px-red.png"))
if self.actionStatus is not None:
self.actionStatus.setText(QtGui.QApplication.translate(
"MainWindow", "Not Connected"))
self.tray.setIcon(QtGui.QIcon(
":/newPrefix/images/can-icon-24px-red.png"))
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"))
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