V0.6 #852
|
@ -632,14 +632,6 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
# startup for linux
|
# startup for linux
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
self.totalNumberOfBytesReceived = 0
|
|
||||||
self.totalNumberOfBytesSent = 0
|
|
||||||
|
|
||||||
self.timer = QtCore.QTimer()
|
|
||||||
self.timer.start(2000) # milliseconds
|
|
||||||
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
|
|
||||||
|
|
||||||
# e.g. for editing labels
|
# e.g. for editing labels
|
||||||
self.recurDepth = 0
|
self.recurDepth = 0
|
||||||
|
|
||||||
|
@ -739,8 +731,6 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
QtCore.QObject.connect(self.pushButtonStatusIcon, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.pushButtonStatusIcon, QtCore.SIGNAL(
|
||||||
"clicked()"), self.click_pushButtonStatusIcon)
|
"clicked()"), self.click_pushButtonStatusIcon)
|
||||||
|
|
||||||
self.ui.labelStartupTime.setText(_translate("MainWindow", "Since startup on %1").arg(
|
|
||||||
l10n.formatTimestamp()))
|
|
||||||
self.numberOfMessagesProcessed = 0
|
self.numberOfMessagesProcessed = 0
|
||||||
self.numberOfBroadcastsProcessed = 0
|
self.numberOfBroadcastsProcessed = 0
|
||||||
self.numberOfPubkeysProcessed = 0
|
self.numberOfPubkeysProcessed = 0
|
||||||
|
@ -755,7 +745,7 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.ui.tableWidgetAddressBook.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.tableWidgetAddressBook.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
||||||
self.ui.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
self.ui.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size))
|
||||||
|
|
||||||
self.UISignalThread = UISignaler()
|
self.UISignalThread = UISignaler.get()
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
"writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.writeNewAddressToTable)
|
"writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.writeNewAddressToTable)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
|
@ -768,14 +758,6 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewInboxMessage)
|
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewInboxMessage)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
"displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), self.displayNewSentMessage)
|
"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(
|
|
||||||
"updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed)
|
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
|
||||||
"updateNumberOfPubkeysProcessed()"), self.updateNumberOfPubkeysProcessed)
|
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
|
||||||
"updateNumberOfBroadcastsProcessed()"), self.updateNumberOfBroadcastsProcessed)
|
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
"setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
|
"setStatusIcon(PyQt_PyObject)"), self.setStatusIcon)
|
||||||
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
|
@ -1719,21 +1701,6 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
self.actionShow.setChecked(not self.actionShow.isChecked())
|
self.actionShow.setChecked(not self.actionShow.isChecked())
|
||||||
self.appIndicatorShowOrHideWindow()
|
self.appIndicatorShowOrHideWindow()
|
||||||
|
|
||||||
def updateNumberOfMessagesProcessed(self):
|
|
||||||
self.ui.labelSyncStatus.setText(_translate("MainWindow", "Objects to be synced: %1").arg(str(sum(shared.numberOfObjectsThatWeHaveYetToGetPerPeer.itervalues()))))
|
|
||||||
self.ui.labelMessageCount.setText(_translate(
|
|
||||||
"MainWindow", "Processed %1 person-to-person messages.").arg(str(shared.numberOfMessagesProcessed)))
|
|
||||||
|
|
||||||
def updateNumberOfBroadcastsProcessed(self):
|
|
||||||
self.ui.labelSyncStatus.setText(_translate("MainWindow", "Objects to be synced: %1").arg(str(sum(shared.numberOfObjectsThatWeHaveYetToGetPerPeer.itervalues()))))
|
|
||||||
self.ui.labelBroadcastCount.setText(_translate(
|
|
||||||
"MainWindow", "Processed %1 broadcast messages.").arg(str(shared.numberOfBroadcastsProcessed)))
|
|
||||||
|
|
||||||
def updateNumberOfPubkeysProcessed(self):
|
|
||||||
self.ui.labelSyncStatus.setText(_translate("MainWindow", "Objects to be synced: %1").arg(str(sum(shared.numberOfObjectsThatWeHaveYetToGetPerPeer.itervalues()))))
|
|
||||||
self.ui.labelPubkeyCount.setText(_translate(
|
|
||||||
"MainWindow", "Processed %1 public keys.").arg(str(shared.numberOfPubkeysProcessed)))
|
|
||||||
|
|
||||||
def formatBytes(self, num):
|
def formatBytes(self, num):
|
||||||
for x in ['bytes','KB','MB','GB']:
|
for x in ['bytes','KB','MB','GB']:
|
||||||
if num < 1000.0:
|
if num < 1000.0:
|
||||||
|
@ -1745,74 +1712,6 @@ class MyForm(settingsmixin.SMainWindow):
|
||||||
num /= 1000
|
num /= 1000
|
||||||
return "%4.0f KB" % num
|
return "%4.0f KB" % num
|
||||||
|
|
||||||
def updateNumberOfBytes(self):
|
|
||||||
"""
|
|
||||||
This function is run every two seconds, so we divide the rate of bytes
|
|
||||||
sent and received by 2.
|
|
||||||
"""
|
|
||||||
self.ui.labelBytesRecvCount.setText(_translate(
|
|
||||||
"MainWindow", "Down: %1/s Total: %2").arg(self.formatByteRate(shared.numberOfBytesReceived/2), self.formatBytes(self.totalNumberOfBytesReceived)))
|
|
||||||
self.ui.labelBytesSentCount.setText(_translate(
|
|
||||||
"MainWindow", "Up: %1/s Total: %2").arg(self.formatByteRate(shared.numberOfBytesSent/2), self.formatBytes(self.totalNumberOfBytesSent)))
|
|
||||||
self.totalNumberOfBytesReceived += shared.numberOfBytesReceived
|
|
||||||
self.totalNumberOfBytesSent += shared.numberOfBytesSent
|
|
||||||
shared.numberOfBytesReceived = 0
|
|
||||||
shared.numberOfBytesSent = 0
|
|
||||||
|
|
||||||
def updateNetworkStatusTab(self):
|
|
||||||
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:
|
|
||||||
streamNumberTotals[streamNumber] = 1
|
|
||||||
else:
|
|
||||||
streamNumberTotals[streamNumber] += 1
|
|
||||||
|
|
||||||
while self.ui.tableWidgetConnectionCount.rowCount() > 0:
|
|
||||||
self.ui.tableWidgetConnectionCount.removeRow(0)
|
|
||||||
for streamNumber, connectionCount in streamNumberTotals.items():
|
|
||||||
self.ui.tableWidgetConnectionCount.insertRow(0)
|
|
||||||
if streamNumber == 0:
|
|
||||||
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)
|
|
||||||
"""for currentRow in range(self.ui.tableWidgetConnectionCount.rowCount()):
|
|
||||||
rowStreamNumber = int(self.ui.tableWidgetConnectionCount.item(currentRow,0).text())
|
|
||||||
if streamNumber == rowStreamNumber:
|
|
||||||
foundTheRowThatNeedsUpdating = True
|
|
||||||
self.ui.tableWidgetConnectionCount.item(currentRow,1).setText(str(connectionCount))
|
|
||||||
#totalNumberOfConnectionsFromAllStreams += connectionCount
|
|
||||||
if foundTheRowThatNeedsUpdating == False:
|
|
||||||
#Add a line to the table for this stream number and update its count with the current connection count.
|
|
||||||
self.ui.tableWidgetConnectionCount.insertRow(0)
|
|
||||||
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)
|
|
||||||
totalNumberOfConnectionsFromAllStreams += connectionCount"""
|
|
||||||
self.ui.labelTotalConnections.setText(_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')
|
|
||||||
|
|
||||||
# timer driven
|
|
||||||
def runEveryTwoSeconds(self):
|
|
||||||
self.ui.labelLookupsPerSecond.setText(_translate(
|
|
||||||
"MainWindow", "Inventory lookups per second: %1").arg(str(shared.numberOfInventoryLookupsPerformed/2)))
|
|
||||||
shared.numberOfInventoryLookupsPerformed = 0
|
|
||||||
self.updateNumberOfBytes()
|
|
||||||
|
|
||||||
# Indicates whether or not there is a connection to the Bitmessage network
|
# Indicates whether or not there is a connection to the Bitmessage network
|
||||||
connected = False
|
connected = False
|
||||||
|
|
||||||
|
@ -4631,70 +4530,7 @@ class myTableWidgetItem(QTableWidgetItem):
|
||||||
def __lt__(self, other):
|
def __lt__(self, other):
|
||||||
return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject())
|
return int(self.data(33).toPyObject()) < int(other.data(33).toPyObject())
|
||||||
|
|
||||||
class UISignaler(QThread):
|
from uisignaler import UISignaler
|
||||||
|
|
||||||
def __init__(self, parent=None):
|
|
||||||
QThread.__init__(self, parent)
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
while True:
|
|
||||||
command, data = shared.UISignalQueue.get()
|
|
||||||
if command == 'writeNewAddressToTable':
|
|
||||||
label, address, streamNumber = data
|
|
||||||
self.emit(SIGNAL(
|
|
||||||
"writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), label, address, str(streamNumber))
|
|
||||||
elif command == 'updateStatusBar':
|
|
||||||
self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"), data)
|
|
||||||
elif command == 'updateSentItemStatusByToAddress':
|
|
||||||
toAddress, message = data
|
|
||||||
self.emit(SIGNAL(
|
|
||||||
"updateSentItemStatusByToAddress(PyQt_PyObject,PyQt_PyObject)"), toAddress, message)
|
|
||||||
elif command == 'updateSentItemStatusByAckdata':
|
|
||||||
ackData, message = data
|
|
||||||
self.emit(SIGNAL(
|
|
||||||
"updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), ackData, message)
|
|
||||||
elif command == 'displayNewInboxMessage':
|
|
||||||
inventoryHash, toAddress, fromAddress, subject, body = data
|
|
||||||
self.emit(SIGNAL(
|
|
||||||
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"),
|
|
||||||
inventoryHash, toAddress, fromAddress, subject, body)
|
|
||||||
elif command == 'displayNewSentMessage':
|
|
||||||
toAddress, fromLabel, fromAddress, subject, message, ackdata = data
|
|
||||||
self.emit(SIGNAL(
|
|
||||||
"displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"),
|
|
||||||
toAddress, fromLabel, fromAddress, subject, message, ackdata)
|
|
||||||
elif command == 'updateNetworkStatusTab':
|
|
||||||
self.emit(SIGNAL("updateNetworkStatusTab()"))
|
|
||||||
elif command == 'updateNumberOfMessagesProcessed':
|
|
||||||
self.emit(SIGNAL("updateNumberOfMessagesProcessed()"))
|
|
||||||
elif command == 'updateNumberOfPubkeysProcessed':
|
|
||||||
self.emit(SIGNAL("updateNumberOfPubkeysProcessed()"))
|
|
||||||
elif command == 'updateNumberOfBroadcastsProcessed':
|
|
||||||
self.emit(SIGNAL("updateNumberOfBroadcastsProcessed()"))
|
|
||||||
elif command == 'setStatusIcon':
|
|
||||||
self.emit(SIGNAL("setStatusIcon(PyQt_PyObject)"), data)
|
|
||||||
elif command == 'changedInboxUnread':
|
|
||||||
self.emit(SIGNAL("changedInboxUnread(PyQt_PyObject)"), data)
|
|
||||||
elif command == 'rerenderMessagelistFromLabels':
|
|
||||||
self.emit(SIGNAL("rerenderMessagelistFromLabels()"))
|
|
||||||
elif command == 'rerenderMessagelistToLabels':
|
|
||||||
self.emit(SIGNAL("rerenderMessagelistToLabels()"))
|
|
||||||
elif command == 'rerenderAddressBook':
|
|
||||||
self.emit(SIGNAL("rerenderAddressBook()"))
|
|
||||||
elif command == 'rerenderSubscriptions':
|
|
||||||
self.emit(SIGNAL("rerenderSubscriptions()"))
|
|
||||||
elif command == 'rerenderBlackWhiteList':
|
|
||||||
self.emit(SIGNAL("rerenderBlackWhiteList()"))
|
|
||||||
elif command == 'removeInboxRowByMsgid':
|
|
||||||
self.emit(SIGNAL("removeInboxRowByMsgid(PyQt_PyObject)"), data)
|
|
||||||
elif command == 'newVersionAvailable':
|
|
||||||
self.emit(SIGNAL("newVersionAvailable(PyQt_PyObject)"), data)
|
|
||||||
elif command == 'alert':
|
|
||||||
title, text, exitAfterUserClicksOk = data
|
|
||||||
self.emit(SIGNAL("displayAlert(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"), title, text, exitAfterUserClicksOk)
|
|
||||||
else:
|
|
||||||
sys.stderr.write(
|
|
||||||
'Command sent to UISignaler not recognized: %s\n' % command)
|
|
||||||
|
|
||||||
|
|
||||||
app = None
|
app = None
|
||||||
|
|
|
@ -11,6 +11,7 @@ from PyQt4 import QtCore, QtGui
|
||||||
from messageview import MessageView
|
from messageview import MessageView
|
||||||
from messagecompose import MessageCompose
|
from messagecompose import MessageCompose
|
||||||
import settingsmixin
|
import settingsmixin
|
||||||
|
from networkstatus import NetworkStatus
|
||||||
|
|
||||||
try:
|
try:
|
||||||
_fromUtf8 = QtCore.QString.fromUtf8
|
_fromUtf8 = QtCore.QString.fromUtf8
|
||||||
|
@ -587,67 +588,8 @@ class Ui_MainWindow(object):
|
||||||
icon9 = QtGui.QIcon()
|
icon9 = QtGui.QIcon()
|
||||||
icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/blacklist.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/blacklist.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
||||||
self.tabWidget.addTab(self.blackwhitelist, icon9, _fromUtf8(""))
|
self.tabWidget.addTab(self.blackwhitelist, icon9, _fromUtf8(""))
|
||||||
self.networkstatus = QtGui.QWidget()
|
self.networkstatus = NetworkStatus()
|
||||||
self.networkstatus.setObjectName(_fromUtf8("networkstatus"))
|
self.tabWidget.addTab(self.networkstatus, QtGui.QIcon(":/newPrefix/images/networkstatus.png"), "")
|
||||||
self.tableWidgetConnectionCount = settingsmixin.STableWidget(self.networkstatus)
|
|
||||||
self.tableWidgetConnectionCount.setGeometry(QtCore.QRect(20, 70, 241, 241))
|
|
||||||
palette = QtGui.QPalette()
|
|
||||||
brush = QtGui.QBrush(QtGui.QColor(212, 208, 200))
|
|
||||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
|
||||||
palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Base, brush)
|
|
||||||
brush = QtGui.QBrush(QtGui.QColor(212, 208, 200))
|
|
||||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
|
||||||
palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Base, brush)
|
|
||||||
brush = QtGui.QBrush(QtGui.QColor(212, 208, 200))
|
|
||||||
brush.setStyle(QtCore.Qt.SolidPattern)
|
|
||||||
palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Base, brush)
|
|
||||||
self.tableWidgetConnectionCount.setPalette(palette)
|
|
||||||
self.tableWidgetConnectionCount.setFrameShape(QtGui.QFrame.Box)
|
|
||||||
self.tableWidgetConnectionCount.setFrameShadow(QtGui.QFrame.Plain)
|
|
||||||
self.tableWidgetConnectionCount.setProperty("showDropIndicator", False)
|
|
||||||
self.tableWidgetConnectionCount.setAlternatingRowColors(True)
|
|
||||||
self.tableWidgetConnectionCount.setSelectionMode(QtGui.QAbstractItemView.NoSelection)
|
|
||||||
self.tableWidgetConnectionCount.setObjectName(_fromUtf8("tableWidgetConnectionCount"))
|
|
||||||
self.tableWidgetConnectionCount.setColumnCount(2)
|
|
||||||
self.tableWidgetConnectionCount.setRowCount(0)
|
|
||||||
item = QtGui.QTableWidgetItem()
|
|
||||||
self.tableWidgetConnectionCount.setHorizontalHeaderItem(0, item)
|
|
||||||
item = QtGui.QTableWidgetItem()
|
|
||||||
self.tableWidgetConnectionCount.setHorizontalHeaderItem(1, item)
|
|
||||||
self.tableWidgetConnectionCount.horizontalHeader().setCascadingSectionResizes(True)
|
|
||||||
self.tableWidgetConnectionCount.horizontalHeader().setHighlightSections(False)
|
|
||||||
self.tableWidgetConnectionCount.horizontalHeader().setStretchLastSection(True)
|
|
||||||
self.tableWidgetConnectionCount.verticalHeader().setVisible(False)
|
|
||||||
self.labelTotalConnections = QtGui.QLabel(self.networkstatus)
|
|
||||||
self.labelTotalConnections.setGeometry(QtCore.QRect(20, 30, 401, 16))
|
|
||||||
self.labelTotalConnections.setObjectName(_fromUtf8("labelTotalConnections"))
|
|
||||||
self.labelStartupTime = QtGui.QLabel(self.networkstatus)
|
|
||||||
self.labelStartupTime.setGeometry(QtCore.QRect(320, 110, 331, 20))
|
|
||||||
self.labelStartupTime.setObjectName(_fromUtf8("labelStartupTime"))
|
|
||||||
self.labelMessageCount = QtGui.QLabel(self.networkstatus)
|
|
||||||
self.labelMessageCount.setGeometry(QtCore.QRect(350, 130, 361, 16))
|
|
||||||
self.labelMessageCount.setObjectName(_fromUtf8("labelMessageCount"))
|
|
||||||
self.labelPubkeyCount = QtGui.QLabel(self.networkstatus)
|
|
||||||
self.labelPubkeyCount.setGeometry(QtCore.QRect(350, 170, 331, 16))
|
|
||||||
self.labelPubkeyCount.setObjectName(_fromUtf8("labelPubkeyCount"))
|
|
||||||
self.labelBroadcastCount = QtGui.QLabel(self.networkstatus)
|
|
||||||
self.labelBroadcastCount.setGeometry(QtCore.QRect(350, 150, 351, 16))
|
|
||||||
self.labelBroadcastCount.setObjectName(_fromUtf8("labelBroadcastCount"))
|
|
||||||
self.labelSyncStatus = QtGui.QLabel(self.networkstatus)
|
|
||||||
self.labelSyncStatus.setGeometry(QtCore.QRect(350, 190, 331, 20))
|
|
||||||
self.labelSyncStatus.setObjectName(_fromUtf8("labelSyncStatus"))
|
|
||||||
self.labelLookupsPerSecond = QtGui.QLabel(self.networkstatus)
|
|
||||||
self.labelLookupsPerSecond.setGeometry(QtCore.QRect(320, 270, 291, 16))
|
|
||||||
self.labelLookupsPerSecond.setObjectName(_fromUtf8("labelLookupsPerSecond"))
|
|
||||||
self.labelBytesRecvCount = QtGui.QLabel(self.networkstatus)
|
|
||||||
self.labelBytesRecvCount.setGeometry(QtCore.QRect(350, 230, 251, 16))
|
|
||||||
self.labelBytesRecvCount.setObjectName(_fromUtf8("labelBytesRecvCount"))
|
|
||||||
self.labelBytesSentCount = QtGui.QLabel(self.networkstatus)
|
|
||||||
self.labelBytesSentCount.setGeometry(QtCore.QRect(350, 250, 251, 16))
|
|
||||||
self.labelBytesSentCount.setObjectName(_fromUtf8("labelBytesSentCount"))
|
|
||||||
icon11 = QtGui.QIcon()
|
|
||||||
icon11.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/networkstatus.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
|
|
||||||
self.tabWidget.addTab(self.networkstatus, icon11, _fromUtf8(""))
|
|
||||||
self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1)
|
self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1)
|
||||||
MainWindow.setCentralWidget(self.centralwidget)
|
MainWindow.setCentralWidget(self.centralwidget)
|
||||||
self.menubar = QtGui.QMenuBar(MainWindow)
|
self.menubar = QtGui.QMenuBar(MainWindow)
|
||||||
|
@ -730,7 +672,6 @@ class Ui_MainWindow(object):
|
||||||
MainWindow.setTabOrder(self.radioButtonBlacklist, self.radioButtonWhitelist)
|
MainWindow.setTabOrder(self.radioButtonBlacklist, self.radioButtonWhitelist)
|
||||||
MainWindow.setTabOrder(self.radioButtonWhitelist, self.pushButtonAddBlacklist)
|
MainWindow.setTabOrder(self.radioButtonWhitelist, self.pushButtonAddBlacklist)
|
||||||
MainWindow.setTabOrder(self.pushButtonAddBlacklist, self.tableWidgetBlacklist)
|
MainWindow.setTabOrder(self.pushButtonAddBlacklist, self.tableWidgetBlacklist)
|
||||||
MainWindow.setTabOrder(self.tableWidgetBlacklist, self.tableWidgetConnectionCount)
|
|
||||||
|
|
||||||
def retranslateUi(self, MainWindow):
|
def retranslateUi(self, MainWindow):
|
||||||
MainWindow.setWindowTitle(_translate("MainWindow", "Bitmessage", None))
|
MainWindow.setWindowTitle(_translate("MainWindow", "Bitmessage", None))
|
||||||
|
@ -825,19 +766,6 @@ class Ui_MainWindow(object):
|
||||||
item = self.tableWidgetBlacklist.horizontalHeaderItem(1)
|
item = self.tableWidgetBlacklist.horizontalHeaderItem(1)
|
||||||
item.setText(_translate("MainWindow", "Address", None))
|
item.setText(_translate("MainWindow", "Address", None))
|
||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.blackwhitelist), _translate("MainWindow", "Blacklist", None))
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.blackwhitelist), _translate("MainWindow", "Blacklist", None))
|
||||||
item = self.tableWidgetConnectionCount.horizontalHeaderItem(0)
|
|
||||||
item.setText(_translate("MainWindow", "Stream #", None))
|
|
||||||
item = self.tableWidgetConnectionCount.horizontalHeaderItem(1)
|
|
||||||
item.setText(_translate("MainWindow", "Connections", None))
|
|
||||||
self.labelTotalConnections.setText(_translate("MainWindow", "Total connections:", None))
|
|
||||||
self.labelStartupTime.setText(_translate("MainWindow", "Since startup:", None))
|
|
||||||
self.labelSyncStatus.setText(_translate("MainWindow", "Objects to be synced:", None))
|
|
||||||
self.labelMessageCount.setText(_translate("MainWindow", "Processed 0 person-to-person messages.", None))
|
|
||||||
self.labelPubkeyCount.setText(_translate("MainWindow", "Processed 0 public keys.", None))
|
|
||||||
self.labelBroadcastCount.setText(_translate("MainWindow", "Processed 0 broadcasts.", None))
|
|
||||||
self.labelLookupsPerSecond.setText(_translate("MainWindow", "Inventory lookups per second: 0", None))
|
|
||||||
self.labelBytesRecvCount.setText(_translate("MainWindow", "Down: 0 KB/s", None))
|
|
||||||
self.labelBytesSentCount.setText(_translate("MainWindow", "Up: 0 KB/s", None))
|
|
||||||
self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status", None))
|
self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status", None))
|
||||||
self.menuFile.setTitle(_translate("MainWindow", "File", None))
|
self.menuFile.setTitle(_translate("MainWindow", "File", None))
|
||||||
self.menuSettings.setTitle(_translate("MainWindow", "Settings", None))
|
self.menuSettings.setTitle(_translate("MainWindow", "Settings", None))
|
||||||
|
|
115
src/bitmessageqt/networkstatus.py
Normal file
115
src/bitmessageqt/networkstatus.py
Normal file
|
@ -0,0 +1,115 @@
|
||||||
|
from PyQt4 import QtCore, QtGui
|
||||||
|
import shared
|
||||||
|
from tr import _translate
|
||||||
|
import l10n
|
||||||
|
from uisignaler import UISignaler
|
||||||
|
import widgets
|
||||||
|
|
||||||
|
|
||||||
|
class NetworkStatus(QtGui.QWidget):
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
super(NetworkStatus, self).__init__(parent)
|
||||||
|
widgets.load('networkstatus.ui', self)
|
||||||
|
|
||||||
|
self.labelStartupTime.setText(_translate("MainWindow", "Since startup on %1").arg(
|
||||||
|
l10n.formatTimestamp()))
|
||||||
|
|
||||||
|
self.UISignalThread = UISignaler.get()
|
||||||
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
|
"updateNumberOfMessagesProcessed()"), self.updateNumberOfMessagesProcessed)
|
||||||
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
|
"updateNumberOfPubkeysProcessed()"), self.updateNumberOfPubkeysProcessed)
|
||||||
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
|
"updateNumberOfBroadcastsProcessed()"), self.updateNumberOfBroadcastsProcessed)
|
||||||
|
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
|
||||||
|
"updateNetworkStatusTab()"), self.updateNetworkStatusTab)
|
||||||
|
|
||||||
|
self.totalNumberOfBytesReceived = 0
|
||||||
|
self.totalNumberOfBytesSent = 0
|
||||||
|
|
||||||
|
self.timer = QtCore.QTimer()
|
||||||
|
self.timer.start(2000) # milliseconds
|
||||||
|
QtCore.QObject.connect(self.timer, QtCore.SIGNAL("timeout()"), self.runEveryTwoSeconds)
|
||||||
|
|
||||||
|
def updateNumberOfMessagesProcessed(self):
|
||||||
|
self.labelSyncStatus.setText(_translate("MainWindow", "Objects to be synced: %1").arg(str(sum(shared.numberOfObjectsThatWeHaveYetToGetPerPeer.itervalues()))))
|
||||||
|
self.labelMessageCount.setText(_translate(
|
||||||
|
"MainWindow", "Processed %1 person-to-person messages.").arg(str(shared.numberOfMessagesProcessed)))
|
||||||
|
|
||||||
|
def updateNumberOfBroadcastsProcessed(self):
|
||||||
|
self.labelSyncStatus.setText(_translate("MainWindow", "Objects to be synced: %1").arg(str(sum(shared.numberOfObjectsThatWeHaveYetToGetPerPeer.itervalues()))))
|
||||||
|
self.labelBroadcastCount.setText(_translate(
|
||||||
|
"MainWindow", "Processed %1 broadcast messages.").arg(str(shared.numberOfBroadcastsProcessed)))
|
||||||
|
|
||||||
|
def updateNumberOfPubkeysProcessed(self):
|
||||||
|
self.labelSyncStatus.setText(_translate("MainWindow", "Objects to be synced: %1").arg(str(sum(shared.numberOfObjectsThatWeHaveYetToGetPerPeer.itervalues()))))
|
||||||
|
self.labelPubkeyCount.setText(_translate(
|
||||||
|
"MainWindow", "Processed %1 public keys.").arg(str(shared.numberOfPubkeysProcessed)))
|
||||||
|
|
||||||
|
def updateNumberOfBytes(self):
|
||||||
|
"""
|
||||||
|
This function is run every two seconds, so we divide the rate of bytes
|
||||||
|
sent and received by 2.
|
||||||
|
"""
|
||||||
|
self.labelBytesRecvCount.setText(_translate(
|
||||||
|
"MainWindow", "Down: %1/s Total: %2").arg(self.formatByteRate(shared.numberOfBytesReceived/2), self.formatBytes(self.totalNumberOfBytesReceived)))
|
||||||
|
self.labelBytesSentCount.setText(_translate(
|
||||||
|
"MainWindow", "Up: %1/s Total: %2").arg(self.formatByteRate(shared.numberOfBytesSent/2), self.formatBytes(self.totalNumberOfBytesSent)))
|
||||||
|
self.totalNumberOfBytesReceived += shared.numberOfBytesReceived
|
||||||
|
self.totalNumberOfBytesSent += shared.numberOfBytesSent
|
||||||
|
shared.numberOfBytesReceived = 0
|
||||||
|
shared.numberOfBytesSent = 0
|
||||||
|
|
||||||
|
def updateNetworkStatusTab(self):
|
||||||
|
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:
|
||||||
|
streamNumberTotals[streamNumber] = 1
|
||||||
|
else:
|
||||||
|
streamNumberTotals[streamNumber] += 1
|
||||||
|
|
||||||
|
while self.tableWidgetConnectionCount.rowCount() > 0:
|
||||||
|
self.tableWidgetConnectionCount.removeRow(0)
|
||||||
|
for streamNumber, connectionCount in streamNumberTotals.items():
|
||||||
|
self.tableWidgetConnectionCount.insertRow(0)
|
||||||
|
if streamNumber == 0:
|
||||||
|
newItem = QtGui.QTableWidgetItem("?")
|
||||||
|
else:
|
||||||
|
newItem = QtGui.QTableWidgetItem(str(streamNumber))
|
||||||
|
newItem.setFlags(
|
||||||
|
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidgetConnectionCount.setItem(0, 0, newItem)
|
||||||
|
newItem = QtGui.QTableWidgetItem(str(connectionCount))
|
||||||
|
newItem.setFlags(
|
||||||
|
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
|
||||||
|
self.tableWidgetConnectionCount.setItem(0, 1, newItem)
|
||||||
|
"""for currentRow in range(self.tableWidgetConnectionCount.rowCount()):
|
||||||
|
rowStreamNumber = int(self.tableWidgetConnectionCount.item(currentRow,0).text())
|
||||||
|
if streamNumber == rowStreamNumber:
|
||||||
|
foundTheRowThatNeedsUpdating = True
|
||||||
|
self.tableWidgetConnectionCount.item(currentRow,1).setText(str(connectionCount))
|
||||||
|
#totalNumberOfConnectionsFromAllStreams += connectionCount
|
||||||
|
if foundTheRowThatNeedsUpdating == False:
|
||||||
|
#Add a line to the table for this stream number and update its count with the current connection count.
|
||||||
|
self.tableWidgetConnectionCount.insertRow(0)
|
||||||
|
newItem = QtGui.QTableWidgetItem(str(streamNumber))
|
||||||
|
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
|
||||||
|
self.tableWidgetConnectionCount.setItem(0,0,newItem)
|
||||||
|
newItem = QtGui.QTableWidgetItem(str(connectionCount))
|
||||||
|
newItem.setFlags( QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled )
|
||||||
|
self.tableWidgetConnectionCount.setItem(0,1,newItem)
|
||||||
|
totalNumberOfConnectionsFromAllStreams += connectionCount"""
|
||||||
|
self.labelTotalConnections.setText(_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.window().setStatusIcon('yellow')
|
||||||
|
elif len(shared.connectedHostsList) == 0:
|
||||||
|
self.window().setStatusIcon('red')
|
||||||
|
|
||||||
|
# timer driven
|
||||||
|
def runEveryTwoSeconds(self):
|
||||||
|
self.labelLookupsPerSecond.setText(_translate(
|
||||||
|
"MainWindow", "Inventory lookups per second: %1").arg(str(shared.numberOfInventoryLookupsPerformed/2)))
|
||||||
|
shared.numberOfInventoryLookupsPerformed = 0
|
||||||
|
self.updateNumberOfBytes()
|
232
src/bitmessageqt/networkstatus.ui
Normal file
232
src/bitmessageqt/networkstatus.ui
Normal file
|
@ -0,0 +1,232 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>NetworkStatus</class>
|
||||||
|
<widget class="QWidget" name="NetworkStatus">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>731</width>
|
||||||
|
<height>493</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<widget class="QLabel" name="labelTotalConnections">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>30</y>
|
||||||
|
<width>401</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Total connections:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="labelStartupTime">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>320</x>
|
||||||
|
<y>110</y>
|
||||||
|
<width>331</width>
|
||||||
|
<height>20</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Since startup:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="labelMessageCount">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>130</y>
|
||||||
|
<width>361</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Processed 0 person-to-person messages.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="labelPubkeyCount">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>331</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Processed 0 public keys.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="labelBroadcastCount">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>150</y>
|
||||||
|
<width>351</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Processed 0 broadcasts.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="labelLookupsPerSecond">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>320</x>
|
||||||
|
<y>270</y>
|
||||||
|
<width>291</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Inventory lookups per second: 0</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="labelBytesRecvCount">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>220</y>
|
||||||
|
<width>251</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Down: 0 KB/s</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="labelBytesSentCount">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>240</y>
|
||||||
|
<width>251</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Up: 0 KB/s</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="labelSyncStatus">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>350</x>
|
||||||
|
<y>190</y>
|
||||||
|
<width>331</width>
|
||||||
|
<height>16</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Objects to be synced:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="verticalLayoutWidget">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>20</x>
|
||||||
|
<y>70</y>
|
||||||
|
<width>241</width>
|
||||||
|
<height>241</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="STableWidget" name="tableWidgetConnectionCount">
|
||||||
|
<property name="palette">
|
||||||
|
<palette>
|
||||||
|
<active>
|
||||||
|
<colorrole role="Base">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>212</red>
|
||||||
|
<green>208</green>
|
||||||
|
<blue>200</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</active>
|
||||||
|
<inactive>
|
||||||
|
<colorrole role="Base">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>212</red>
|
||||||
|
<green>208</green>
|
||||||
|
<blue>200</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</inactive>
|
||||||
|
<disabled>
|
||||||
|
<colorrole role="Base">
|
||||||
|
<brush brushstyle="SolidPattern">
|
||||||
|
<color alpha="255">
|
||||||
|
<red>212</red>
|
||||||
|
<green>208</green>
|
||||||
|
<blue>200</blue>
|
||||||
|
</color>
|
||||||
|
</brush>
|
||||||
|
</colorrole>
|
||||||
|
</disabled>
|
||||||
|
</palette>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::Box</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Plain</enum>
|
||||||
|
</property>
|
||||||
|
<property name="showDropIndicator" stdset="0">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="alternatingRowColors">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="selectionMode">
|
||||||
|
<enum>QAbstractItemView::NoSelection</enum>
|
||||||
|
</property>
|
||||||
|
<attribute name="horizontalHeaderCascadingSectionResizes">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderHighlightSections">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="horizontalHeaderStretchLastSection">
|
||||||
|
<bool>true</bool>
|
||||||
|
</attribute>
|
||||||
|
<attribute name="verticalHeaderVisible">
|
||||||
|
<bool>false</bool>
|
||||||
|
</attribute>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Stream #</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
<column>
|
||||||
|
<property name="text">
|
||||||
|
<string>Connections</string>
|
||||||
|
</property>
|
||||||
|
</column>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>STableWidget</class>
|
||||||
|
<extends>QTableWidget</extends>
|
||||||
|
<header>bitmessageqt/settingsmixin.h</header>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources>
|
||||||
|
<include location="bitmessage_icons.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
77
src/bitmessageqt/uisignaler.py
Normal file
77
src/bitmessageqt/uisignaler.py
Normal file
|
@ -0,0 +1,77 @@
|
||||||
|
|
||||||
|
from PyQt4.QtCore import QThread, SIGNAL
|
||||||
|
import shared
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
class UISignaler(QThread):
|
||||||
|
_instance = None
|
||||||
|
|
||||||
|
def __init__(self, parent=None):
|
||||||
|
QThread.__init__(self, parent)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def get(cls):
|
||||||
|
if not cls._instance:
|
||||||
|
cls._instance = UISignaler()
|
||||||
|
return cls._instance
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
while True:
|
||||||
|
command, data = shared.UISignalQueue.get()
|
||||||
|
if command == 'writeNewAddressToTable':
|
||||||
|
label, address, streamNumber = data
|
||||||
|
self.emit(SIGNAL(
|
||||||
|
"writeNewAddressToTable(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"), label, address, str(streamNumber))
|
||||||
|
elif command == 'updateStatusBar':
|
||||||
|
self.emit(SIGNAL("updateStatusBar(PyQt_PyObject)"), data)
|
||||||
|
elif command == 'updateSentItemStatusByToAddress':
|
||||||
|
toAddress, message = data
|
||||||
|
self.emit(SIGNAL(
|
||||||
|
"updateSentItemStatusByToAddress(PyQt_PyObject,PyQt_PyObject)"), toAddress, message)
|
||||||
|
elif command == 'updateSentItemStatusByAckdata':
|
||||||
|
ackData, message = data
|
||||||
|
self.emit(SIGNAL(
|
||||||
|
"updateSentItemStatusByAckdata(PyQt_PyObject,PyQt_PyObject)"), ackData, message)
|
||||||
|
elif command == 'displayNewInboxMessage':
|
||||||
|
inventoryHash, toAddress, fromAddress, subject, body = data
|
||||||
|
self.emit(SIGNAL(
|
||||||
|
"displayNewInboxMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"),
|
||||||
|
inventoryHash, toAddress, fromAddress, subject, body)
|
||||||
|
elif command == 'displayNewSentMessage':
|
||||||
|
toAddress, fromLabel, fromAddress, subject, message, ackdata = data
|
||||||
|
self.emit(SIGNAL(
|
||||||
|
"displayNewSentMessage(PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject,PyQt_PyObject)"),
|
||||||
|
toAddress, fromLabel, fromAddress, subject, message, ackdata)
|
||||||
|
elif command == 'updateNetworkStatusTab':
|
||||||
|
self.emit(SIGNAL("updateNetworkStatusTab()"))
|
||||||
|
elif command == 'updateNumberOfMessagesProcessed':
|
||||||
|
self.emit(SIGNAL("updateNumberOfMessagesProcessed()"))
|
||||||
|
elif command == 'updateNumberOfPubkeysProcessed':
|
||||||
|
self.emit(SIGNAL("updateNumberOfPubkeysProcessed()"))
|
||||||
|
elif command == 'updateNumberOfBroadcastsProcessed':
|
||||||
|
self.emit(SIGNAL("updateNumberOfBroadcastsProcessed()"))
|
||||||
|
elif command == 'setStatusIcon':
|
||||||
|
self.emit(SIGNAL("setStatusIcon(PyQt_PyObject)"), data)
|
||||||
|
elif command == 'changedInboxUnread':
|
||||||
|
self.emit(SIGNAL("changedInboxUnread(PyQt_PyObject)"), data)
|
||||||
|
elif command == 'rerenderMessagelistFromLabels':
|
||||||
|
self.emit(SIGNAL("rerenderMessagelistFromLabels()"))
|
||||||
|
elif command == 'rerenderMessagelistToLabels':
|
||||||
|
self.emit(SIGNAL("rerenderMessagelistToLabels()"))
|
||||||
|
elif command == 'rerenderAddressBook':
|
||||||
|
self.emit(SIGNAL("rerenderAddressBook()"))
|
||||||
|
elif command == 'rerenderSubscriptions':
|
||||||
|
self.emit(SIGNAL("rerenderSubscriptions()"))
|
||||||
|
elif command == 'rerenderBlackWhiteList':
|
||||||
|
self.emit(SIGNAL("rerenderBlackWhiteList()"))
|
||||||
|
elif command == 'removeInboxRowByMsgid':
|
||||||
|
self.emit(SIGNAL("removeInboxRowByMsgid(PyQt_PyObject)"), data)
|
||||||
|
elif command == 'newVersionAvailable':
|
||||||
|
self.emit(SIGNAL("newVersionAvailable(PyQt_PyObject)"), data)
|
||||||
|
elif command == 'alert':
|
||||||
|
title, text, exitAfterUserClicksOk = data
|
||||||
|
self.emit(SIGNAL("displayAlert(PyQt_PyObject, PyQt_PyObject, PyQt_PyObject)"), title, text, exitAfterUserClicksOk)
|
||||||
|
else:
|
||||||
|
sys.stderr.write(
|
||||||
|
'Command sent to UISignaler not recognized: %s\n' % command)
|
14
src/bitmessageqt/widgets.py
Normal file
14
src/bitmessageqt/widgets.py
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
from PyQt4 import uic
|
||||||
|
import os.path
|
||||||
|
import sys
|
||||||
|
|
||||||
|
|
||||||
|
def resource_path(path):
|
||||||
|
try:
|
||||||
|
return os.path.join(sys._MEIPASS, path)
|
||||||
|
except:
|
||||||
|
return os.path.join(os.path.dirname(__file__), path)
|
||||||
|
|
||||||
|
|
||||||
|
def load(path, widget):
|
||||||
|
uic.loadUi(resource_path(path), widget)
|
Reference in New Issue
Block a user