diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py
index e9aabc1b..b7c19bfd 100644
--- a/src/bitmessageqt/__init__.py
+++ b/src/bitmessageqt/__init__.py
@@ -36,14 +36,14 @@ from .foldertree import (
MessageList_AddressWidget, MessageList_SubjectWidget,
Ui_AddressBookWidgetItemLabel, Ui_AddressBookWidgetItemAddress,
MessageList_TimeWidget)
-import bitmessageqt.settingsmixin
-import bitmessageqt.support
+import bitmessageqt.settingsmixin as settingsmixin
+import bitmessageqt.support as support
from helper_sql import sqlQuery, sqlExecute, sqlExecuteChunked, sqlStoredProcedure
import helper_addressbook
import helper_search
import l10n
from .utils import str_broadcast_subscribers, avatarize
-import bitmessageqt.dialogs
+import bitmessageqt.dialogs as dialogs
from network.stats import pendingDownload, pendingUpload
from .uisignaler import UISignaler
import paths
@@ -51,9 +51,9 @@ from proofofwork import getPowType
import queues
import shutdown
from .statusbar import BMStatusBar
-import bitmessageqt.sound
+import bitmessageqt.sound as sound
# This is needed for tray icon
-import bitmessageqt.bitmessage_icons_rc # noqa:F401 pylint: disable=unused-import
+import bitmessageqt.bitmessage_icons_rc as bitmessage_icons_rc # noqa:F401 pylint: disable=unused-import
import helper_sent
try:
@@ -99,12 +99,12 @@ class MyForm(settingsmixin.SMainWindow):
newlocale = l10n.getTranslationLanguage()
try:
if not self.qmytranslator.isEmpty():
- QtGui.QApplication.removeTranslator(self.qmytranslator)
+ QtWidgets.QApplication.removeTranslator(self.qmytranslator)
except:
pass
try:
if not self.qsystranslator.isEmpty():
- QtGui.QApplication.removeTranslator(self.qsystranslator)
+ QtWidgets.QApplication.removeTranslator(self.qsystranslator)
except:
pass
@@ -377,7 +377,7 @@ class MyForm(settingsmixin.SMainWindow):
self.actionSentReply = self.ui.sentContextMenuToolbar.addAction(
_translate("MainWindow", "Send update"),
self.on_action_SentReply)
- # self.popMenuSent = QtGui.QMenu( self )
+ # self.popMenuSent = QtWidgets.QMenu( self )
# self.popMenuSent.addAction( self.actionSentClipboard )
# self.popMenuSent.addAction( self.actionTrashSentMessage )
@@ -612,9 +612,9 @@ class MyForm(settingsmixin.SMainWindow):
"One of your addresses, {0}, is an old version 1 address. "
"Version 1 addresses are no longer supported. "
"May we delete it now?").format(addressInKeysFile)
- reply = QtGui.QMessageBox.question(
- self, 'Message', displayMsg, QtGui.QMessageBox.StandardButton.Yes, QtGui.QMessageBox.StandardButton.No)
- if reply == QtGui.QMessageBox.StandardButton.Yes:
+ reply = QtWidgets.QMessageBox.question(
+ self, 'Message', displayMsg, QtWidgets.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.No)
+ if reply == QtWidgets.QMessageBox.StandardButton.Yes:
config.remove_section(addressInKeysFile)
config.save()
@@ -997,7 +997,7 @@ class MyForm(settingsmixin.SMainWindow):
for i in range(root.childCount()):
addressItem = root.child(i)
if addressItem.type == AccountMixin.ALL:
- newCount = sum(totalUnread.itervalues())
+ newCount = sum(totalUnread.values())
self.drawTrayIcon(self.currentTrayIconFileName, newCount)
else:
try:
@@ -1005,7 +1005,7 @@ class MyForm(settingsmixin.SMainWindow):
broadcastsUnread
if addressItem.type == AccountMixin.SUBSCRIPTION
else normalUnread
- )[addressItem.address].itervalues())
+ )[addressItem.address].values())
except KeyError:
newCount = 0
if newCount != addressItem.unreadCount:
@@ -1108,11 +1108,11 @@ class MyForm(settingsmixin.SMainWindow):
items = [
MessageList_AddressWidget(
- toAddress, str(acct.toLabel, 'utf-8')),
+ toAddress, acct.toLabel),
MessageList_AddressWidget(
- fromAddress, str(acct.fromLabel, 'utf-8')),
+ fromAddress, acct.fromLabel),
MessageList_SubjectWidget(
- str(subject), str(acct.subject, 'utf-8', 'replace')),
+ subject, acct.subject),
MessageList_TimeWidget(
statusText, False, lastactiontime, ackdata)]
self.addMessageListItem(tableWidget, items)
@@ -1133,11 +1133,11 @@ class MyForm(settingsmixin.SMainWindow):
items = [
MessageList_AddressWidget(
- toAddress, str(acct.toLabel, 'utf-8'), not read),
+ toAddress, acct.toLabel, not read),
MessageList_AddressWidget(
- fromAddress, str(acct.fromLabel, 'utf-8'), not read),
+ fromAddress, acct.fromLabel, not read),
MessageList_SubjectWidget(
- str(subject), str(acct.subject, 'utf-8', 'replace'),
+ subject, acct.subject,
not read),
MessageList_TimeWidget(
l10n.formatTimestamp(received), not read, received, msgid)
@@ -1168,7 +1168,7 @@ class MyForm(settingsmixin.SMainWindow):
self.addMessageListItemSent(tableWidget, *row)
tableWidget.horizontalHeader().setSortIndicator(
- 3, QtCore.Qt.DescendingOrder)
+ 3, QtCore.Qt.SortOrder.DescendingOrder)
tableWidget.setSortingEnabled(True)
tableWidget.horizontalHeaderItem(3).setText(
_translate("MainWindow", "Sent"))
@@ -1211,7 +1211,7 @@ class MyForm(settingsmixin.SMainWindow):
msgid, received, read)
tableWidget.horizontalHeader().setSortIndicator(
- 3, QtCore.Qt.DescendingOrder)
+ 3, QtCore.Qt.SortOrder.DescendingOrder)
tableWidget.setSortingEnabled(True)
tableWidget.selectRow(0)
tableWidget.horizontalHeaderItem(3).setText(
@@ -1431,7 +1431,7 @@ class MyForm(settingsmixin.SMainWindow):
if event.key() == QtCore.Qt.Key_Delete:
self.on_action_AddressBookDelete()
else:
- return QtGui.QTableWidget.keyPressEvent(
+ return QtWidgets.QTableWidget.keyPressEvent(
self.ui.tableWidgetAddressBook, event)
# inbox / sent
@@ -1446,14 +1446,14 @@ class MyForm(settingsmixin.SMainWindow):
"""This method handles keypress events for all widgets on MyForm"""
messagelist = self.getCurrentMessagelist()
if event.key() == QtCore.Qt.Key_Delete:
- if isinstance(focus, (MessageView, QtGui.QTableWidget)):
+ if isinstance(focus, (MessageView, QtWidgets.QTableWidget)):
folder = self.getCurrentFolder()
if folder == "sent":
self.on_action_SentTrash()
else:
self.on_action_InboxTrash()
event.ignore()
- elif QtGui.QApplication.queryKeyboardModifiers() == QtCore.Qt.NoModifier:
+ elif QtWidgets.QApplication.queryKeyboardModifiers() == QtCore.Qt.NoModifier:
if event.key() == QtCore.Qt.Key_N:
currentRow = messagelist.currentRow()
if currentRow < messagelist.rowCount() - 1:
@@ -1492,20 +1492,20 @@ class MyForm(settingsmixin.SMainWindow):
return
if isinstance(focus, MessageView):
return MessageView.keyPressEvent(focus, event)
- if isinstance(focus, QtGui.QTableWidget):
- return QtGui.QTableWidget.keyPressEvent(focus, event)
- if isinstance(focus, QtGui.QTreeWidget):
- return QtGui.QTreeWidget.keyPressEvent(focus, event)
+ if isinstance(focus, QtWidgets.QTableWidget):
+ return QtWidgets.QTableWidget.keyPressEvent(focus, event)
+ if isinstance(focus, QtWidgets.QTreeWidget):
+ return QtWidgets.QTreeWidget.keyPressEvent(focus, event)
# menu button 'manage keys'
def click_actionManageKeys(self):
if 'darwin' in sys.platform or 'linux' in sys.platform:
if state.appdata == '':
- # reply = QtGui.QMessageBox.information(self, 'keys.dat?','You
+ # reply = QtWidgets.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.StandardButton.Ok)
- reply = QtGui.QMessageBox.information(
+ reply = QtWidgets.QMessageBox.information(
self,
'keys.dat?',
_translate(
@@ -1513,10 +1513,10 @@ class MyForm(settingsmixin.SMainWindow):
"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."
),
- QtGui.QMessageBox.StandardButton.Ok)
+ QtWidgets.QMessageBox.StandardButton.Ok)
else:
- QtGui.QMessageBox.information(
+ QtWidgets.QMessageBox.information(
self,
'keys.dat?',
_translate(
@@ -1525,10 +1525,10 @@ class MyForm(settingsmixin.SMainWindow):
"\n {0} \n"
"It is important that you back up this file."
).format(state.appdata),
- QtGui.QMessageBox.StandardButton.Ok)
+ QtWidgets.QMessageBox.StandardButton.Ok)
elif sys.platform == 'win32' or sys.platform == 'win64':
if state.appdata == '':
- reply = QtGui.QMessageBox.question(
+ reply = QtWidgets.QMessageBox.question(
self,
_translate("MainWindow", "Open keys.dat?"),
_translate(
@@ -1537,10 +1537,10 @@ class MyForm(settingsmixin.SMainWindow):
"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.StandardButton.Yes,
- QtGui.QMessageBox.StandardButton.No)
+ QtWidgets.QMessageBox.StandardButton.Yes,
+ QtWidgets.QMessageBox.StandardButton.No)
else:
- reply = QtGui.QMessageBox.question(
+ reply = QtWidgets.QMessageBox.question(
self,
_translate("MainWindow", "Open keys.dat?"),
_translate(
@@ -1548,18 +1548,18 @@ class MyForm(settingsmixin.SMainWindow):
"You may manage your keys by editing the keys.dat file stored in\n {0} \n"
"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.)").format(state.appdata),
- QtGui.QMessageBox.StandardButton.Yes, QtGui.QMessageBox.StandardButton.No)
- if reply == QtGui.QMessageBox.StandardButton.Yes:
+ QtWidgets.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.No)
+ if reply == QtWidgets.QMessageBox.StandardButton.Yes:
openKeysFile()
# menu button 'delete all treshed messages'
def click_actionDeleteAllTrashedMessages(self):
- if QtGui.QMessageBox.question(
+ if QtWidgets.QMessageBox.question(
self,
_translate("MainWindow", "Delete trash?"),
_translate("MainWindow", "Are you sure you want to delete all trashed messages?"),
- QtGui.QMessageBox.StandardButton.Yes,
- QtGui.QMessageBox.StandardButton.No) == QtGui.QMessageBox.StandardButton.No:
+ QtWidgets.QMessageBox.StandardButton.Yes,
+ QtWidgets.QMessageBox.StandardButton.No) == QtWidgets.QMessageBox.StandardButton.No:
return
sqlStoredProcedure('deleteandvacuume')
self.rerenderTabTreeMessages()
@@ -1584,9 +1584,9 @@ class MyForm(settingsmixin.SMainWindow):
# menu button 'regenerate deterministic addresses'
def click_actionRegenerateDeterministicAddresses(self):
dialog = dialogs.RegenerateAddressesDialog(self)
- if dialog.exec_():
+ if dialog.exec():
if dialog.lineEditPassphrase.text() == "":
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, _translate("MainWindow", "bad passphrase"),
_translate(
"MainWindow",
@@ -1599,7 +1599,7 @@ class MyForm(settingsmixin.SMainWindow):
addressVersionNumber = int(
dialog.lineEditAddressVersionNumber.text())
except:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self,
_translate("MainWindow", "Bad address version number"),
_translate(
@@ -1609,7 +1609,7 @@ class MyForm(settingsmixin.SMainWindow):
))
return
if addressVersionNumber < 3 or addressVersionNumber > 4:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self,
_translate("MainWindow", "Bad address version number"),
_translate(
@@ -1622,7 +1622,7 @@ class MyForm(settingsmixin.SMainWindow):
addressVersionNumber, streamNumberForAddress,
"regenerated deterministic address",
dialog.spinBoxNumberOfAddressesToMake.value(),
- dialog.lineEditPassphrase.text().toUtf8(),
+ dialog.lineEditPassphrase.text(),
dialog.checkBoxEighteenByteRipe.isChecked()
))
self.ui.tabWidget.setCurrentIndex(
@@ -1648,7 +1648,7 @@ class MyForm(settingsmixin.SMainWindow):
def showMigrationWizard(self, level):
self.migrationWizardInstance = Ui_MigrationWizard(["a"])
- if self.migrationWizardInstance.exec_():
+ if self.migrationWizardInstance.exec():
pass
else:
pass
@@ -1673,7 +1673,7 @@ class MyForm(settingsmixin.SMainWindow):
pass
def __icon_activated(self, reason):
- if reason == QtGui.QSystemTrayIcon.Trigger:
+ if reason == QtWidgets.QSystemTrayIcon.Trigger:
self.actionShow.setChecked(not self.actionShow.isChecked())
self.appIndicatorShowOrHideWindow()
@@ -1775,8 +1775,9 @@ class MyForm(settingsmixin.SMainWindow):
# draw text
painter = QtGui.QPainter()
painter.begin(pixmap)
- painter.setPen(
- QtGui.QPen(QtGui.QColor(255, 0, 0), QtCore.Qt.SolidPattern))
+ pen = QtGui.QPen(QtGui.QColor(255, 0, 0))
+ pen.setBrush(QtGui.QBrush(QtCore.Qt.BrushStyle.SolidPattern))
+ painter.setPen(pen)
painter.setFont(font)
painter.drawText(24-rect.right()-marginX, -rect.top()+marginY, txt)
painter.end()
@@ -1819,7 +1820,7 @@ class MyForm(settingsmixin.SMainWindow):
continue
for i in range(sent.rowCount()):
- rowAddress = sent.item(i, 0).data(QtCore.Qt.UserRole)
+ rowAddress = sent.item(i, 0).data(QtCore.Qt.ItemDataRole.UserRole)
if toAddress == rowAddress:
sent.item(i, 3).setToolTip(textToDisplay)
try:
@@ -1846,7 +1847,7 @@ class MyForm(settingsmixin.SMainWindow):
if self.getCurrentFolder(treeWidget) != "sent":
continue
for i in range(sent.rowCount()):
- toAddress = sent.item(i, 0).data(QtCore.Qt.UserRole)
+ toAddress = sent.item(i, 0).data(QtCore.Qt.ItemDataRole.UserRole)
tableAckdata = sent.item(i, 3).data()
status, addressVersionNumber, streamNumber, ripe = decodeAddress(
toAddress)
@@ -1897,7 +1898,7 @@ class MyForm(settingsmixin.SMainWindow):
def displayAlert(self, title, text, exitAfterUserClicksOk):
self.updateStatusBar(text)
- QtGui.QMessageBox.critical(self, title, text, QtGui.QMessageBox.StandardButton.Ok)
+ QtWidgets.QMessageBox.critical(self, title, text, QtWidgets.QMessageBox.StandardButton.Ok)
if exitAfterUserClicksOk:
os._exit(0)
@@ -1973,7 +1974,7 @@ class MyForm(settingsmixin.SMainWindow):
self.rerenderTabTreeSubscriptions()
def click_pushButtonTTL(self):
- QtGui.QMessageBox.information(
+ QtWidgets.QMessageBox.information(
self,
'Time To Live',
_translate(
@@ -1982,16 +1983,20 @@ class MyForm(settingsmixin.SMainWindow):
,it will resend the message automatically. The longer the Time-To-Live, the
more work your computer must do to send the message.
A Time-To-Live of four or five days is often appropriate."""),
- QtGui.QMessageBox.StandardButton.Ok)
+ QtWidgets.QMessageBox.StandardButton.Ok)
def click_pushButtonClear(self):
self.ui.lineEditSubject.setText("")
self.ui.lineEditTo.setText("")
- self.ui.textEditMessage.reset()
+ self.ui.textEditMessage.clear()
self.ui.comboBoxSendFrom.setCurrentIndex(0)
+ self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0)
+ self.ui.lineEditSubjectBroadcast.setText('')
+ self.ui.textEditMessageBroadcast.clear()
+
def click_pushButtonSend(self):
- encoding = 3 if QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ShiftModifier else 2
+ encoding = 3 if QtWidgets.QApplication.queryKeyboardModifiers() & QtCore.Qt.KeyboardModifier.ShiftModifier else 2
self.statusbar.clearMessage()
@@ -1999,22 +2004,20 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.tabWidgetSend.indexOf(self.ui.sendDirect):
# message to specific people
sendMessageToPeople = True
- fromAddress = str(self.ui.comboBoxSendFrom.itemData(
+ fromAddress = self.ui.comboBoxSendFrom.itemData(
self.ui.comboBoxSendFrom.currentIndex(),
- QtCore.Qt.UserRole).toString())
- toAddresses = str(self.ui.lineEditTo.text().toUtf8())
- subject = str(self.ui.lineEditSubject.text().toUtf8())
- message = str(
- self.ui.textEditMessage.document().toPlainText().toUtf8())
+ QtCore.Qt.ItemDataRole.UserRole)
+ toAddresses = self.ui.lineEditTo.text()
+ subject = self.ui.lineEditSubject.text()
+ message = self.ui.textEditMessage.document().toPlainText()
else:
# broadcast message
sendMessageToPeople = False
- fromAddress = str(self.ui.comboBoxSendFromBroadcast.itemData(
+ fromAddress = self.ui.comboBoxSendFromBroadcast.itemData(
self.ui.comboBoxSendFromBroadcast.currentIndex(),
- QtCore.Qt.UserRole).toString())
- subject = str(self.ui.lineEditSubjectBroadcast.text().toUtf8())
- message = str(
- self.ui.textEditMessageBroadcast.document().toPlainText().toUtf8())
+ QtCore.Qt.ItemDataRole.UserRole)
+ subject = self.ui.lineEditSubjectBroadcast.text()
+ message = self.ui.textEditMessageBroadcast.document().toPlainText()
"""
The whole network message must fit in 2^18 bytes.
Let's assume 500 bytes of overhead. If someone wants to get that
@@ -2023,7 +2026,7 @@ class MyForm(settingsmixin.SMainWindow):
users can send messages of any length.
"""
if len(message) > (2 ** 18 - 500):
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self, _translate("MainWindow", "Message too long"),
_translate(
"MainWindow",
@@ -2055,14 +2058,14 @@ class MyForm(settingsmixin.SMainWindow):
subject = acct.subject
toAddress = acct.toAddress
else:
- if QtGui.QMessageBox.question(
+ if QtWidgets.QMessageBox.question(
self,
"Sending an email?",
_translate(
"MainWindow",
"You are trying to send an email instead of a bitmessage. "
"This requires registering with a gateway. Attempt to register?"),
- QtGui.QMessageBox.StandardButton.Yes|QtGui.QMessageBox.StandardButton.No) != QtGui.QMessageBox.StandardButton.Yes:
+ QtWidgets.QMessageBox.StandardButton.Yes|QtWidgets.QMessageBox.StandardButton.No) != QtWidgets.QMessageBox.StandardButton.Yes:
continue
email = acct.getLabel()
if email[-14:] != "@mailchuck.com": # attempt register
@@ -2087,7 +2090,7 @@ class MyForm(settingsmixin.SMainWindow):
status, addressVersionNumber, streamNumber = decodeAddress(toAddress)[:3]
if status != 'success':
try:
- toAddress = str(toAddress, 'utf-8', 'ignore')
+ toAddress = toAddress
except:
pass
logger.error('Error: Could not decode recipient address ' + toAddress + ':' + status)
@@ -2159,7 +2162,7 @@ class MyForm(settingsmixin.SMainWindow):
toAddress = addBMIfNotPresent(toAddress)
if addressVersionNumber > 4 or addressVersionNumber <= 1:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self,
_translate("MainWindow", "Address version number"),
_translate(
@@ -2169,7 +2172,7 @@ class MyForm(settingsmixin.SMainWindow):
).format(toAddress, str(addressVersionNumber)))
continue
if streamNumber > 1 or streamNumber == 0:
- QtGui.QMessageBox.about(
+ QtWidgets.QMessageBox.about(
self,
_translate("MainWindow", "Stream number"),
_translate(
@@ -2240,7 +2243,7 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0)
self.ui.lineEditSubjectBroadcast.setText('')
- self.ui.textEditMessageBroadcast.reset()
+ self.ui.textEditMessageBroadcast.clear()
self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send)
)
@@ -2261,7 +2264,7 @@ class MyForm(settingsmixin.SMainWindow):
))
def click_pushButtonFetchNamecoinID(self):
- identities = str(self.ui.lineEditTo.text().toUtf8()).split(";")
+ identities = self.ui.lineEditTo.text().split(";")
err, addr = self.namecoin.query(identities[-1].strip())
if err is not None:
self.updateStatusBar(
@@ -2291,17 +2294,17 @@ class MyForm(settingsmixin.SMainWindow):
addressInKeysFile, 'enabled')
isMaillinglist = config.safeGetBoolean(addressInKeysFile, 'mailinglist')
if isEnabled and not isMaillinglist:
- label = str(config.get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip()
+ label = config.get(addressInKeysFile, 'label').strip()
if label == "":
label = addressInKeysFile
self.ui.comboBoxSendFrom.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
# self.ui.comboBoxSendFrom.model().sort(1, QtCore.Qt.SortOrder.AscendingOrder)
for i in range(self.ui.comboBoxSendFrom.count()):
- address = str(self.ui.comboBoxSendFrom.itemData(
- i, QtCore.Qt.UserRole).toString())
+ address = self.ui.comboBoxSendFrom.itemData(
+ i, QtCore.Qt.ItemDataRole.UserRole)
self.ui.comboBoxSendFrom.setItemData(
i, AccountColor(address).accountColor(),
- QtCore.Qt.ForegroundRole)
+ QtCore.Qt.ItemDataRole.ForegroundRole)
self.ui.comboBoxSendFrom.insertItem(0, '', '')
if(self.ui.comboBoxSendFrom.count() == 2):
self.ui.comboBoxSendFrom.setCurrentIndex(1)
@@ -2315,16 +2318,16 @@ class MyForm(settingsmixin.SMainWindow):
addressInKeysFile, 'enabled')
isChan = config.safeGetBoolean(addressInKeysFile, 'chan')
if isEnabled and not isChan:
- label = str(config.get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip()
+ label = config.get(addressInKeysFile, 'label').strip()
if label == "":
label = addressInKeysFile
self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
for i in range(self.ui.comboBoxSendFromBroadcast.count()):
- address = str(self.ui.comboBoxSendFromBroadcast.itemData(
- i, QtCore.Qt.UserRole).toString())
+ address = self.ui.comboBoxSendFromBroadcast.itemData(
+ i, QtCore.Qt.ItemDataRole.UserRole)
self.ui.comboBoxSendFromBroadcast.setItemData(
i, AccountColor(address).accountColor(),
- QtCore.Qt.ForegroundRole)
+ QtCore.Qt.ItemDataRole.ForegroundRole)
self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '')
if(self.ui.comboBoxSendFromBroadcast.count() == 2):
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(1)
@@ -2421,7 +2424,7 @@ class MyForm(settingsmixin.SMainWindow):
self.notifierShow(
_translate("MainWindow", "New Message"),
_translate("MainWindow", "From {0}").format(
- str(acct.fromLabel, 'utf-8')),
+ acct.fromLabel),
sound.SOUND_UNKNOWN
)
if self.getCurrentAccount() is not None and (
@@ -2436,7 +2439,7 @@ class MyForm(settingsmixin.SMainWindow):
if acct.feedback != GatewayAccount.ALL_OK:
if acct.feedback == GatewayAccount.REGISTRATION_DENIED:
dialogs.EmailGatewayDialog(
- self, config, acct).exec_()
+ self, config, acct).exec()
# possible other branches?
except AttributeError:
pass
@@ -2444,7 +2447,7 @@ class MyForm(settingsmixin.SMainWindow):
def click_pushButtonAddAddressBook(self, dialog=None):
if not dialog:
dialog = dialogs.AddAddressDialog(self)
- dialog.exec_()
+ dialog.exec()
try:
address, label = dialog.data
except AttributeError:
@@ -2489,7 +2492,7 @@ class MyForm(settingsmixin.SMainWindow):
def click_pushButtonAddSubscription(self):
dialog = dialogs.NewSubscriptionDialog(self)
- dialog.exec_()
+ dialog.exec()
try:
address, label = dialog.data
except AttributeError:
@@ -2518,19 +2521,19 @@ class MyForm(settingsmixin.SMainWindow):
))
def click_pushButtonStatusIcon(self):
- dialogs.IconGlossaryDialog(self, config=config).exec_()
+ dialogs.IconGlossaryDialog(self, config=config).exec()
def click_actionHelp(self):
- dialogs.HelpDialog(self).exec_()
+ dialogs.HelpDialog(self).exec()
def click_actionSupport(self):
support.createSupportMessage(self)
def click_actionAbout(self):
- dialogs.AboutDialog(self).exec_()
+ dialogs.AboutDialog(self).exec()
def click_actionSettings(self):
- dialogs.SettingsDialog(self, firstrun=self._firstrun).exec_()
+ dialogs.SettingsDialog(self, firstrun=self._firstrun).exec()
def on_action_Send(self):
"""Send message to current selected address"""
@@ -2550,7 +2553,7 @@ class MyForm(settingsmixin.SMainWindow):
def on_action_EmailGatewayDialog(self):
dialog = dialogs.EmailGatewayDialog(self, config=config)
# For Modal dialogs
- dialog.exec_()
+ dialog.exec()
try:
acct = dialog.data
except AttributeError:
@@ -2578,13 +2581,13 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.textEditMessage.setFocus()
def on_action_MarkAllRead(self):
- if QtGui.QMessageBox.question(
+ if QtWidgets.QMessageBox.question(
self, "Marking all messages as read?",
_translate(
"MainWindow",
"Are you sure you would like to mark all messages read?"
- ), QtGui.QMessageBox.StandardButton.Yes | QtGui.QMessageBox.StandardButton.No
- ) != QtGui.QMessageBox.StandardButton.Yes:
+ ), QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No
+ ) != QtWidgets.QMessageBox.StandardButton.Yes:
return
tableWidget = self.getCurrentMessagelist()
@@ -2857,7 +2860,7 @@ class MyForm(settingsmixin.SMainWindow):
lines[i] = '
'
content = ' '.join(lines) # To keep the whitespace between lines
content = shared.fixPotentiallyInvalidUTF8Data(content)
- content = str(content, 'utf-8)')
+ content = content
textEdit.setHtml(QtCore.QString(content))
def on_action_InboxMarkUnread(self):
@@ -3040,7 +3043,7 @@ class MyForm(settingsmixin.SMainWindow):
self.setSendFromComboBox(toAddressAtCurrentInboxRow)
quotedText = self.quoted_text(
- str(messageAtCurrentInboxRow, 'utf-8', 'replace'))
+ messageAtCurrentInboxRow)
widget['message'].setPlainText(quotedText)
if acct.subject[0:3] in ('Re:', 'RE:'):
widget['subject'].setText(
@@ -3059,7 +3062,7 @@ class MyForm(settingsmixin.SMainWindow):
return
currentInboxRow = tableWidget.currentRow()
addressAtCurrentInboxRow = tableWidget.item(
- currentInboxRow, 1).data(QtCore.Qt.UserRole)
+ currentInboxRow, 1).data(QtCore.Qt.ItemDataRole.UserRole)
self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send)
)
@@ -3072,9 +3075,9 @@ class MyForm(settingsmixin.SMainWindow):
return
currentInboxRow = tableWidget.currentRow()
addressAtCurrentInboxRow = tableWidget.item(
- currentInboxRow, 1).data(QtCore.Qt.UserRole)
+ currentInboxRow, 1).data(QtCore.Qt.ItemDataRole.UserRole)
recipientAddress = tableWidget.item(
- currentInboxRow, 0).data(QtCore.Qt.UserRole)
+ currentInboxRow, 0).data(QtCore.Qt.ItemDataRole.UserRole)
# Let's make sure that it isn't already in the address book
queryreturn = sqlQuery('''select * from blacklist where address=?''',
addressAtCurrentInboxRow)
@@ -3186,7 +3189,7 @@ class MyForm(settingsmixin.SMainWindow):
currentInboxRow = tableWidget.currentRow()
try:
subjectAtCurrentInboxRow = str(tableWidget.item(
- currentInboxRow, 2).data(QtCore.Qt.UserRole))
+ currentInboxRow, 2).data(QtCore.Qt.ItemDataRole.UserRole))
except:
subjectAtCurrentInboxRow = ''
@@ -3240,7 +3243,7 @@ class MyForm(settingsmixin.SMainWindow):
def on_action_ForceSend(self):
currentRow = self.ui.tableWidgetInbox.currentRow()
addressAtCurrentRow = self.ui.tableWidgetInbox.item(
- currentRow, 0).data(QtCore.Qt.UserRole)
+ currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole)
toRipe = decodeAddress(addressAtCurrentRow)[3]
sqlExecute(
'''UPDATE sent SET status='forcepow' WHERE toripe=? AND status='toodifficult' and folder='sent' ''',
@@ -3255,7 +3258,7 @@ class MyForm(settingsmixin.SMainWindow):
def on_action_SentClipboard(self):
currentRow = self.ui.tableWidgetInbox.currentRow()
addressAtCurrentRow = self.ui.tableWidgetInbox.item(
- currentRow, 0).data(QtCore.Qt.UserRole)
+ currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole)
clipboard = QtWidgets.QApplication.clipboard()
clipboard.setText(str(addressAtCurrentRow))
@@ -3291,8 +3294,7 @@ class MyForm(settingsmixin.SMainWindow):
return self.updateStatusBar(_translate(
"MainWindow", "No addresses selected."))
- addresses_string = str(
- self.ui.lineEditTo.text().toUtf8(), 'utf-8')
+ addresses_string = self.ui.lineEditTo.text()
for item in selected_items:
address_string = item.accountString()
if not addresses_string:
@@ -3345,7 +3347,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuAddressBook.addSeparator()
for plugin in self.menu_plugins['address']:
self.popMenuAddressBook.addAction(plugin)
- self.popMenuAddressBook.exec_(
+ self.popMenuAddressBook.exec(
self.ui.tableWidgetAddressBook.mapToGlobal(point))
# Group of functions for the Subscriptions dialog box
@@ -3426,7 +3428,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuSubscriptions.addAction(self.actionMarkAllRead)
if self.popMenuSubscriptions.isEmpty():
return
- self.popMenuSubscriptions.exec_(
+ self.popMenuSubscriptions.exec(
self.ui.treeWidgetSubscriptions.mapToGlobal(point))
def widgetConvert(self, widget):
@@ -3532,7 +3534,7 @@ class MyForm(settingsmixin.SMainWindow):
if currentIndex >= 0 and currentIndex < len(messagelistList):
return (
messagelistList[currentIndex] if retObj
- else messagelistList[currentIndex].text().toUtf8().data())
+ else messagelistList[currentIndex].text())
def getCurrentSearchOption(self, currentIndex=None):
if currentIndex is None:
@@ -3653,18 +3655,18 @@ class MyForm(settingsmixin.SMainWindow):
currentColumn = 0 if currentFolder == "sent" else 1
if currentFolder == "sent":
- myAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole)
- otherAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole)
+ myAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.ItemDataRole.UserRole)
+ otherAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole)
else:
- myAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole)
- otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole)
+ myAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole)
+ otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.ItemDataRole.UserRole)
account = accountClass(myAddress)
if isinstance(account, GatewayAccount) and otherAddress == account.relayAddress and (
(currentColumn in [0, 2] and self.getCurrentFolder() == "sent") or
(currentColumn in [1, 2] and self.getCurrentFolder() != "sent")):
text = str(tableWidget.item(currentRow, currentColumn).label)
else:
- text = tableWidget.item(currentRow, currentColumn).data(QtCore.Qt.UserRole)
+ text = tableWidget.item(currentRow, currentColumn).data(QtCore.Qt.ItemDataRole.UserRole)
clipboard = QtWidgets.QApplication.clipboard()
clipboard.setText(text)
@@ -3849,7 +3851,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuYourIdentities.addAction(self.actionMarkAllRead)
if self.popMenuYourIdentities.isEmpty():
return
- self.popMenuYourIdentities.exec_(
+ self.popMenuYourIdentities.exec(
self.ui.treeWidgetYourIdentities.mapToGlobal(point))
# TODO make one popMenu
@@ -3878,7 +3880,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenu.addAction(self.actionMarkAllRead)
if self.popMenu.isEmpty():
return
- self.popMenu.exec_(
+ self.popMenu.exec(
self.ui.treeWidgetChans.mapToGlobal(point))
def on_context_menuInbox(self, point):
@@ -3897,7 +3899,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuInbox.addSeparator()
currentRow = tableWidget.currentRow()
account = accountClass(
- tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole))
+ tableWidget.item(currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole))
if account.type == AccountMixin.CHAN:
self.popMenuInbox.addAction(self.actionReplyChan)
@@ -3922,7 +3924,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuInbox.addAction(self.actionUndeleteTrashedMessage)
else:
self.popMenuInbox.addAction(self.actionTrashInboxMessage)
- self.popMenuInbox.exec_(tableWidget.mapToGlobal(point))
+ self.popMenuInbox.exec(tableWidget.mapToGlobal(point))
def on_context_menuSent(self, point):
currentRow = self.ui.tableWidgetInbox.currentRow()
@@ -3946,11 +3948,11 @@ class MyForm(settingsmixin.SMainWindow):
if status == 'toodifficult':
self.popMenuSent.addAction(self.actionForceSend)
- self.popMenuSent.exec_(self.ui.tableWidgetInbox.mapToGlobal(point))
+ self.popMenuSent.exec(self.ui.tableWidgetInbox.mapToGlobal(point))
def inboxSearchLineEditUpdated(self, text):
# dynamic search for too short text is slow
- text = text.toUtf8()
+ text = text
if 0 < len(text) < 3:
return
messagelist = self.getCurrentMessagelist()
@@ -4007,7 +4009,7 @@ class MyForm(settingsmixin.SMainWindow):
if item.type == AccountMixin.ALL:
return
- newLabel = str(item.text(0), 'utf-8', 'ignore')
+ newLabel = item.text(0)
oldLabel = item.defaultLabel()
# unchanged, do not do anything either
diff --git a/src/bitmessageqt/account.py b/src/bitmessageqt/account.py
index 25c86e46..fb21ec8d 100644
--- a/src/bitmessageqt/account.py
+++ b/src/bitmessageqt/account.py
@@ -150,10 +150,7 @@ class BMAccount(object):
self.toAddress = toAddress
self.fromAddress = fromAddress
- if isinstance(subject, unicode):
- self.subject = str(subject)
- else:
- self.subject = subject
+ self.subject = subject
self.message = message
self.fromLabel = self.getLabel(fromAddress)
self.toLabel = self.getLabel(toAddress)
diff --git a/src/bitmessageqt/address_dialogs.py b/src/bitmessageqt/address_dialogs.py
index bee27794..29bfc50a 100644
--- a/src/bitmessageqt/address_dialogs.py
+++ b/src/bitmessageqt/address_dialogs.py
@@ -8,7 +8,7 @@ import hashlib
from PyQt6 import QtCore, QtGui, QtWidgets
import queues
-import bitmessageqt.widgets
+import bitmessageqt.widgets as widgets
import state
from .account import AccountMixin, GatewayAccount, MailchuckAccount, accountClass
from addresses import addBMIfNotPresent, decodeAddress, encodeVarint
@@ -21,10 +21,6 @@ class AddressCheckMixin(object):
def __init__(self):
self.valid = False
- QtCore.QObject.connect( # pylint: disable=no-member
- self.lineEditAddress,
- QtCore.SIGNAL("textChanged(QString)"),
- self.addressChanged)
def _onSuccess(self, addressVersion, streamNumber, ripe):
pass
@@ -90,8 +86,8 @@ class AddressDataDialog(QtWidgets.QDialog, AddressCheckMixin):
"""Callback for QDIalog accepting value"""
if self.valid:
self.data = (
- addBMIfNotPresent(str(self.lineEditAddress.text())),
- str(self.lineEditLabel.text().toUtf8())
+ addBMIfNotPresent(self.lineEditAddress.text()),
+ self.lineEditLabel.text()
)
else:
queues.UISignalQueue.put(('updateStatusBar', _translate(
@@ -110,6 +106,7 @@ class AddAddressDialog(AddressDataDialog):
AddressCheckMixin.__init__(self)
if address:
self.lineEditAddress.setText(address)
+ self.lineEditAddress.textChanged.connect(self.addressChanged)
class NewAddressDialog(QtWidgets.QDialog):
@@ -125,7 +122,7 @@ class NewAddressDialog(QtWidgets.QDialog):
self.radioButtonExisting.click()
self.comboBoxExisting.addItem(address)
self.groupBoxDeterministic.setHidden(True)
- QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
+ QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
self.show()
def accept(self):
@@ -142,7 +139,7 @@ class NewAddressDialog(QtWidgets.QDialog):
self.comboBoxExisting.currentText())[2]
queues.addressGeneratorQueue.put((
'createRandomAddress', 4, streamNumberForAddress,
- str(self.newaddresslabel.text().toUtf8()), 1, "",
+ self.newaddresslabel.text(), 1, "",
self.checkBoxEighteenByteRipe.isChecked()
))
else:
@@ -169,7 +166,7 @@ class NewAddressDialog(QtWidgets.QDialog):
'createDeterministicAddresses', 4, streamNumberForAddress,
"unused deterministic address",
self.spinBoxNumberOfAddressesToMake.value(),
- self.lineEditPassphrase.text().toUtf8(),
+ self.lineEditPassphrase.text(),
self.checkBoxEighteenByteRipe.isChecked()
))
@@ -181,6 +178,7 @@ class NewSubscriptionDialog(AddressDataDialog):
super(NewSubscriptionDialog, self).__init__(parent)
widgets.load('newsubscriptiondialog.ui', self)
AddressCheckMixin.__init__(self)
+ self.lineEditAddress.textChanged.connect(self.addressChanged)
def _onSuccess(self, addressVersion, streamNumber, ripe):
if addressVersion <= 3:
@@ -222,7 +220,7 @@ class RegenerateAddressesDialog(QtWidgets.QDialog):
super(RegenerateAddressesDialog, self).__init__(parent)
widgets.load('regenerateaddresses.ui', self)
self.groupBox.setTitle('')
- QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
+ QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
class SpecialAddressBehaviorDialog(QtWidgets.QDialog):
@@ -257,11 +255,9 @@ class SpecialAddressBehaviorDialog(QtWidgets.QDialog):
else:
self.radioButtonBehaveNormalAddress.click()
mailingListName = config.safeGet(self.address, 'mailinglistname', '')
- self.lineEditMailingListName.setText(
- unicode(mailingListName, 'utf-8')
- )
+ self.lineEditMailingListName.setText(mailingListName)
- QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
+ QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
self.show()
def accept(self):
@@ -281,7 +277,7 @@ class SpecialAddressBehaviorDialog(QtWidgets.QDialog):
else:
self.config.set(str(self.address), 'mailinglist', 'true')
self.config.set(str(self.address), 'mailinglistname', str(
- self.lineEditMailingListName.text().toUtf8()))
+ self.lineEditMailingListName.text()))
self.parent.setCurrentItemColor(
QtGui.QColor(137, 4, 177)) # magenta
self.parent.rerenderComboBoxSendFrom()
@@ -329,7 +325,7 @@ class EmailGatewayDialog(QtWidgets.QDialog):
else:
self.acct = MailchuckAccount(address)
self.lineEditEmail.setFocus()
- QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self))
+ QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
def accept(self):
"""Accept callback"""
@@ -343,7 +339,7 @@ class EmailGatewayDialog(QtWidgets.QDialog):
if self.radioButtonRegister.isChecked() \
or self.radioButtonRegister.isHidden():
- email = str(self.lineEditEmail.text().toUtf8())
+ email = self.lineEditEmail.text()
self.acct.register(email)
self.config.set(self.acct.fromAddress, 'label', email)
self.config.set(self.acct.fromAddress, 'gateway', 'mailchuck')
diff --git a/src/bitmessageqt/addressvalidator.py b/src/bitmessageqt/addressvalidator.py
index d1485b7b..9785c3a2 100644
--- a/src/bitmessageqt/addressvalidator.py
+++ b/src/bitmessageqt/addressvalidator.py
@@ -5,7 +5,7 @@ Address validator module.
from queue import Empty
-from PyQt6 import QtGui
+from PyQt6 import QtGui, QtWidgets
from addresses import decodeAddress, addBMIfNotPresent
from bmconfigparser import config
@@ -32,7 +32,7 @@ class AddressPassPhraseValidatorMixin(object):
self.addressMandatory = addressMandatory
self.isValid = False
# save default text
- self.okButtonLabel = self.buttonBox.button(QtGui.QDialogButtonBox.Ok).text()
+ self.okButtonLabel = self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).text()
def setError(self, string):
"""Indicate that the validation is pending or failed"""
@@ -44,12 +44,12 @@ class AddressPassPhraseValidatorMixin(object):
self.feedBackObject.setText(string)
self.isValid = False
if self.buttonBox:
- self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(False)
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setEnabled(False)
if string is not None and self.feedBackObject is not None:
- self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText(
_translate("AddressValidator", "Invalid"))
else:
- self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText(
_translate("AddressValidator", "Validating..."))
def setOK(self, string):
@@ -62,8 +62,8 @@ class AddressPassPhraseValidatorMixin(object):
self.feedBackObject.setText(string)
self.isValid = True
if self.buttonBox:
- self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True)
- self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(self.okButtonLabel)
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setEnabled(True)
+ self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText(self.okButtonLabel)
def checkQueue(self):
"""Validator queue loop"""
@@ -87,47 +87,47 @@ class AddressPassPhraseValidatorMixin(object):
if not addressGeneratorReturnValue:
self.setError(_translate("AddressValidator", "Address already present as one of your identities."))
- return (QtGui.QValidator.Intermediate, 0)
+ return (QtGui.QValidator.State.Intermediate, 0)
if addressGeneratorReturnValue[0] == 'chan name does not match address':
self.setError(
_translate(
"AddressValidator",
"Although the Bitmessage address you "
"entered was valid, it doesn't match the chan name."))
- return (QtGui.QValidator.Intermediate, 0)
+ return (QtGui.QValidator.State.Intermediate, 0)
self.setOK(_translate("MainWindow", "Passphrase and address appear to be valid."))
def returnValid(self):
"""Return the value of whether the validation was successful"""
if self.isValid:
- return QtGui.QValidator.Acceptable
- return QtGui.QValidator.Intermediate
+ return QtGui.QValidator.State.Acceptable
+ return QtGui.QValidator.State.Intermediate
def validate(self, s, pos):
"""Top level validator method"""
if self.addressObject is None:
address = None
else:
- address = str(self.addressObject.text().toUtf8())
+ address = self.addressObject.text()
if address == "":
address = None
if self.passPhraseObject is None:
passPhrase = ""
else:
- passPhrase = str(self.passPhraseObject.text().toUtf8())
+ passPhrase = self.passPhraseObject.text()
if passPhrase == "":
passPhrase = None
# no chan name
if passPhrase is None:
self.setError(_translate("AddressValidator", "Chan name/passphrase needed. You didn't enter a chan name."))
- return (QtGui.QValidator.Intermediate, pos)
+ return (QtGui.QValidator.State.Intermediate, pos)
if self.addressMandatory or address is not None:
# check if address already exists:
if address in config.addresses():
self.setError(_translate("AddressValidator", "Address already present as one of your identities."))
- return (QtGui.QValidator.Intermediate, pos)
+ return (QtGui.QValidator.State.Intermediate, pos)
# version too high
if decodeAddress(address)[0] == 'versiontoohigh':
@@ -138,29 +138,29 @@ class AddressPassPhraseValidatorMixin(object):
" address might be valid, its version number"
" is too new for us to handle. Perhaps you need"
" to upgrade Bitmessage."))
- return (QtGui.QValidator.Intermediate, pos)
+ return (QtGui.QValidator.State.Intermediate, pos)
# invalid
if decodeAddress(address)[0] != 'success':
self.setError(_translate("AddressValidator", "The Bitmessage address is not valid."))
- return (QtGui.QValidator.Intermediate, pos)
+ return (QtGui.QValidator.State.Intermediate, pos)
# this just disables the OK button without changing the feedback text
# but only if triggered by textEdited, not by clicking the Ok button
- if not self.buttonBox.button(QtGui.QDialogButtonBox.Ok).hasFocus():
+ if not self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).hasFocus():
self.setError(None)
# check through generator
if address is None:
- addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + str(passPhrase), passPhrase, False))
+ addressGeneratorQueue.put(('createChan', 4, 1, str_chan + ' ' + passPhrase, passPhrase, False))
else:
addressGeneratorQueue.put(
('joinChan', addBMIfNotPresent(address),
"{} {}".format(str_chan, passPhrase), passPhrase, False))
- if self.buttonBox.button(QtGui.QDialogButtonBox.Ok).hasFocus():
+ if self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).hasFocus():
return (self.returnValid(), pos)
- return (QtGui.QValidator.Intermediate, pos)
+ return (QtGui.QValidator.State.Intermediate, pos)
def checkData(self):
"""Validator Qt signal interface"""
diff --git a/src/bitmessageqt/bitmessageui.py b/src/bitmessageqt/bitmessageui.py
index 1e882928..139090b1 100644
--- a/src/bitmessageqt/bitmessageui.py
+++ b/src/bitmessageqt/bitmessageui.py
@@ -10,6 +10,7 @@ from PyQt6 import QtCore, QtGui, QtWidgets
from bmconfigparser import config
from .foldertree import AddressBookCompleter
from .blacklist import Blacklist
+import bitmessageqt.settingsmixin as settingsmixin
from .networkstatus import NetworkStatus
class Ui_MainWindow(object):
@@ -164,41 +165,41 @@ class Ui_MainWindow(object):
self.verticalLayout.setObjectName("verticalLayout")
self.tabWidgetSend = QtWidgets.QTabWidget(parent=self.send)
self.tabWidgetSend.setObjectName("tabWidgetSend")
- self.tab = QtWidgets.QWidget()
- self.tab.setObjectName("tab")
- self.gridLayout_8 = QtWidgets.QGridLayout(self.tab)
+ self.sendDirect = QtWidgets.QWidget()
+ self.sendDirect.setObjectName("sendDirect")
+ self.gridLayout_8 = QtWidgets.QGridLayout(self.sendDirect)
self.gridLayout_8.setObjectName("gridLayout_8")
self.verticalLayout_5 = QtWidgets.QVBoxLayout()
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2")
- self.label_3 = QtWidgets.QLabel(parent=self.tab)
+ self.label_3 = QtWidgets.QLabel(parent=self.sendDirect)
self.label_3.setObjectName("label_3")
self.gridLayout_2.addWidget(self.label_3, 2, 0, 1, 1)
- self.label_2 = QtWidgets.QLabel(parent=self.tab)
+ self.label_2 = QtWidgets.QLabel(parent=self.sendDirect)
self.label_2.setObjectName("label_2")
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
- self.lineEditSubject = QtWidgets.QLineEdit(parent=self.tab)
+ self.lineEditSubject = QtWidgets.QLineEdit(parent=self.sendDirect)
self.lineEditSubject.setText("")
self.lineEditSubject.setObjectName("lineEditSubject")
self.gridLayout_2.addWidget(self.lineEditSubject, 2, 1, 1, 1)
- self.label = QtWidgets.QLabel(parent=self.tab)
+ self.label = QtWidgets.QLabel(parent=self.sendDirect)
self.label.setObjectName("label")
self.gridLayout_2.addWidget(self.label, 1, 0, 1, 1)
- self.comboBoxSendFrom = QtWidgets.QComboBox(parent=self.tab)
+ self.comboBoxSendFrom = QtWidgets.QComboBox(parent=self.sendDirect)
self.comboBoxSendFrom.setMinimumSize(QtCore.QSize(300, 0))
self.comboBoxSendFrom.setObjectName("comboBoxSendFrom")
self.gridLayout_2.addWidget(self.comboBoxSendFrom, 0, 1, 1, 1)
- self.lineEditTo = QtWidgets.QLineEdit(parent=self.tab)
+ self.lineEditTo = QtWidgets.QLineEdit(parent=self.sendDirect)
self.lineEditTo.setObjectName("lineEditTo")
self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1)
self.lineEditTo.setCompleter(self.addressBookCompleter)
self.verticalLayout_5.addLayout(self.gridLayout_2)
- self.textEditMessage = QtWidgets.QTextEdit(parent=self.tab)
+ self.textEditMessage = QtWidgets.QTextEdit(parent=self.sendDirect)
self.textEditMessage.setObjectName("textEditMessage")
self.verticalLayout_5.addWidget(self.textEditMessage)
self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1)
- self.tabWidgetSend.addTab(self.tab, "")
+ self.tabWidgetSend.addTab(self.sendDirect, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_2)
@@ -360,15 +361,15 @@ class Ui_MainWindow(object):
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap(":/newPrefix/images/subscriptions.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.tabWidget.addTab(self.subscriptions, icon6, "")
- self.tab_3 = QtWidgets.QWidget()
- self.tab_3.setObjectName("tab_3")
- self.gridLayout_4 = QtWidgets.QGridLayout(self.tab_3)
+ self.chans = QtWidgets.QWidget()
+ self.chans.setObjectName("chans")
+ self.gridLayout_4 = QtWidgets.QGridLayout(self.chans)
self.gridLayout_4.setObjectName("gridLayout_4")
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
self.verticalLayout_17 = QtWidgets.QVBoxLayout()
self.verticalLayout_17.setObjectName("verticalLayout_17")
- self.treeWidgetChans = QtWidgets.QTreeWidget(parent=self.tab_3)
+ self.treeWidgetChans = QtWidgets.QTreeWidget(parent=self.chans)
self.treeWidgetChans.setMaximumSize(QtCore.QSize(200, 16777215))
self.treeWidgetChans.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
self.treeWidgetChans.setLineWidth(1)
@@ -380,7 +381,7 @@ class Ui_MainWindow(object):
icon7.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Selected, QtGui.QIcon.State.Off)
self.treeWidgetChans.headerItem().setIcon(0, icon7)
self.verticalLayout_17.addWidget(self.treeWidgetChans)
- self.pushButtonAddChan = QtWidgets.QPushButton(parent=self.tab_3)
+ self.pushButtonAddChan = QtWidgets.QPushButton(parent=self.chans)
self.pushButtonAddChan.setMaximumSize(QtCore.QSize(200, 16777215))
self.pushButtonAddChan.setObjectName("pushButtonAddChan")
self.verticalLayout_17.addWidget(self.pushButtonAddChan)
@@ -389,10 +390,10 @@ class Ui_MainWindow(object):
self.verticalLayout_8.setObjectName("verticalLayout_8")
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
- self.inboxSearchLineEditChans = QtWidgets.QLineEdit(parent=self.tab_3)
+ self.inboxSearchLineEditChans = QtWidgets.QLineEdit(parent=self.chans)
self.inboxSearchLineEditChans.setObjectName("inboxSearchLineEditChans")
self.horizontalLayout_6.addWidget(self.inboxSearchLineEditChans)
- self.inboxSearchOptionChans = QtWidgets.QComboBox(parent=self.tab_3)
+ self.inboxSearchOptionChans = QtWidgets.QComboBox(parent=self.chans)
self.inboxSearchOptionChans.setObjectName("inboxSearchOptionChans")
self.inboxSearchOptionChans.addItem("")
self.inboxSearchOptionChans.addItem("")
@@ -401,7 +402,7 @@ class Ui_MainWindow(object):
self.inboxSearchOptionChans.addItem("")
self.horizontalLayout_6.addWidget(self.inboxSearchOptionChans)
self.verticalLayout_8.addLayout(self.horizontalLayout_6)
- self.tableWidgetInboxChans = QtWidgets.QTableWidget(parent=self.tab_3)
+ self.tableWidgetInboxChans = QtWidgets.QTableWidget(parent=self.chans)
self.tableWidgetInboxChans.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
self.tableWidgetInboxChans.setAlternatingRowColors(True)
self.tableWidgetInboxChans.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
@@ -427,7 +428,7 @@ class Ui_MainWindow(object):
self.tableWidgetInboxChans.verticalHeader().setVisible(False)
self.tableWidgetInboxChans.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_8.addWidget(self.tableWidgetInboxChans)
- self.textEditInboxMessageChans = QtWidgets.QTextEdit(parent=self.tab_3)
+ self.textEditInboxMessageChans = QtWidgets.QTextEdit(parent=self.chans)
self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessageChans.setReadOnly(True)
self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans")
@@ -436,7 +437,7 @@ class Ui_MainWindow(object):
self.gridLayout_4.addLayout(self.horizontalLayout_7, 0, 0, 1, 1)
icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
- self.tabWidget.addTab(self.tab_3, icon8, "")
+ self.tabWidget.addTab(self.chans, icon8, "")
self.blackwhitelist = Blacklist()
self.blackwhitelist.setObjectName("blackwhitelist")
self.tabWidget.addTab(self.blackwhitelist, QtGui.QIcon(":/newPrefix/images/blacklist.png"), "")
@@ -445,108 +446,8 @@ class Ui_MainWindow(object):
self.blackwhitelist.radioButtonWhitelist.click()
self.blackwhitelist.rerenderBlackWhiteList()
- self.gridLayout_6 = QtWidgets.QGridLayout(self.blackwhitelist)
- self.gridLayout_6.setObjectName("gridLayout_6")
- self.radioButtonBlacklist = QtWidgets.QRadioButton(parent=self.blackwhitelist)
- self.radioButtonBlacklist.setChecked(True)
- self.radioButtonBlacklist.setObjectName("radioButtonBlacklist")
- self.gridLayout_6.addWidget(self.radioButtonBlacklist, 0, 0, 1, 2)
- self.radioButtonWhitelist = QtWidgets.QRadioButton(parent=self.blackwhitelist)
- self.radioButtonWhitelist.setObjectName("radioButtonWhitelist")
- self.gridLayout_6.addWidget(self.radioButtonWhitelist, 1, 0, 1, 2)
- self.pushButtonAddBlacklist = QtWidgets.QPushButton(parent=self.blackwhitelist)
- self.pushButtonAddBlacklist.setObjectName("pushButtonAddBlacklist")
- self.gridLayout_6.addWidget(self.pushButtonAddBlacklist, 2, 0, 1, 1)
- spacerItem = QtWidgets.QSpacerItem(689, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
- self.gridLayout_6.addItem(spacerItem, 2, 1, 1, 1)
- self.tableWidgetBlacklist = QtWidgets.QTableWidget(parent=self.blackwhitelist)
- self.tableWidgetBlacklist.setAlternatingRowColors(True)
- self.tableWidgetBlacklist.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.SingleSelection)
- self.tableWidgetBlacklist.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
- self.tableWidgetBlacklist.setObjectName("tableWidgetBlacklist")
- self.tableWidgetBlacklist.setColumnCount(2)
- self.tableWidgetBlacklist.setRowCount(0)
- item = QtWidgets.QTableWidgetItem()
- self.tableWidgetBlacklist.setHorizontalHeaderItem(0, item)
- item = QtWidgets.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(":/newPrefix/images/blacklist.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
- self.tabWidget.addTab(self.blackwhitelist, icon9, "")
self.networkstatus = NetworkStatus()
self.tabWidget.addTab(self.networkstatus, QtGui.QIcon(":/newPrefix/images/networkstatus.png"), "")
- self.networkstatus.setObjectName("networkstatus")
- self.pushButtonStatusIcon = QtWidgets.QPushButton(parent=self.networkstatus)
- self.pushButtonStatusIcon.setGeometry(QtCore.QRect(680, 440, 21, 23))
- self.pushButtonStatusIcon.setText("")
- icon10 = QtGui.QIcon()
- icon10.addPixmap(QtGui.QPixmap(":/newPrefix/images/redicon.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
- self.pushButtonStatusIcon.setIcon(icon10)
- self.pushButtonStatusIcon.setFlat(True)
- self.pushButtonStatusIcon.setObjectName("pushButtonStatusIcon")
- self.tableWidgetConnectionCount = QtWidgets.QTableWidget(parent=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.BrushStyle.SolidPattern)
- palette.setBrush(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.Base, brush)
- brush = QtGui.QBrush(QtGui.QColor(212, 208, 200))
- brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern)
- palette.setBrush(QtGui.QPalette.ColorGroup.Inactive, QtGui.QPalette.ColorRole.Base, brush)
- brush = QtGui.QBrush(QtGui.QColor(212, 208, 200))
- brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern)
- palette.setBrush(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.Base, brush)
- self.tableWidgetConnectionCount.setPalette(palette)
- self.tableWidgetConnectionCount.setFrameShape(QtWidgets.QFrame.Shape.Box)
- self.tableWidgetConnectionCount.setFrameShadow(QtWidgets.QFrame.Shadow.Plain)
- self.tableWidgetConnectionCount.setProperty("showDropIndicator", False)
- self.tableWidgetConnectionCount.setAlternatingRowColors(True)
- self.tableWidgetConnectionCount.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.NoSelection)
- self.tableWidgetConnectionCount.setObjectName("tableWidgetConnectionCount")
- self.tableWidgetConnectionCount.setColumnCount(2)
- self.tableWidgetConnectionCount.setRowCount(0)
- item = QtWidgets.QTableWidgetItem()
- self.tableWidgetConnectionCount.setHorizontalHeaderItem(0, item)
- item = QtWidgets.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 = QtWidgets.QLabel(parent=self.networkstatus)
- self.labelTotalConnections.setGeometry(QtCore.QRect(20, 30, 401, 16))
- self.labelTotalConnections.setObjectName("labelTotalConnections")
- self.labelStartupTime = QtWidgets.QLabel(parent=self.networkstatus)
- self.labelStartupTime.setGeometry(QtCore.QRect(320, 110, 331, 20))
- self.labelStartupTime.setObjectName("labelStartupTime")
- self.labelMessageCount = QtWidgets.QLabel(parent=self.networkstatus)
- self.labelMessageCount.setGeometry(QtCore.QRect(350, 130, 361, 16))
- self.labelMessageCount.setObjectName("labelMessageCount")
- self.labelPubkeyCount = QtWidgets.QLabel(parent=self.networkstatus)
- self.labelPubkeyCount.setGeometry(QtCore.QRect(350, 170, 331, 16))
- self.labelPubkeyCount.setObjectName("labelPubkeyCount")
- self.labelBroadcastCount = QtWidgets.QLabel(parent=self.networkstatus)
- self.labelBroadcastCount.setGeometry(QtCore.QRect(350, 150, 351, 16))
- self.labelBroadcastCount.setObjectName("labelBroadcastCount")
- self.labelLookupsPerSecond = QtWidgets.QLabel(parent=self.networkstatus)
- self.labelLookupsPerSecond.setGeometry(QtCore.QRect(320, 250, 291, 16))
- self.labelLookupsPerSecond.setObjectName("labelLookupsPerSecond")
- self.labelBytesRecvCount = QtWidgets.QLabel(parent=self.networkstatus)
- self.labelBytesRecvCount.setGeometry(QtCore.QRect(350, 210, 251, 16))
- self.labelBytesRecvCount.setObjectName("labelBytesRecvCount")
- self.labelBytesSentCount = QtWidgets.QLabel(parent=self.networkstatus)
- self.labelBytesSentCount.setGeometry(QtCore.QRect(350, 230, 251, 16))
- self.labelBytesSentCount.setObjectName("labelBytesSentCount")
- icon11 = QtGui.QIcon()
- icon11.addPixmap(QtGui.QPixmap(":/newPrefix/images/networkstatus.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
- self.tabWidget.addTab(self.networkstatus, icon11, "")
self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1)
self.MainDock.setWidget(self.centralwidget)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea.AllDockWidgetAreas, self.MainDock)
@@ -620,8 +521,12 @@ class Ui_MainWindow(object):
self.menubar.addAction(self.menuHelp.menuAction())
self.retranslateUi(MainWindow)
- self.tabWidget.setCurrentIndex(0)
- self.tabWidgetSend.setCurrentIndex(0)
+ self.tabWidget.setCurrentIndex(
+ self.tabWidget.indexOf(self.inbox)
+ )
+ self.tabWidgetSend.setCurrentIndex(
+ self.tabWidgetSend.indexOf(self.sendDirect)
+ )
QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage)
MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom)
@@ -630,12 +535,6 @@ class Ui_MainWindow(object):
MainWindow.setTabOrder(self.lineEditSubject, self.textEditMessage)
MainWindow.setTabOrder(self.textEditMessage, self.pushButtonSend)
MainWindow.setTabOrder(self.pushButtonSend, 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)
- MainWindow.setTabOrder(self.tableWidgetBlacklist, self.tableWidgetConnectionCount)
- MainWindow.setTabOrder(self.tableWidgetConnectionCount, self.pushButtonStatusIcon)
# Popup menu actions container for the Sent page
# pylint: disable=attribute-defined-outside-init
@@ -693,7 +592,7 @@ class Ui_MainWindow(object):
"p, li { white-space: pre-wrap; }\n"
"