Refactor Blacklist tab

This commit is contained in:
mirrorwish 2016-03-17 22:09:46 +01:00 committed by Peter Surda
parent 337cf93b4b
commit 7800272d3a
6 changed files with 407 additions and 312 deletions

View File

@ -31,7 +31,6 @@ from newaddresswizard import *
from messageview import MessageView from messageview import MessageView
from migrationwizard import * from migrationwizard import *
from foldertree import * from foldertree import *
from addaddressdialog import *
from newsubscriptiondialog import * from newsubscriptiondialog import *
from regenerateaddresses import * from regenerateaddresses import *
from newchandialog import * from newchandialog import *
@ -67,6 +66,7 @@ import types
from utils import * from utils import *
from collections import OrderedDict from collections import OrderedDict
from account import * from account import *
from dialogs import AddAddressDialog
def _translate(context, text): def _translate(context, text):
return QtGui.QApplication.translate(context, text) return QtGui.QApplication.translate(context, text)
@ -140,18 +140,12 @@ class MyForm(settingsmixin.SMainWindow):
"clicked()"), self.click_pushButtonAddAddressBook) "clicked()"), self.click_pushButtonAddAddressBook)
QtCore.QObject.connect(self.ui.pushButtonAddSubscription, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.pushButtonAddSubscription, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonAddSubscription) "clicked()"), self.click_pushButtonAddSubscription)
QtCore.QObject.connect(self.ui.pushButtonAddBlacklist, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonAddBlacklist)
QtCore.QObject.connect(self.ui.pushButtonTTL, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.pushButtonTTL, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonTTL) "clicked()"), self.click_pushButtonTTL)
QtCore.QObject.connect(self.ui.pushButtonSend, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.pushButtonSend, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonSend) "clicked()"), self.click_pushButtonSend)
QtCore.QObject.connect(self.ui.pushButtonFetchNamecoinID, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.pushButtonFetchNamecoinID, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonFetchNamecoinID) "clicked()"), self.click_pushButtonFetchNamecoinID)
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.actionSettings, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.actionSettings, QtCore.SIGNAL(
"triggered()"), self.click_actionSettings) "triggered()"), self.click_actionSettings)
QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.actionAbout, QtCore.SIGNAL(
@ -365,46 +359,6 @@ class MyForm(settingsmixin.SMainWindow):
# self.popMenuSent.addAction( self.actionSentClipboard ) # self.popMenuSent.addAction( self.actionSentClipboard )
# self.popMenuSent.addAction( self.actionTrashSentMessage ) # self.popMenuSent.addAction( self.actionTrashSentMessage )
def init_blacklist_popup_menu(self, connectSignal=True):
# Popup menu for the Blacklist page
self.ui.blacklistContextMenuToolbar = QtGui.QToolBar()
# Actions
self.actionBlacklistNew = self.ui.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Add new entry"), self.on_action_BlacklistNew)
self.actionBlacklistDelete = self.ui.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Delete"), self.on_action_BlacklistDelete)
self.actionBlacklistClipboard = self.ui.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Copy address to clipboard"),
self.on_action_BlacklistClipboard)
self.actionBlacklistEnable = self.ui.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Enable"), self.on_action_BlacklistEnable)
self.actionBlacklistDisable = self.ui.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Disable"), self.on_action_BlacklistDisable)
self.actionBlacklistSetAvatar = self.ui.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Set avatar..."),
self.on_action_BlacklistSetAvatar)
self.ui.tableWidgetBlacklist.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
if connectSignal:
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.addSeparator()
self.popMenuBlacklist.addAction(self.actionBlacklistEnable)
self.popMenuBlacklist.addAction(self.actionBlacklistDisable)
self.popMenuBlacklist.addAction(self.actionBlacklistSetAvatar)
def rerenderTabTreeSubscriptions(self): def rerenderTabTreeSubscriptions(self):
treeWidget = self.ui.treeWidgetSubscriptions treeWidget = self.ui.treeWidgetSubscriptions
folders = Ui_FolderWidget.folderWeight.keys() folders = Ui_FolderWidget.folderWeight.keys()
@ -645,7 +599,6 @@ class MyForm(settingsmixin.SMainWindow):
self.init_subscriptions_popup_menu() self.init_subscriptions_popup_menu()
self.init_chan_popup_menu() self.init_chan_popup_menu()
self.init_sent_popup_menu() self.init_sent_popup_menu()
self.init_blacklist_popup_menu()
# Initialize the user's list of addresses on the 'Chan' tab. # Initialize the user's list of addresses on the 'Chan' tab.
self.rerenderTabTreeChans() self.rerenderTabTreeChans()
@ -683,12 +636,6 @@ class MyForm(settingsmixin.SMainWindow):
QtCore.QObject.connect(self.ui.inboxSearchLineEditChans, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.inboxSearchLineEditChans, QtCore.SIGNAL(
"textChanged(QString)"), self.inboxSearchLineEditUpdated) "textChanged(QString)"), self.inboxSearchLineEditUpdated)
# Initialize the Blacklist or Whitelist
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'white':
self.ui.tabWidget.setTabText(6, 'Whitelist')
self.ui.radioButtonWhitelist.click()
self.rerenderBlackWhiteList()
# Initialize addressbook # Initialize addressbook
QtCore.QObject.connect(self.ui.tableWidgetAddressBook, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.tableWidgetAddressBook, QtCore.SIGNAL(
"itemChanged(QTableWidgetItem *)"), self.tableWidgetAddressBookItemChanged) "itemChanged(QTableWidgetItem *)"), self.tableWidgetAddressBookItemChanged)
@ -715,10 +662,6 @@ class MyForm(settingsmixin.SMainWindow):
QtCore.QObject.connect(self.ui.treeWidgetChans, QtCore.SIGNAL( QtCore.QObject.connect(self.ui.treeWidgetChans, QtCore.SIGNAL(
"itemChanged (QTreeWidgetItem *, int)"), self.treeWidgetItemChanged) "itemChanged (QTreeWidgetItem *, int)"), self.treeWidgetItemChanged)
# Initialize blacklist
QtCore.QObject.connect(self.ui.tableWidgetBlacklist, QtCore.SIGNAL(
"itemChanged(QTableWidgetItem *)"), self.tableWidgetBlacklistItemChanged)
# Put the colored icon on the status bar # Put the colored icon on the status bar
# self.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png")) # self.pushButtonStatusIcon.setIcon(QIcon(":/newPrefix/images/yellowicon.png"))
self.statusbar = self.statusBar() self.statusbar = self.statusBar()
@ -743,7 +686,6 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.treeWidgetYourIdentities.setIconSize(QtCore.QSize(identicon_size, identicon_size)) self.ui.treeWidgetYourIdentities.setIconSize(QtCore.QSize(identicon_size, identicon_size))
self.ui.treeWidgetSubscriptions.setIconSize(QtCore.QSize(identicon_size, identicon_size)) self.ui.treeWidgetSubscriptions.setIconSize(QtCore.QSize(identicon_size, identicon_size))
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.UISignalThread = UISignaler.get() self.UISignalThread = UISignaler.get()
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
@ -770,8 +712,6 @@ class MyForm(settingsmixin.SMainWindow):
"rerenderAddressBook()"), self.rerenderAddressBook) "rerenderAddressBook()"), self.rerenderAddressBook)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"rerenderSubscriptions()"), self.rerenderSubscriptions) "rerenderSubscriptions()"), self.rerenderSubscriptions)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"rerenderBlackWhiteList()"), self.rerenderBlackWhiteList)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"removeInboxRowByMsgid(PyQt_PyObject)"), self.removeInboxRowByMsgid) "removeInboxRowByMsgid(PyQt_PyObject)"), self.removeInboxRowByMsgid)
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL( QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
@ -1684,7 +1624,7 @@ class MyForm(settingsmixin.SMainWindow):
self.init_addressbook_popup_menu(False) self.init_addressbook_popup_menu(False)
self.init_subscriptions_popup_menu(False) self.init_subscriptions_popup_menu(False)
self.init_sent_popup_menu(False) self.init_sent_popup_menu(False)
self.init_blacklist_popup_menu(False) self.ui.blackwhitelist.init_blacklist_popup_menu(False)
if event.type() == QtCore.QEvent.WindowStateChange: if event.type() == QtCore.QEvent.WindowStateChange:
if self.windowState() & QtCore.Qt.WindowMinimized: if self.windowState() & QtCore.Qt.WindowMinimized:
if shared.config.getboolean('bitmessagesettings', 'minimizetotray') and not 'darwin' in sys.platform: if shared.config.getboolean('bitmessagesettings', 'minimizetotray') and not 'darwin' in sys.platform:
@ -1968,29 +1908,6 @@ class MyForm(settingsmixin.SMainWindow):
def rerenderSubscriptions(self): def rerenderSubscriptions(self):
self.rerenderTabTreeSubscriptions() self.rerenderTabTreeSubscriptions()
def rerenderBlackWhiteList(self):
self.ui.tableWidgetBlacklist.setRowCount(0)
listType = shared.config.get('bitmessagesettings', 'blackwhitelist')
if listType == 'black':
queryreturn = sqlQuery('''SELECT label, address, enabled FROM blacklist''')
else:
queryreturn = sqlQuery('''SELECT label, address, enabled FROM whitelist''')
self.ui.tableWidgetBlacklist.setSortingEnabled(False)
for row in queryreturn:
label, address, enabled = row
self.ui.tableWidgetBlacklist.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(label, 'utf-8'))
if not enabled:
newItem.setTextColor(QtGui.QColor(128, 128, 128))
newItem.setIcon(avatarize(address))
self.ui.tableWidgetBlacklist.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not enabled:
newItem.setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetBlacklist.setItem(0, 1, newItem)
self.ui.tableWidgetBlacklist.setSortingEnabled(True)
def click_pushButtonTTL(self): def click_pushButtonTTL(self):
QtGui.QMessageBox.information(self, 'Time To Live', _translate( QtGui.QMessageBox.information(self, 'Time To Live', _translate(
@ -2630,64 +2547,6 @@ class MyForm(settingsmixin.SMainWindow):
except: except:
pass pass
def click_radioButtonBlacklist(self):
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'white':
shared.config.set('bitmessagesettings', 'blackwhitelist', 'black')
shared.writeKeysFile()
# self.ui.tableWidgetBlacklist.clearContents()
self.ui.tableWidgetBlacklist.setRowCount(0)
self.rerenderBlackWhiteList()
self.ui.tabWidget.setTabText(6, 'Blacklist')
def click_radioButtonWhitelist(self):
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
shared.config.set('bitmessagesettings', 'blackwhitelist', 'white')
shared.writeKeysFile()
# self.ui.tableWidgetBlacklist.clearContents()
self.ui.tableWidgetBlacklist.setRowCount(0)
self.rerenderBlackWhiteList()
self.ui.tabWidget.setTabText(6, 'Whitelist')
def click_pushButtonAddBlacklist(self):
self.NewBlacklistDialogInstance = AddAddressDialog(self)
if self.NewBlacklistDialogInstance.exec_():
if self.NewBlacklistDialogInstance.ui.labelAddressCheck.text() == _translate("MainWindow", "Address is valid."):
address = addBMIfNotPresent(str(
self.NewBlacklistDialogInstance.ui.lineEditAddress.text()))
# First we must check to see if the address is already in the
# address book. The user cannot add it again or else it will
# cause problems when updating and deleting the entry.
t = (address,)
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sql = '''select * from blacklist where address=?'''
else:
sql = '''select * from whitelist where address=?'''
queryreturn = sqlQuery(sql,*t)
if queryreturn == []:
self.ui.tableWidgetBlacklist.setSortingEnabled(False)
self.ui.tableWidgetBlacklist.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(
self.NewBlacklistDialogInstance.ui.newAddressLabel.text().toUtf8(), 'utf-8'))
newItem.setIcon(avatarize(address))
self.ui.tableWidgetBlacklist.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.ui.tableWidgetBlacklist.setItem(0, 1, newItem)
self.ui.tableWidgetBlacklist.setSortingEnabled(True)
t = (str(self.NewBlacklistDialogInstance.ui.newAddressLabel.text().toUtf8()), address, True)
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sql = '''INSERT INTO blacklist VALUES (?,?,?)'''
else:
sql = '''INSERT INTO whitelist VALUES (?,?,?)'''
sqlExecute(sql, *t)
else:
self.statusBar().showMessage(_translate(
"MainWindow", "Error: You cannot add the same address to your list twice. Perhaps rename the existing one if you want."))
else:
self.statusBar().showMessage(_translate(
"MainWindow", "The address you entered was invalid. Ignoring it."))
def on_action_SpecialAddressBehaviorDialog(self): def on_action_SpecialAddressBehaviorDialog(self):
self.dialog = SpecialAddressBehaviorDialog(self) self.dialog = SpecialAddressBehaviorDialog(self)
# For Modal dialogs # For Modal dialogs
@ -3061,7 +2920,7 @@ class MyForm(settingsmixin.SMainWindow):
sqlExecute('''INSERT INTO blacklist VALUES (?,?, ?)''', sqlExecute('''INSERT INTO blacklist VALUES (?,?, ?)''',
label, label,
addressAtCurrentInboxRow, True) addressAtCurrentInboxRow, True)
self.rerenderBlackWhiteList() self.ui.blackwhitelist.rerenderBlackWhiteList()
self.statusBar().showMessage(_translate( self.statusBar().showMessage(_translate(
"MainWindow", "Entry added to the blacklist. Edit the label to your liking.")) "MainWindow", "Entry added to the blacklist. Edit the label to your liking."))
else: else:
@ -3368,69 +3227,6 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuSubscriptions.exec_( self.popMenuSubscriptions.exec_(
self.ui.treeWidgetSubscriptions.mapToGlobal(point)) self.ui.treeWidgetSubscriptions.mapToGlobal(point))
# Group of functions for the Blacklist dialog box
def on_action_BlacklistNew(self):
self.click_pushButtonAddBlacklist()
def on_action_BlacklistDelete(self):
currentRow = self.ui.tableWidgetBlacklist.currentRow()
labelAtCurrentRow = self.ui.tableWidgetBlacklist.item(
currentRow, 0).text().toUtf8()
addressAtCurrentRow = self.ui.tableWidgetBlacklist.item(
currentRow, 1).text()
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sqlExecute(
'''DELETE FROM blacklist WHERE label=? AND address=?''',
str(labelAtCurrentRow), str(addressAtCurrentRow))
else:
sqlExecute(
'''DELETE FROM whitelist WHERE label=? AND address=?''',
str(labelAtCurrentRow), str(addressAtCurrentRow))
self.ui.tableWidgetBlacklist.removeRow(currentRow)
def on_action_BlacklistClipboard(self):
currentRow = self.ui.tableWidgetBlacklist.currentRow()
addressAtCurrentRow = self.ui.tableWidgetBlacklist.item(
currentRow, 1).text()
clipboard = QtGui.QApplication.clipboard()
clipboard.setText(str(addressAtCurrentRow))
def on_context_menuBlacklist(self, point):
self.popMenuBlacklist.exec_(
self.ui.tableWidgetBlacklist.mapToGlobal(point))
def on_action_BlacklistEnable(self):
currentRow = self.ui.tableWidgetBlacklist.currentRow()
addressAtCurrentRow = self.ui.tableWidgetBlacklist.item(
currentRow, 1).text()
self.ui.tableWidgetBlacklist.item(
currentRow, 0).setTextColor(QApplication.palette().text().color())
self.ui.tableWidgetBlacklist.item(
currentRow, 1).setTextColor(QApplication.palette().text().color())
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sqlExecute(
'''UPDATE blacklist SET enabled=1 WHERE address=?''',
str(addressAtCurrentRow))
else:
sqlExecute(
'''UPDATE whitelist SET enabled=1 WHERE address=?''',
str(addressAtCurrentRow))
def on_action_BlacklistDisable(self):
currentRow = self.ui.tableWidgetBlacklist.currentRow()
addressAtCurrentRow = self.ui.tableWidgetBlacklist.item(
currentRow, 1).text()
self.ui.tableWidgetBlacklist.item(
currentRow, 0).setTextColor(QtGui.QColor(128, 128, 128))
self.ui.tableWidgetBlacklist.item(
currentRow, 1).setTextColor(QtGui.QColor(128, 128, 128))
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sqlExecute(
'''UPDATE blacklist SET enabled=0 WHERE address=?''', str(addressAtCurrentRow))
else:
sqlExecute(
'''UPDATE whitelist SET enabled=0 WHERE address=?''', str(addressAtCurrentRow))
def widgetConvert (self, widget): def widgetConvert (self, widget):
if widget == self.ui.tableWidgetInbox: if widget == self.ui.tableWidgetInbox:
return self.ui.treeWidgetYourIdentities return self.ui.treeWidgetYourIdentities
@ -3684,9 +3480,6 @@ class MyForm(settingsmixin.SMainWindow):
def on_action_AddressBookSetAvatar(self): def on_action_AddressBookSetAvatar(self):
self.on_action_SetAvatar(self.ui.tableWidgetAddressBook) self.on_action_SetAvatar(self.ui.tableWidgetAddressBook)
def on_action_BlacklistSetAvatar(self):
self.on_action_SetAvatar(self.ui.tableWidgetBlacklist)
def on_action_SetAvatar(self, thisTableWidget): def on_action_SetAvatar(self, thisTableWidget):
currentRow = thisTableWidget.currentRow() currentRow = thisTableWidget.currentRow()
addressAtCurrentRow = thisTableWidget.item( addressAtCurrentRow = thisTableWidget.item(
@ -3757,7 +3550,7 @@ class MyForm(settingsmixin.SMainWindow):
self.rerenderComboBoxSendFromBroadcast() self.rerenderComboBoxSendFromBroadcast()
self.rerenderMessagelistFromLabels() self.rerenderMessagelistFromLabels()
self.rerenderMessagelistToLabels() self.rerenderMessagelistToLabels()
self.rerenderBlackWhiteList() self.ui.blackwhitelist.rerenderBlackWhiteList()
# generate identicon # generate identicon
return False return False
@ -4001,17 +3794,6 @@ class MyForm(settingsmixin.SMainWindow):
self.rerenderComboBoxSendFrom() self.rerenderComboBoxSendFrom()
self.rerenderComboBoxSendFromBroadcast() self.rerenderComboBoxSendFromBroadcast()
def tableWidgetBlacklistItemChanged(self, item):
if item.column() == 0:
addressitem = self.ui.tableWidgetBlacklist.item(item.row(), 1)
if isinstance(addressitem, QTableWidgetItem):
if self.ui.radioButtonBlacklist.isChecked():
sqlExecute('''UPDATE blacklist SET label=? WHERE address=?''',
str(item.text()), str(addressitem.text()))
else:
sqlExecute('''UPDATE whitelist SET label=? WHERE address=?''',
str(item.text()), str(addressitem.text()))
def updateStatusBar(self, data): def updateStatusBar(self, data):
if data != "": if data != "":
logger.info('Status bar: ' + data) logger.info('Status bar: ' + data)
@ -4370,43 +4152,6 @@ class EmailGatewayRegistrationDialog(QtGui.QDialog):
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
class AddAddressDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_AddAddressDialog()
self.ui.setupUi(self)
self.parent = parent
QtCore.QObject.connect(self.ui.lineEditAddress, QtCore.SIGNAL(
"textChanged(QString)"), self.addressChanged)
def addressChanged(self, QString):
status, a, b, c = decodeAddress(str(QString))
if status == 'missingbm':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The address should start with ''BM-''"))
elif status == 'checksumfailed':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The address is not typed or copied correctly (the checksum failed)."))
elif status == 'versiontoohigh':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The version number of this address is higher than this software can support. Please upgrade Bitmessage."))
elif status == 'invalidcharacters':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The address contains invalid characters."))
elif status == 'ripetooshort':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is too short."))
elif status == 'ripetoolong':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is too long."))
elif status == 'varintmalformed':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is malformed."))
elif status == 'success':
self.ui.labelAddressCheck.setText(
_translate("MainWindow", "Address is valid."))
class NewSubscriptionDialog(QtGui.QDialog): class NewSubscriptionDialog(QtGui.QDialog):
def __init__(self, parent): def __init__(self, parent):

View File

@ -12,6 +12,8 @@ from messageview import MessageView
from messagecompose import MessageCompose from messagecompose import MessageCompose
import settingsmixin import settingsmixin
from networkstatus import NetworkStatus from networkstatus import NetworkStatus
from blacklist import Blacklist
import shared
try: try:
_fromUtf8 = QtCore.QString.fromUtf8 _fromUtf8 = QtCore.QString.fromUtf8
@ -551,43 +553,13 @@ class Ui_MainWindow(object):
icon8 = QtGui.QIcon() icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/can-icon-16px.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) icon8.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/can-icon-16px.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.tabWidget.addTab(self.chans, icon8, _fromUtf8("")) self.tabWidget.addTab(self.chans, icon8, _fromUtf8(""))
self.blackwhitelist = QtGui.QWidget() self.blackwhitelist = Blacklist()
self.blackwhitelist.setObjectName(_fromUtf8("blackwhitelist")) self.tabWidget.addTab(self.blackwhitelist, QtGui.QIcon(":/newPrefix/images/blacklist.png"), "")
self.gridLayout_6 = QtGui.QGridLayout(self.blackwhitelist) # Initialize the Blacklist or Whitelist
self.gridLayout_6.setObjectName(_fromUtf8("gridLayout_6")) if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'white':
self.radioButtonBlacklist = QtGui.QRadioButton(self.blackwhitelist) self.blackwhitelist.radioButtonWhitelist.click()
self.radioButtonBlacklist.setChecked(True) self.blackwhitelist.rerenderBlackWhiteList()
self.radioButtonBlacklist.setObjectName(_fromUtf8("radioButtonBlacklist"))
self.gridLayout_6.addWidget(self.radioButtonBlacklist, 0, 0, 1, 2)
self.radioButtonWhitelist = QtGui.QRadioButton(self.blackwhitelist)
self.radioButtonWhitelist.setObjectName(_fromUtf8("radioButtonWhitelist"))
self.gridLayout_6.addWidget(self.radioButtonWhitelist, 1, 0, 1, 2)
self.pushButtonAddBlacklist = QtGui.QPushButton(self.blackwhitelist)
self.pushButtonAddBlacklist.setObjectName(_fromUtf8("pushButtonAddBlacklist"))
self.gridLayout_6.addWidget(self.pushButtonAddBlacklist, 2, 0, 1, 1)
spacerItem = QtGui.QSpacerItem(689, 20, QtGui.QSizePolicy.Expanding, QtGui.QSizePolicy.Minimum)
self.gridLayout_6.addItem(spacerItem, 2, 1, 1, 1)
self.tableWidgetBlacklist = settingsmixin.STableWidget(self.blackwhitelist)
self.tableWidgetBlacklist.setAlternatingRowColors(True)
self.tableWidgetBlacklist.setSelectionMode(QtGui.QAbstractItemView.SingleSelection)
self.tableWidgetBlacklist.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows)
self.tableWidgetBlacklist.setObjectName(_fromUtf8("tableWidgetBlacklist"))
self.tableWidgetBlacklist.setColumnCount(2)
self.tableWidgetBlacklist.setRowCount(0)
item = QtGui.QTableWidgetItem()
self.tableWidgetBlacklist.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.tableWidgetBlacklist.setHorizontalHeaderItem(1, item)
self.tableWidgetBlacklist.horizontalHeader().setCascadingSectionResizes(True)
self.tableWidgetBlacklist.horizontalHeader().setDefaultSectionSize(400)
self.tableWidgetBlacklist.horizontalHeader().setHighlightSections(False)
self.tableWidgetBlacklist.horizontalHeader().setSortIndicatorShown(False)
self.tableWidgetBlacklist.horizontalHeader().setStretchLastSection(True)
self.tableWidgetBlacklist.verticalHeader().setVisible(False)
self.gridLayout_6.addWidget(self.tableWidgetBlacklist, 3, 0, 1, 2)
icon9 = QtGui.QIcon()
icon9.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/blacklist.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off)
self.tabWidget.addTab(self.blackwhitelist, icon9, _fromUtf8(""))
self.networkstatus = NetworkStatus() self.networkstatus = NetworkStatus()
self.tabWidget.addTab(self.networkstatus, QtGui.QIcon(":/newPrefix/images/networkstatus.png"), "") self.tabWidget.addTab(self.networkstatus, QtGui.QIcon(":/newPrefix/images/networkstatus.png"), "")
self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1) self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1)
@ -668,10 +640,6 @@ class Ui_MainWindow(object):
MainWindow.setTabOrder(self.lineEditTo, self.lineEditSubject) MainWindow.setTabOrder(self.lineEditTo, self.lineEditSubject)
MainWindow.setTabOrder(self.lineEditSubject, self.textEditMessage) MainWindow.setTabOrder(self.lineEditSubject, self.textEditMessage)
MainWindow.setTabOrder(self.textEditMessage, self.pushButtonAddSubscription) MainWindow.setTabOrder(self.textEditMessage, self.pushButtonAddSubscription)
MainWindow.setTabOrder(self.pushButtonAddSubscription, self.radioButtonBlacklist)
MainWindow.setTabOrder(self.radioButtonBlacklist, self.radioButtonWhitelist)
MainWindow.setTabOrder(self.radioButtonWhitelist, self.pushButtonAddBlacklist)
MainWindow.setTabOrder(self.pushButtonAddBlacklist, self.tableWidgetBlacklist)
def retranslateUi(self, MainWindow): def retranslateUi(self, MainWindow):
MainWindow.setWindowTitle(_translate("MainWindow", "Bitmessage", None)) MainWindow.setWindowTitle(_translate("MainWindow", "Bitmessage", None))
@ -757,15 +725,6 @@ class Ui_MainWindow(object):
item = self.tableWidgetInboxChans.horizontalHeaderItem(3) item = self.tableWidgetInboxChans.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Received", None)) item.setText(_translate("MainWindow", "Received", None))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.chans), _translate("MainWindow", "Chans", None)) self.tabWidget.setTabText(self.tabWidget.indexOf(self.chans), _translate("MainWindow", "Chans", None))
self.radioButtonBlacklist.setText(_translate("MainWindow", "Use a Blacklist (Allow all incoming messages except those on the Blacklist)", None))
self.radioButtonWhitelist.setText(_translate("MainWindow", "Use a Whitelist (Block all incoming messages except those on the Whitelist)", None))
self.pushButtonAddBlacklist.setText(_translate("MainWindow", "Add new entry", None))
self.tableWidgetBlacklist.setSortingEnabled(True)
item = self.tableWidgetBlacklist.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Name or Label", None))
item = self.tableWidgetBlacklist.horizontalHeaderItem(1)
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.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))

View File

@ -0,0 +1,241 @@
from PyQt4 import QtCore, QtGui
import shared
from tr import _translate
import l10n
from uisignaler import UISignaler
import widgets
from addresses import addBMIfNotPresent
from dialogs import AddAddressDialog
from helper_sql import sqlExecute, sqlQuery
from utils import avatarize
from uisignaler import UISignaler
class Blacklist(QtGui.QWidget):
def __init__(self, parent=None):
super(Blacklist, self).__init__(parent)
widgets.load('blacklist.ui', self)
QtCore.QObject.connect(self.radioButtonBlacklist, QtCore.SIGNAL(
"clicked()"), self.click_radioButtonBlacklist)
QtCore.QObject.connect(self.radioButtonWhitelist, QtCore.SIGNAL(
"clicked()"), self.click_radioButtonWhitelist)
QtCore.QObject.connect(self.pushButtonAddBlacklist, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonAddBlacklist)
self.init_blacklist_popup_menu()
# Initialize blacklist
QtCore.QObject.connect(self.tableWidgetBlacklist, QtCore.SIGNAL(
"itemChanged(QTableWidgetItem *)"), self.tableWidgetBlacklistItemChanged)
# Set the icon sizes for the identicons
identicon_size = 3*7
self.tableWidgetBlacklist.setIconSize(QtCore.QSize(identicon_size, identicon_size))
self.UISignalThread = UISignaler.get()
QtCore.QObject.connect(self.UISignalThread, QtCore.SIGNAL(
"rerenderBlackWhiteList()"), self.rerenderBlackWhiteList)
def click_radioButtonBlacklist(self):
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'white':
shared.config.set('bitmessagesettings', 'blackwhitelist', 'black')
shared.writeKeysFile()
# self.tableWidgetBlacklist.clearContents()
self.tableWidgetBlacklist.setRowCount(0)
self.rerenderBlackWhiteList()
def click_radioButtonWhitelist(self):
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
shared.config.set('bitmessagesettings', 'blackwhitelist', 'white')
shared.writeKeysFile()
# self.tableWidgetBlacklist.clearContents()
self.tableWidgetBlacklist.setRowCount(0)
self.rerenderBlackWhiteList()
def click_pushButtonAddBlacklist(self):
self.NewBlacklistDialogInstance = AddAddressDialog(self)
if self.NewBlacklistDialogInstance.exec_():
if self.NewBlacklistDialogInstance.ui.labelAddressCheck.text() == _translate("MainWindow", "Address is valid."):
address = addBMIfNotPresent(str(
self.NewBlacklistDialogInstance.ui.lineEditAddress.text()))
# First we must check to see if the address is already in the
# address book. The user cannot add it again or else it will
# cause problems when updating and deleting the entry.
t = (address,)
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sql = '''select * from blacklist where address=?'''
else:
sql = '''select * from whitelist where address=?'''
queryreturn = sqlQuery(sql,*t)
if queryreturn == []:
self.tableWidgetBlacklist.setSortingEnabled(False)
self.tableWidgetBlacklist.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(
self.NewBlacklistDialogInstance.ui.newAddressLabel.text().toUtf8(), 'utf-8'))
newItem.setIcon(avatarize(address))
self.tableWidgetBlacklist.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
self.tableWidgetBlacklist.setItem(0, 1, newItem)
self.tableWidgetBlacklist.setSortingEnabled(True)
t = (str(self.NewBlacklistDialogInstance.ui.newAddressLabel.text().toUtf8()), address, True)
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sql = '''INSERT INTO blacklist VALUES (?,?,?)'''
else:
sql = '''INSERT INTO whitelist VALUES (?,?,?)'''
sqlExecute(sql, *t)
else:
self.statusBar().showMessage(_translate(
"MainWindow", "Error: You cannot add the same address to your list twice. Perhaps rename the existing one if you want."))
else:
self.statusBar().showMessage(_translate(
"MainWindow", "The address you entered was invalid. Ignoring it."))
def tableWidgetBlacklistItemChanged(self, item):
if item.column() == 0:
addressitem = self.tableWidgetBlacklist.item(item.row(), 1)
if isinstance(addressitem, QtGui.QTableWidgetItem):
if self.radioButtonBlacklist.isChecked():
sqlExecute('''UPDATE blacklist SET label=? WHERE address=?''',
str(item.text()), str(addressitem.text()))
else:
sqlExecute('''UPDATE whitelist SET label=? WHERE address=?''',
str(item.text()), str(addressitem.text()))
def init_blacklist_popup_menu(self, connectSignal=True):
# Popup menu for the Blacklist page
self.blacklistContextMenuToolbar = QtGui.QToolBar()
# Actions
self.actionBlacklistNew = self.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Add new entry"), self.on_action_BlacklistNew)
self.actionBlacklistDelete = self.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Delete"), self.on_action_BlacklistDelete)
self.actionBlacklistClipboard = self.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Copy address to clipboard"),
self.on_action_BlacklistClipboard)
self.actionBlacklistEnable = self.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Enable"), self.on_action_BlacklistEnable)
self.actionBlacklistDisable = self.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Disable"), self.on_action_BlacklistDisable)
self.actionBlacklistSetAvatar = self.blacklistContextMenuToolbar.addAction(
_translate(
"MainWindow", "Set avatar..."),
self.on_action_BlacklistSetAvatar)
self.tableWidgetBlacklist.setContextMenuPolicy(
QtCore.Qt.CustomContextMenu)
if connectSignal:
self.connect(self.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.addSeparator()
self.popMenuBlacklist.addAction(self.actionBlacklistEnable)
self.popMenuBlacklist.addAction(self.actionBlacklistDisable)
self.popMenuBlacklist.addAction(self.actionBlacklistSetAvatar)
def rerenderBlackWhiteList(self):
tabs = self.parent().parent()
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
tabs.setTabText(tabs.indexOf(self), _translate('blacklist', 'Blacklist'))
else:
tabs.setTabText(tabs.indexOf(self), _translate('blacklist', 'Whitelist'))
self.tableWidgetBlacklist.setRowCount(0)
listType = shared.config.get('bitmessagesettings', 'blackwhitelist')
if listType == 'black':
queryreturn = sqlQuery('''SELECT label, address, enabled FROM blacklist''')
else:
queryreturn = sqlQuery('''SELECT label, address, enabled FROM whitelist''')
self.tableWidgetBlacklist.setSortingEnabled(False)
for row in queryreturn:
label, address, enabled = row
self.tableWidgetBlacklist.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode(label, 'utf-8'))
if not enabled:
newItem.setTextColor(QtGui.QColor(128, 128, 128))
newItem.setIcon(avatarize(address))
self.tableWidgetBlacklist.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address)
newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled)
if not enabled:
newItem.setTextColor(QtGui.QColor(128, 128, 128))
self.tableWidgetBlacklist.setItem(0, 1, newItem)
self.tableWidgetBlacklist.setSortingEnabled(True)
# Group of functions for the Blacklist dialog box
def on_action_BlacklistNew(self):
self.click_pushButtonAddBlacklist()
def on_action_BlacklistDelete(self):
currentRow = self.tableWidgetBlacklist.currentRow()
labelAtCurrentRow = self.tableWidgetBlacklist.item(
currentRow, 0).text().toUtf8()
addressAtCurrentRow = self.tableWidgetBlacklist.item(
currentRow, 1).text()
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sqlExecute(
'''DELETE FROM blacklist WHERE label=? AND address=?''',
str(labelAtCurrentRow), str(addressAtCurrentRow))
else:
sqlExecute(
'''DELETE FROM whitelist WHERE label=? AND address=?''',
str(labelAtCurrentRow), str(addressAtCurrentRow))
self.tableWidgetBlacklist.removeRow(currentRow)
def on_action_BlacklistClipboard(self):
currentRow = self.tableWidgetBlacklist.currentRow()
addressAtCurrentRow = self.tableWidgetBlacklist.item(
currentRow, 1).text()
clipboard = QtGui.QApplication.clipboard()
clipboard.setText(str(addressAtCurrentRow))
def on_context_menuBlacklist(self, point):
self.popMenuBlacklist.exec_(
self.tableWidgetBlacklist.mapToGlobal(point))
def on_action_BlacklistEnable(self):
currentRow = self.tableWidgetBlacklist.currentRow()
addressAtCurrentRow = self.tableWidgetBlacklist.item(
currentRow, 1).text()
self.tableWidgetBlacklist.item(
currentRow, 0).setTextColor(QtGui.QApplication.palette().text().color())
self.tableWidgetBlacklist.item(
currentRow, 1).setTextColor(QtGui.QApplication.palette().text().color())
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sqlExecute(
'''UPDATE blacklist SET enabled=1 WHERE address=?''',
str(addressAtCurrentRow))
else:
sqlExecute(
'''UPDATE whitelist SET enabled=1 WHERE address=?''',
str(addressAtCurrentRow))
def on_action_BlacklistDisable(self):
currentRow = self.tableWidgetBlacklist.currentRow()
addressAtCurrentRow = self.tableWidgetBlacklist.item(
currentRow, 1).text()
self.tableWidgetBlacklist.item(
currentRow, 0).setTextColor(QtGui.QColor(128, 128, 128))
self.tableWidgetBlacklist.item(
currentRow, 1).setTextColor(QtGui.QColor(128, 128, 128))
if shared.config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sqlExecute(
'''UPDATE blacklist SET enabled=0 WHERE address=?''', str(addressAtCurrentRow))
else:
sqlExecute(
'''UPDATE whitelist SET enabled=0 WHERE address=?''', str(addressAtCurrentRow))
def on_action_BlacklistSetAvatar(self):
self.window().on_action_SetAvatar(self.tableWidgetBlacklist)

View File

@ -0,0 +1,108 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>blacklist</class>
<widget class="QWidget" name="blacklist">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>819</width>
<height>295</height>
</rect>
</property>
<layout class="QGridLayout" name="gridLayout_6">
<item row="0" column="0" colspan="2">
<widget class="QRadioButton" name="radioButtonBlacklist">
<property name="text">
<string>Use a Blacklist (Allow all incoming messages except those on the Blacklist)</string>
</property>
<property name="checked">
<bool>true</bool>
</property>
</widget>
</item>
<item row="1" column="0" colspan="2">
<widget class="QRadioButton" name="radioButtonWhitelist">
<property name="text">
<string>Use a Whitelist (Block all incoming messages except those on the Whitelist)</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QPushButton" name="pushButtonAddBlacklist">
<property name="text">
<string>Add new entry</string>
</property>
</widget>
</item>
<item row="2" column="1">
<spacer name="horizontalSpacer_8">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>689</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item row="3" column="0" colspan="2">
<widget class="STableWidget" name="tableWidgetBlacklist">
<property name="alternatingRowColors">
<bool>true</bool>
</property>
<property name="selectionMode">
<enum>QAbstractItemView::SingleSelection</enum>
</property>
<property name="selectionBehavior">
<enum>QAbstractItemView::SelectRows</enum>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
<attribute name="horizontalHeaderCascadingSectionResizes">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderDefaultSectionSize">
<number>400</number>
</attribute>
<attribute name="horizontalHeaderHighlightSections">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderShowSortIndicator" stdset="0">
<bool>false</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="verticalHeaderVisible">
<bool>false</bool>
</attribute>
<column>
<property name="text">
<string>Name or Label</string>
</property>
</column>
<column>
<property name="text">
<string>Address</string>
</property>
</column>
</widget>
</item>
</layout>
</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>

View File

@ -0,0 +1,42 @@
from PyQt4 import QtCore, QtGui
from addaddressdialog import Ui_AddAddressDialog
from addresses import decodeAddress
from tr import _translate
class AddAddressDialog(QtGui.QDialog):
def __init__(self, parent):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_AddAddressDialog()
self.ui.setupUi(self)
self.parent = parent
QtCore.QObject.connect(self.ui.lineEditAddress, QtCore.SIGNAL(
"textChanged(QString)"), self.addressChanged)
def addressChanged(self, QString):
status, a, b, c = decodeAddress(str(QString))
if status == 'missingbm':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The address should start with ''BM-''"))
elif status == 'checksumfailed':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The address is not typed or copied correctly (the checksum failed)."))
elif status == 'versiontoohigh':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The version number of this address is higher than this software can support. Please upgrade Bitmessage."))
elif status == 'invalidcharacters':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "The address contains invalid characters."))
elif status == 'ripetooshort':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is too short."))
elif status == 'ripetoolong':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is too long."))
elif status == 'varintmalformed':
self.ui.labelAddressCheck.setText(_translate(
"MainWindow", "Some data encoded in the address is malformed."))
elif status == 'success':
self.ui.labelAddressCheck.setText(
_translate("MainWindow", "Address is valid."))

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>NetworkStatus</class> <class>networkstatus</class>
<widget class="QWidget" name="NetworkStatus"> <widget class="QWidget" name="networkstatus">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>