fix GUIs to work with PyQt6

Unresolved problems:
* File->Quit menu does not work.
* Validator in add chan dialog does not work.
This commit is contained in:
Kashiko Koibumi 2024-05-14 16:34:27 +09:00
parent 16019d4083
commit e646377f22
No known key found for this signature in database
GPG Key ID: 8F06E069E37C40C4
17 changed files with 574 additions and 469 deletions

View File

@ -36,14 +36,14 @@ from .foldertree import (
MessageList_AddressWidget, MessageList_SubjectWidget, MessageList_AddressWidget, MessageList_SubjectWidget,
Ui_AddressBookWidgetItemLabel, Ui_AddressBookWidgetItemAddress, Ui_AddressBookWidgetItemLabel, Ui_AddressBookWidgetItemAddress,
MessageList_TimeWidget) MessageList_TimeWidget)
import bitmessageqt.settingsmixin import bitmessageqt.settingsmixin as settingsmixin
import bitmessageqt.support import bitmessageqt.support as support
from helper_sql import sqlQuery, sqlExecute, sqlExecuteChunked, sqlStoredProcedure from helper_sql import sqlQuery, sqlExecute, sqlExecuteChunked, sqlStoredProcedure
import helper_addressbook import helper_addressbook
import helper_search import helper_search
import l10n import l10n
from .utils import str_broadcast_subscribers, avatarize from .utils import str_broadcast_subscribers, avatarize
import bitmessageqt.dialogs import bitmessageqt.dialogs as dialogs
from network.stats import pendingDownload, pendingUpload from network.stats import pendingDownload, pendingUpload
from .uisignaler import UISignaler from .uisignaler import UISignaler
import paths import paths
@ -51,9 +51,9 @@ from proofofwork import getPowType
import queues import queues
import shutdown import shutdown
from .statusbar import BMStatusBar from .statusbar import BMStatusBar
import bitmessageqt.sound import bitmessageqt.sound as sound
# This is needed for tray icon # 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 import helper_sent
try: try:
@ -99,12 +99,12 @@ class MyForm(settingsmixin.SMainWindow):
newlocale = l10n.getTranslationLanguage() newlocale = l10n.getTranslationLanguage()
try: try:
if not self.qmytranslator.isEmpty(): if not self.qmytranslator.isEmpty():
QtGui.QApplication.removeTranslator(self.qmytranslator) QtWidgets.QApplication.removeTranslator(self.qmytranslator)
except: except:
pass pass
try: try:
if not self.qsystranslator.isEmpty(): if not self.qsystranslator.isEmpty():
QtGui.QApplication.removeTranslator(self.qsystranslator) QtWidgets.QApplication.removeTranslator(self.qsystranslator)
except: except:
pass pass
@ -377,7 +377,7 @@ class MyForm(settingsmixin.SMainWindow):
self.actionSentReply = self.ui.sentContextMenuToolbar.addAction( self.actionSentReply = self.ui.sentContextMenuToolbar.addAction(
_translate("MainWindow", "Send update"), _translate("MainWindow", "Send update"),
self.on_action_SentReply) self.on_action_SentReply)
# self.popMenuSent = QtGui.QMenu( self ) # self.popMenuSent = QtWidgets.QMenu( self )
# self.popMenuSent.addAction( self.actionSentClipboard ) # self.popMenuSent.addAction( self.actionSentClipboard )
# self.popMenuSent.addAction( self.actionTrashSentMessage ) # self.popMenuSent.addAction( self.actionTrashSentMessage )
@ -612,9 +612,9 @@ class MyForm(settingsmixin.SMainWindow):
"One of your addresses, {0}, is an old version 1 address. " "One of your addresses, {0}, is an old version 1 address. "
"Version 1 addresses are no longer supported. " "Version 1 addresses are no longer supported. "
"May we delete it now?").format(addressInKeysFile) "May we delete it now?").format(addressInKeysFile)
reply = QtGui.QMessageBox.question( reply = QtWidgets.QMessageBox.question(
self, 'Message', displayMsg, QtGui.QMessageBox.StandardButton.Yes, QtGui.QMessageBox.StandardButton.No) self, 'Message', displayMsg, QtWidgets.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.No)
if reply == QtGui.QMessageBox.StandardButton.Yes: if reply == QtWidgets.QMessageBox.StandardButton.Yes:
config.remove_section(addressInKeysFile) config.remove_section(addressInKeysFile)
config.save() config.save()
@ -997,7 +997,7 @@ class MyForm(settingsmixin.SMainWindow):
for i in range(root.childCount()): for i in range(root.childCount()):
addressItem = root.child(i) addressItem = root.child(i)
if addressItem.type == AccountMixin.ALL: if addressItem.type == AccountMixin.ALL:
newCount = sum(totalUnread.itervalues()) newCount = sum(totalUnread.values())
self.drawTrayIcon(self.currentTrayIconFileName, newCount) self.drawTrayIcon(self.currentTrayIconFileName, newCount)
else: else:
try: try:
@ -1005,7 +1005,7 @@ class MyForm(settingsmixin.SMainWindow):
broadcastsUnread broadcastsUnread
if addressItem.type == AccountMixin.SUBSCRIPTION if addressItem.type == AccountMixin.SUBSCRIPTION
else normalUnread else normalUnread
)[addressItem.address].itervalues()) )[addressItem.address].values())
except KeyError: except KeyError:
newCount = 0 newCount = 0
if newCount != addressItem.unreadCount: if newCount != addressItem.unreadCount:
@ -1108,11 +1108,11 @@ class MyForm(settingsmixin.SMainWindow):
items = [ items = [
MessageList_AddressWidget( MessageList_AddressWidget(
toAddress, str(acct.toLabel, 'utf-8')), toAddress, acct.toLabel),
MessageList_AddressWidget( MessageList_AddressWidget(
fromAddress, str(acct.fromLabel, 'utf-8')), fromAddress, acct.fromLabel),
MessageList_SubjectWidget( MessageList_SubjectWidget(
str(subject), str(acct.subject, 'utf-8', 'replace')), subject, acct.subject),
MessageList_TimeWidget( MessageList_TimeWidget(
statusText, False, lastactiontime, ackdata)] statusText, False, lastactiontime, ackdata)]
self.addMessageListItem(tableWidget, items) self.addMessageListItem(tableWidget, items)
@ -1133,11 +1133,11 @@ class MyForm(settingsmixin.SMainWindow):
items = [ items = [
MessageList_AddressWidget( MessageList_AddressWidget(
toAddress, str(acct.toLabel, 'utf-8'), not read), toAddress, acct.toLabel, not read),
MessageList_AddressWidget( MessageList_AddressWidget(
fromAddress, str(acct.fromLabel, 'utf-8'), not read), fromAddress, acct.fromLabel, not read),
MessageList_SubjectWidget( MessageList_SubjectWidget(
str(subject), str(acct.subject, 'utf-8', 'replace'), subject, acct.subject,
not read), not read),
MessageList_TimeWidget( MessageList_TimeWidget(
l10n.formatTimestamp(received), not read, received, msgid) l10n.formatTimestamp(received), not read, received, msgid)
@ -1168,7 +1168,7 @@ class MyForm(settingsmixin.SMainWindow):
self.addMessageListItemSent(tableWidget, *row) self.addMessageListItemSent(tableWidget, *row)
tableWidget.horizontalHeader().setSortIndicator( tableWidget.horizontalHeader().setSortIndicator(
3, QtCore.Qt.DescendingOrder) 3, QtCore.Qt.SortOrder.DescendingOrder)
tableWidget.setSortingEnabled(True) tableWidget.setSortingEnabled(True)
tableWidget.horizontalHeaderItem(3).setText( tableWidget.horizontalHeaderItem(3).setText(
_translate("MainWindow", "Sent")) _translate("MainWindow", "Sent"))
@ -1211,7 +1211,7 @@ class MyForm(settingsmixin.SMainWindow):
msgid, received, read) msgid, received, read)
tableWidget.horizontalHeader().setSortIndicator( tableWidget.horizontalHeader().setSortIndicator(
3, QtCore.Qt.DescendingOrder) 3, QtCore.Qt.SortOrder.DescendingOrder)
tableWidget.setSortingEnabled(True) tableWidget.setSortingEnabled(True)
tableWidget.selectRow(0) tableWidget.selectRow(0)
tableWidget.horizontalHeaderItem(3).setText( tableWidget.horizontalHeaderItem(3).setText(
@ -1431,7 +1431,7 @@ class MyForm(settingsmixin.SMainWindow):
if event.key() == QtCore.Qt.Key_Delete: if event.key() == QtCore.Qt.Key_Delete:
self.on_action_AddressBookDelete() self.on_action_AddressBookDelete()
else: else:
return QtGui.QTableWidget.keyPressEvent( return QtWidgets.QTableWidget.keyPressEvent(
self.ui.tableWidgetAddressBook, event) self.ui.tableWidgetAddressBook, event)
# inbox / sent # inbox / sent
@ -1446,14 +1446,14 @@ class MyForm(settingsmixin.SMainWindow):
"""This method handles keypress events for all widgets on MyForm""" """This method handles keypress events for all widgets on MyForm"""
messagelist = self.getCurrentMessagelist() messagelist = self.getCurrentMessagelist()
if event.key() == QtCore.Qt.Key_Delete: if event.key() == QtCore.Qt.Key_Delete:
if isinstance(focus, (MessageView, QtGui.QTableWidget)): if isinstance(focus, (MessageView, QtWidgets.QTableWidget)):
folder = self.getCurrentFolder() folder = self.getCurrentFolder()
if folder == "sent": if folder == "sent":
self.on_action_SentTrash() self.on_action_SentTrash()
else: else:
self.on_action_InboxTrash() self.on_action_InboxTrash()
event.ignore() event.ignore()
elif QtGui.QApplication.queryKeyboardModifiers() == QtCore.Qt.NoModifier: elif QtWidgets.QApplication.queryKeyboardModifiers() == QtCore.Qt.NoModifier:
if event.key() == QtCore.Qt.Key_N: if event.key() == QtCore.Qt.Key_N:
currentRow = messagelist.currentRow() currentRow = messagelist.currentRow()
if currentRow < messagelist.rowCount() - 1: if currentRow < messagelist.rowCount() - 1:
@ -1492,20 +1492,20 @@ class MyForm(settingsmixin.SMainWindow):
return return
if isinstance(focus, MessageView): if isinstance(focus, MessageView):
return MessageView.keyPressEvent(focus, event) return MessageView.keyPressEvent(focus, event)
if isinstance(focus, QtGui.QTableWidget): if isinstance(focus, QtWidgets.QTableWidget):
return QtGui.QTableWidget.keyPressEvent(focus, event) return QtWidgets.QTableWidget.keyPressEvent(focus, event)
if isinstance(focus, QtGui.QTreeWidget): if isinstance(focus, QtWidgets.QTreeWidget):
return QtGui.QTreeWidget.keyPressEvent(focus, event) return QtWidgets.QTreeWidget.keyPressEvent(focus, event)
# menu button 'manage keys' # menu button 'manage keys'
def click_actionManageKeys(self): def click_actionManageKeys(self):
if 'darwin' in sys.platform or 'linux' in sys.platform: if 'darwin' in sys.platform or 'linux' in sys.platform:
if state.appdata == '': 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 # may manage your keys by editing the keys.dat file stored in
# the same directory as this program. It is important that you # the same directory as this program. It is important that you
# back up this file.', QMessageBox.StandardButton.Ok) # back up this file.', QMessageBox.StandardButton.Ok)
reply = QtGui.QMessageBox.information( reply = QtWidgets.QMessageBox.information(
self, self,
'keys.dat?', 'keys.dat?',
_translate( _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" "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." "as this program. It is important that you back up this file."
), ),
QtGui.QMessageBox.StandardButton.Ok) QtWidgets.QMessageBox.StandardButton.Ok)
else: else:
QtGui.QMessageBox.information( QtWidgets.QMessageBox.information(
self, self,
'keys.dat?', 'keys.dat?',
_translate( _translate(
@ -1525,10 +1525,10 @@ class MyForm(settingsmixin.SMainWindow):
"\n {0} \n" "\n {0} \n"
"It is important that you back up this file." "It is important that you back up this file."
).format(state.appdata), ).format(state.appdata),
QtGui.QMessageBox.StandardButton.Ok) QtWidgets.QMessageBox.StandardButton.Ok)
elif sys.platform == 'win32' or sys.platform == 'win64': elif sys.platform == 'win32' or sys.platform == 'win64':
if state.appdata == '': if state.appdata == '':
reply = QtGui.QMessageBox.question( reply = QtWidgets.QMessageBox.question(
self, self,
_translate("MainWindow", "Open keys.dat?"), _translate("MainWindow", "Open keys.dat?"),
_translate( _translate(
@ -1537,10 +1537,10 @@ class MyForm(settingsmixin.SMainWindow):
"this program. It is important that you back up this file. " "this program. It is important that you back up this file. "
"Would you like to open the file now? " "Would you like to open the file now? "
"(Be sure to close Bitmessage before making any changes.)"), "(Be sure to close Bitmessage before making any changes.)"),
QtGui.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.Yes,
QtGui.QMessageBox.StandardButton.No) QtWidgets.QMessageBox.StandardButton.No)
else: else:
reply = QtGui.QMessageBox.question( reply = QtWidgets.QMessageBox.question(
self, self,
_translate("MainWindow", "Open keys.dat?"), _translate("MainWindow", "Open keys.dat?"),
_translate( _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" "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?" "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), "(Be sure to close Bitmessage before making any changes.)").format(state.appdata),
QtGui.QMessageBox.StandardButton.Yes, QtGui.QMessageBox.StandardButton.No) QtWidgets.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.No)
if reply == QtGui.QMessageBox.StandardButton.Yes: if reply == QtWidgets.QMessageBox.StandardButton.Yes:
openKeysFile() openKeysFile()
# menu button 'delete all treshed messages' # menu button 'delete all treshed messages'
def click_actionDeleteAllTrashedMessages(self): def click_actionDeleteAllTrashedMessages(self):
if QtGui.QMessageBox.question( if QtWidgets.QMessageBox.question(
self, self,
_translate("MainWindow", "Delete trash?"), _translate("MainWindow", "Delete trash?"),
_translate("MainWindow", "Are you sure you want to delete all trashed messages?"), _translate("MainWindow", "Are you sure you want to delete all trashed messages?"),
QtGui.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.Yes,
QtGui.QMessageBox.StandardButton.No) == QtGui.QMessageBox.StandardButton.No: QtWidgets.QMessageBox.StandardButton.No) == QtWidgets.QMessageBox.StandardButton.No:
return return
sqlStoredProcedure('deleteandvacuume') sqlStoredProcedure('deleteandvacuume')
self.rerenderTabTreeMessages() self.rerenderTabTreeMessages()
@ -1584,9 +1584,9 @@ class MyForm(settingsmixin.SMainWindow):
# menu button 'regenerate deterministic addresses' # menu button 'regenerate deterministic addresses'
def click_actionRegenerateDeterministicAddresses(self): def click_actionRegenerateDeterministicAddresses(self):
dialog = dialogs.RegenerateAddressesDialog(self) dialog = dialogs.RegenerateAddressesDialog(self)
if dialog.exec_(): if dialog.exec():
if dialog.lineEditPassphrase.text() == "": if dialog.lineEditPassphrase.text() == "":
QtGui.QMessageBox.about( QtWidgets.QMessageBox.about(
self, _translate("MainWindow", "bad passphrase"), self, _translate("MainWindow", "bad passphrase"),
_translate( _translate(
"MainWindow", "MainWindow",
@ -1599,7 +1599,7 @@ class MyForm(settingsmixin.SMainWindow):
addressVersionNumber = int( addressVersionNumber = int(
dialog.lineEditAddressVersionNumber.text()) dialog.lineEditAddressVersionNumber.text())
except: except:
QtGui.QMessageBox.about( QtWidgets.QMessageBox.about(
self, self,
_translate("MainWindow", "Bad address version number"), _translate("MainWindow", "Bad address version number"),
_translate( _translate(
@ -1609,7 +1609,7 @@ class MyForm(settingsmixin.SMainWindow):
)) ))
return return
if addressVersionNumber < 3 or addressVersionNumber > 4: if addressVersionNumber < 3 or addressVersionNumber > 4:
QtGui.QMessageBox.about( QtWidgets.QMessageBox.about(
self, self,
_translate("MainWindow", "Bad address version number"), _translate("MainWindow", "Bad address version number"),
_translate( _translate(
@ -1622,7 +1622,7 @@ class MyForm(settingsmixin.SMainWindow):
addressVersionNumber, streamNumberForAddress, addressVersionNumber, streamNumberForAddress,
"regenerated deterministic address", "regenerated deterministic address",
dialog.spinBoxNumberOfAddressesToMake.value(), dialog.spinBoxNumberOfAddressesToMake.value(),
dialog.lineEditPassphrase.text().toUtf8(), dialog.lineEditPassphrase.text(),
dialog.checkBoxEighteenByteRipe.isChecked() dialog.checkBoxEighteenByteRipe.isChecked()
)) ))
self.ui.tabWidget.setCurrentIndex( self.ui.tabWidget.setCurrentIndex(
@ -1648,7 +1648,7 @@ class MyForm(settingsmixin.SMainWindow):
def showMigrationWizard(self, level): def showMigrationWizard(self, level):
self.migrationWizardInstance = Ui_MigrationWizard(["a"]) self.migrationWizardInstance = Ui_MigrationWizard(["a"])
if self.migrationWizardInstance.exec_(): if self.migrationWizardInstance.exec():
pass pass
else: else:
pass pass
@ -1673,7 +1673,7 @@ class MyForm(settingsmixin.SMainWindow):
pass pass
def __icon_activated(self, reason): def __icon_activated(self, reason):
if reason == QtGui.QSystemTrayIcon.Trigger: if reason == QtWidgets.QSystemTrayIcon.Trigger:
self.actionShow.setChecked(not self.actionShow.isChecked()) self.actionShow.setChecked(not self.actionShow.isChecked())
self.appIndicatorShowOrHideWindow() self.appIndicatorShowOrHideWindow()
@ -1775,8 +1775,9 @@ class MyForm(settingsmixin.SMainWindow):
# draw text # draw text
painter = QtGui.QPainter() painter = QtGui.QPainter()
painter.begin(pixmap) painter.begin(pixmap)
painter.setPen( pen = QtGui.QPen(QtGui.QColor(255, 0, 0))
QtGui.QPen(QtGui.QColor(255, 0, 0), QtCore.Qt.SolidPattern)) pen.setBrush(QtGui.QBrush(QtCore.Qt.BrushStyle.SolidPattern))
painter.setPen(pen)
painter.setFont(font) painter.setFont(font)
painter.drawText(24-rect.right()-marginX, -rect.top()+marginY, txt) painter.drawText(24-rect.right()-marginX, -rect.top()+marginY, txt)
painter.end() painter.end()
@ -1819,7 +1820,7 @@ class MyForm(settingsmixin.SMainWindow):
continue continue
for i in range(sent.rowCount()): 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: if toAddress == rowAddress:
sent.item(i, 3).setToolTip(textToDisplay) sent.item(i, 3).setToolTip(textToDisplay)
try: try:
@ -1846,7 +1847,7 @@ class MyForm(settingsmixin.SMainWindow):
if self.getCurrentFolder(treeWidget) != "sent": if self.getCurrentFolder(treeWidget) != "sent":
continue continue
for i in range(sent.rowCount()): 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() tableAckdata = sent.item(i, 3).data()
status, addressVersionNumber, streamNumber, ripe = decodeAddress( status, addressVersionNumber, streamNumber, ripe = decodeAddress(
toAddress) toAddress)
@ -1897,7 +1898,7 @@ class MyForm(settingsmixin.SMainWindow):
def displayAlert(self, title, text, exitAfterUserClicksOk): def displayAlert(self, title, text, exitAfterUserClicksOk):
self.updateStatusBar(text) 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: if exitAfterUserClicksOk:
os._exit(0) os._exit(0)
@ -1973,7 +1974,7 @@ class MyForm(settingsmixin.SMainWindow):
self.rerenderTabTreeSubscriptions() self.rerenderTabTreeSubscriptions()
def click_pushButtonTTL(self): def click_pushButtonTTL(self):
QtGui.QMessageBox.information( QtWidgets.QMessageBox.information(
self, self,
'Time To Live', 'Time To Live',
_translate( _translate(
@ -1982,16 +1983,20 @@ class MyForm(settingsmixin.SMainWindow):
,it will resend the message automatically. The longer the Time-To-Live, the ,it will resend the message automatically. The longer the Time-To-Live, the
more work your computer must do to send the message. more work your computer must do to send the message.
A Time-To-Live of four or five days is often appropriate."""), A Time-To-Live of four or five days is often appropriate."""),
QtGui.QMessageBox.StandardButton.Ok) QtWidgets.QMessageBox.StandardButton.Ok)
def click_pushButtonClear(self): def click_pushButtonClear(self):
self.ui.lineEditSubject.setText("") self.ui.lineEditSubject.setText("")
self.ui.lineEditTo.setText("") self.ui.lineEditTo.setText("")
self.ui.textEditMessage.reset() self.ui.textEditMessage.clear()
self.ui.comboBoxSendFrom.setCurrentIndex(0) self.ui.comboBoxSendFrom.setCurrentIndex(0)
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0)
self.ui.lineEditSubjectBroadcast.setText('')
self.ui.textEditMessageBroadcast.clear()
def click_pushButtonSend(self): 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() self.statusbar.clearMessage()
@ -1999,22 +2004,20 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.tabWidgetSend.indexOf(self.ui.sendDirect): self.ui.tabWidgetSend.indexOf(self.ui.sendDirect):
# message to specific people # message to specific people
sendMessageToPeople = True sendMessageToPeople = True
fromAddress = str(self.ui.comboBoxSendFrom.itemData( fromAddress = self.ui.comboBoxSendFrom.itemData(
self.ui.comboBoxSendFrom.currentIndex(), self.ui.comboBoxSendFrom.currentIndex(),
QtCore.Qt.UserRole).toString()) QtCore.Qt.ItemDataRole.UserRole)
toAddresses = str(self.ui.lineEditTo.text().toUtf8()) toAddresses = self.ui.lineEditTo.text()
subject = str(self.ui.lineEditSubject.text().toUtf8()) subject = self.ui.lineEditSubject.text()
message = str( message = self.ui.textEditMessage.document().toPlainText()
self.ui.textEditMessage.document().toPlainText().toUtf8())
else: else:
# broadcast message # broadcast message
sendMessageToPeople = False sendMessageToPeople = False
fromAddress = str(self.ui.comboBoxSendFromBroadcast.itemData( fromAddress = self.ui.comboBoxSendFromBroadcast.itemData(
self.ui.comboBoxSendFromBroadcast.currentIndex(), self.ui.comboBoxSendFromBroadcast.currentIndex(),
QtCore.Qt.UserRole).toString()) QtCore.Qt.ItemDataRole.UserRole)
subject = str(self.ui.lineEditSubjectBroadcast.text().toUtf8()) subject = self.ui.lineEditSubjectBroadcast.text()
message = str( message = self.ui.textEditMessageBroadcast.document().toPlainText()
self.ui.textEditMessageBroadcast.document().toPlainText().toUtf8())
""" """
The whole network message must fit in 2^18 bytes. The whole network message must fit in 2^18 bytes.
Let's assume 500 bytes of overhead. If someone wants to get that 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. users can send messages of any length.
""" """
if len(message) > (2 ** 18 - 500): if len(message) > (2 ** 18 - 500):
QtGui.QMessageBox.about( QtWidgets.QMessageBox.about(
self, _translate("MainWindow", "Message too long"), self, _translate("MainWindow", "Message too long"),
_translate( _translate(
"MainWindow", "MainWindow",
@ -2055,14 +2058,14 @@ class MyForm(settingsmixin.SMainWindow):
subject = acct.subject subject = acct.subject
toAddress = acct.toAddress toAddress = acct.toAddress
else: else:
if QtGui.QMessageBox.question( if QtWidgets.QMessageBox.question(
self, self,
"Sending an email?", "Sending an email?",
_translate( _translate(
"MainWindow", "MainWindow",
"You are trying to send an email instead of a bitmessage. " "You are trying to send an email instead of a bitmessage. "
"This requires registering with a gateway. Attempt to register?"), "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 continue
email = acct.getLabel() email = acct.getLabel()
if email[-14:] != "@mailchuck.com": # attempt register if email[-14:] != "@mailchuck.com": # attempt register
@ -2087,7 +2090,7 @@ class MyForm(settingsmixin.SMainWindow):
status, addressVersionNumber, streamNumber = decodeAddress(toAddress)[:3] status, addressVersionNumber, streamNumber = decodeAddress(toAddress)[:3]
if status != 'success': if status != 'success':
try: try:
toAddress = str(toAddress, 'utf-8', 'ignore') toAddress = toAddress
except: except:
pass pass
logger.error('Error: Could not decode recipient address ' + toAddress + ':' + status) logger.error('Error: Could not decode recipient address ' + toAddress + ':' + status)
@ -2159,7 +2162,7 @@ class MyForm(settingsmixin.SMainWindow):
toAddress = addBMIfNotPresent(toAddress) toAddress = addBMIfNotPresent(toAddress)
if addressVersionNumber > 4 or addressVersionNumber <= 1: if addressVersionNumber > 4 or addressVersionNumber <= 1:
QtGui.QMessageBox.about( QtWidgets.QMessageBox.about(
self, self,
_translate("MainWindow", "Address version number"), _translate("MainWindow", "Address version number"),
_translate( _translate(
@ -2169,7 +2172,7 @@ class MyForm(settingsmixin.SMainWindow):
).format(toAddress, str(addressVersionNumber))) ).format(toAddress, str(addressVersionNumber)))
continue continue
if streamNumber > 1 or streamNumber == 0: if streamNumber > 1 or streamNumber == 0:
QtGui.QMessageBox.about( QtWidgets.QMessageBox.about(
self, self,
_translate("MainWindow", "Stream number"), _translate("MainWindow", "Stream number"),
_translate( _translate(
@ -2240,7 +2243,7 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0) self.ui.comboBoxSendFromBroadcast.setCurrentIndex(0)
self.ui.lineEditSubjectBroadcast.setText('') self.ui.lineEditSubjectBroadcast.setText('')
self.ui.textEditMessageBroadcast.reset() self.ui.textEditMessageBroadcast.clear()
self.ui.tabWidget.setCurrentIndex( self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send) self.ui.tabWidget.indexOf(self.ui.send)
) )
@ -2261,7 +2264,7 @@ class MyForm(settingsmixin.SMainWindow):
)) ))
def click_pushButtonFetchNamecoinID(self): 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()) err, addr = self.namecoin.query(identities[-1].strip())
if err is not None: if err is not None:
self.updateStatusBar( self.updateStatusBar(
@ -2291,17 +2294,17 @@ class MyForm(settingsmixin.SMainWindow):
addressInKeysFile, 'enabled') addressInKeysFile, 'enabled')
isMaillinglist = config.safeGetBoolean(addressInKeysFile, 'mailinglist') isMaillinglist = config.safeGetBoolean(addressInKeysFile, 'mailinglist')
if isEnabled and not isMaillinglist: if isEnabled and not isMaillinglist:
label = str(config.get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip() label = config.get(addressInKeysFile, 'label').strip()
if label == "": if label == "":
label = addressInKeysFile label = addressInKeysFile
self.ui.comboBoxSendFrom.addItem(avatarize(addressInKeysFile), label, addressInKeysFile) self.ui.comboBoxSendFrom.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
# self.ui.comboBoxSendFrom.model().sort(1, QtCore.Qt.SortOrder.AscendingOrder) # self.ui.comboBoxSendFrom.model().sort(1, QtCore.Qt.SortOrder.AscendingOrder)
for i in range(self.ui.comboBoxSendFrom.count()): for i in range(self.ui.comboBoxSendFrom.count()):
address = str(self.ui.comboBoxSendFrom.itemData( address = self.ui.comboBoxSendFrom.itemData(
i, QtCore.Qt.UserRole).toString()) i, QtCore.Qt.ItemDataRole.UserRole)
self.ui.comboBoxSendFrom.setItemData( self.ui.comboBoxSendFrom.setItemData(
i, AccountColor(address).accountColor(), i, AccountColor(address).accountColor(),
QtCore.Qt.ForegroundRole) QtCore.Qt.ItemDataRole.ForegroundRole)
self.ui.comboBoxSendFrom.insertItem(0, '', '') self.ui.comboBoxSendFrom.insertItem(0, '', '')
if(self.ui.comboBoxSendFrom.count() == 2): if(self.ui.comboBoxSendFrom.count() == 2):
self.ui.comboBoxSendFrom.setCurrentIndex(1) self.ui.comboBoxSendFrom.setCurrentIndex(1)
@ -2315,16 +2318,16 @@ class MyForm(settingsmixin.SMainWindow):
addressInKeysFile, 'enabled') addressInKeysFile, 'enabled')
isChan = config.safeGetBoolean(addressInKeysFile, 'chan') isChan = config.safeGetBoolean(addressInKeysFile, 'chan')
if isEnabled and not isChan: if isEnabled and not isChan:
label = str(config.get(addressInKeysFile, 'label'), 'utf-8', 'ignore').strip() label = config.get(addressInKeysFile, 'label').strip()
if label == "": if label == "":
label = addressInKeysFile label = addressInKeysFile
self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), label, addressInKeysFile) self.ui.comboBoxSendFromBroadcast.addItem(avatarize(addressInKeysFile), label, addressInKeysFile)
for i in range(self.ui.comboBoxSendFromBroadcast.count()): for i in range(self.ui.comboBoxSendFromBroadcast.count()):
address = str(self.ui.comboBoxSendFromBroadcast.itemData( address = self.ui.comboBoxSendFromBroadcast.itemData(
i, QtCore.Qt.UserRole).toString()) i, QtCore.Qt.ItemDataRole.UserRole)
self.ui.comboBoxSendFromBroadcast.setItemData( self.ui.comboBoxSendFromBroadcast.setItemData(
i, AccountColor(address).accountColor(), i, AccountColor(address).accountColor(),
QtCore.Qt.ForegroundRole) QtCore.Qt.ItemDataRole.ForegroundRole)
self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '') self.ui.comboBoxSendFromBroadcast.insertItem(0, '', '')
if(self.ui.comboBoxSendFromBroadcast.count() == 2): if(self.ui.comboBoxSendFromBroadcast.count() == 2):
self.ui.comboBoxSendFromBroadcast.setCurrentIndex(1) self.ui.comboBoxSendFromBroadcast.setCurrentIndex(1)
@ -2421,7 +2424,7 @@ class MyForm(settingsmixin.SMainWindow):
self.notifierShow( self.notifierShow(
_translate("MainWindow", "New Message"), _translate("MainWindow", "New Message"),
_translate("MainWindow", "From {0}").format( _translate("MainWindow", "From {0}").format(
str(acct.fromLabel, 'utf-8')), acct.fromLabel),
sound.SOUND_UNKNOWN sound.SOUND_UNKNOWN
) )
if self.getCurrentAccount() is not None and ( 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.ALL_OK:
if acct.feedback == GatewayAccount.REGISTRATION_DENIED: if acct.feedback == GatewayAccount.REGISTRATION_DENIED:
dialogs.EmailGatewayDialog( dialogs.EmailGatewayDialog(
self, config, acct).exec_() self, config, acct).exec()
# possible other branches? # possible other branches?
except AttributeError: except AttributeError:
pass pass
@ -2444,7 +2447,7 @@ class MyForm(settingsmixin.SMainWindow):
def click_pushButtonAddAddressBook(self, dialog=None): def click_pushButtonAddAddressBook(self, dialog=None):
if not dialog: if not dialog:
dialog = dialogs.AddAddressDialog(self) dialog = dialogs.AddAddressDialog(self)
dialog.exec_() dialog.exec()
try: try:
address, label = dialog.data address, label = dialog.data
except AttributeError: except AttributeError:
@ -2489,7 +2492,7 @@ class MyForm(settingsmixin.SMainWindow):
def click_pushButtonAddSubscription(self): def click_pushButtonAddSubscription(self):
dialog = dialogs.NewSubscriptionDialog(self) dialog = dialogs.NewSubscriptionDialog(self)
dialog.exec_() dialog.exec()
try: try:
address, label = dialog.data address, label = dialog.data
except AttributeError: except AttributeError:
@ -2518,19 +2521,19 @@ class MyForm(settingsmixin.SMainWindow):
)) ))
def click_pushButtonStatusIcon(self): def click_pushButtonStatusIcon(self):
dialogs.IconGlossaryDialog(self, config=config).exec_() dialogs.IconGlossaryDialog(self, config=config).exec()
def click_actionHelp(self): def click_actionHelp(self):
dialogs.HelpDialog(self).exec_() dialogs.HelpDialog(self).exec()
def click_actionSupport(self): def click_actionSupport(self):
support.createSupportMessage(self) support.createSupportMessage(self)
def click_actionAbout(self): def click_actionAbout(self):
dialogs.AboutDialog(self).exec_() dialogs.AboutDialog(self).exec()
def click_actionSettings(self): def click_actionSettings(self):
dialogs.SettingsDialog(self, firstrun=self._firstrun).exec_() dialogs.SettingsDialog(self, firstrun=self._firstrun).exec()
def on_action_Send(self): def on_action_Send(self):
"""Send message to current selected address""" """Send message to current selected address"""
@ -2550,7 +2553,7 @@ class MyForm(settingsmixin.SMainWindow):
def on_action_EmailGatewayDialog(self): def on_action_EmailGatewayDialog(self):
dialog = dialogs.EmailGatewayDialog(self, config=config) dialog = dialogs.EmailGatewayDialog(self, config=config)
# For Modal dialogs # For Modal dialogs
dialog.exec_() dialog.exec()
try: try:
acct = dialog.data acct = dialog.data
except AttributeError: except AttributeError:
@ -2578,13 +2581,13 @@ class MyForm(settingsmixin.SMainWindow):
self.ui.textEditMessage.setFocus() self.ui.textEditMessage.setFocus()
def on_action_MarkAllRead(self): def on_action_MarkAllRead(self):
if QtGui.QMessageBox.question( if QtWidgets.QMessageBox.question(
self, "Marking all messages as read?", self, "Marking all messages as read?",
_translate( _translate(
"MainWindow", "MainWindow",
"Are you sure you would like to mark all messages read?" "Are you sure you would like to mark all messages read?"
), QtGui.QMessageBox.StandardButton.Yes | QtGui.QMessageBox.StandardButton.No ), QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No
) != QtGui.QMessageBox.StandardButton.Yes: ) != QtWidgets.QMessageBox.StandardButton.Yes:
return return
tableWidget = self.getCurrentMessagelist() tableWidget = self.getCurrentMessagelist()
@ -2857,7 +2860,7 @@ class MyForm(settingsmixin.SMainWindow):
lines[i] = '<br><br>' lines[i] = '<br><br>'
content = ' '.join(lines) # To keep the whitespace between lines content = ' '.join(lines) # To keep the whitespace between lines
content = shared.fixPotentiallyInvalidUTF8Data(content) content = shared.fixPotentiallyInvalidUTF8Data(content)
content = str(content, 'utf-8)') content = content
textEdit.setHtml(QtCore.QString(content)) textEdit.setHtml(QtCore.QString(content))
def on_action_InboxMarkUnread(self): def on_action_InboxMarkUnread(self):
@ -3040,7 +3043,7 @@ class MyForm(settingsmixin.SMainWindow):
self.setSendFromComboBox(toAddressAtCurrentInboxRow) self.setSendFromComboBox(toAddressAtCurrentInboxRow)
quotedText = self.quoted_text( quotedText = self.quoted_text(
str(messageAtCurrentInboxRow, 'utf-8', 'replace')) messageAtCurrentInboxRow)
widget['message'].setPlainText(quotedText) widget['message'].setPlainText(quotedText)
if acct.subject[0:3] in ('Re:', 'RE:'): if acct.subject[0:3] in ('Re:', 'RE:'):
widget['subject'].setText( widget['subject'].setText(
@ -3059,7 +3062,7 @@ class MyForm(settingsmixin.SMainWindow):
return return
currentInboxRow = tableWidget.currentRow() currentInboxRow = tableWidget.currentRow()
addressAtCurrentInboxRow = tableWidget.item( addressAtCurrentInboxRow = tableWidget.item(
currentInboxRow, 1).data(QtCore.Qt.UserRole) currentInboxRow, 1).data(QtCore.Qt.ItemDataRole.UserRole)
self.ui.tabWidget.setCurrentIndex( self.ui.tabWidget.setCurrentIndex(
self.ui.tabWidget.indexOf(self.ui.send) self.ui.tabWidget.indexOf(self.ui.send)
) )
@ -3072,9 +3075,9 @@ class MyForm(settingsmixin.SMainWindow):
return return
currentInboxRow = tableWidget.currentRow() currentInboxRow = tableWidget.currentRow()
addressAtCurrentInboxRow = tableWidget.item( addressAtCurrentInboxRow = tableWidget.item(
currentInboxRow, 1).data(QtCore.Qt.UserRole) currentInboxRow, 1).data(QtCore.Qt.ItemDataRole.UserRole)
recipientAddress = tableWidget.item( 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 # Let's make sure that it isn't already in the address book
queryreturn = sqlQuery('''select * from blacklist where address=?''', queryreturn = sqlQuery('''select * from blacklist where address=?''',
addressAtCurrentInboxRow) addressAtCurrentInboxRow)
@ -3186,7 +3189,7 @@ class MyForm(settingsmixin.SMainWindow):
currentInboxRow = tableWidget.currentRow() currentInboxRow = tableWidget.currentRow()
try: try:
subjectAtCurrentInboxRow = str(tableWidget.item( subjectAtCurrentInboxRow = str(tableWidget.item(
currentInboxRow, 2).data(QtCore.Qt.UserRole)) currentInboxRow, 2).data(QtCore.Qt.ItemDataRole.UserRole))
except: except:
subjectAtCurrentInboxRow = '' subjectAtCurrentInboxRow = ''
@ -3240,7 +3243,7 @@ class MyForm(settingsmixin.SMainWindow):
def on_action_ForceSend(self): def on_action_ForceSend(self):
currentRow = self.ui.tableWidgetInbox.currentRow() currentRow = self.ui.tableWidgetInbox.currentRow()
addressAtCurrentRow = self.ui.tableWidgetInbox.item( addressAtCurrentRow = self.ui.tableWidgetInbox.item(
currentRow, 0).data(QtCore.Qt.UserRole) currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole)
toRipe = decodeAddress(addressAtCurrentRow)[3] toRipe = decodeAddress(addressAtCurrentRow)[3]
sqlExecute( sqlExecute(
'''UPDATE sent SET status='forcepow' WHERE toripe=? AND status='toodifficult' and folder='sent' ''', '''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): def on_action_SentClipboard(self):
currentRow = self.ui.tableWidgetInbox.currentRow() currentRow = self.ui.tableWidgetInbox.currentRow()
addressAtCurrentRow = self.ui.tableWidgetInbox.item( addressAtCurrentRow = self.ui.tableWidgetInbox.item(
currentRow, 0).data(QtCore.Qt.UserRole) currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole)
clipboard = QtWidgets.QApplication.clipboard() clipboard = QtWidgets.QApplication.clipboard()
clipboard.setText(str(addressAtCurrentRow)) clipboard.setText(str(addressAtCurrentRow))
@ -3291,8 +3294,7 @@ class MyForm(settingsmixin.SMainWindow):
return self.updateStatusBar(_translate( return self.updateStatusBar(_translate(
"MainWindow", "No addresses selected.")) "MainWindow", "No addresses selected."))
addresses_string = str( addresses_string = self.ui.lineEditTo.text()
self.ui.lineEditTo.text().toUtf8(), 'utf-8')
for item in selected_items: for item in selected_items:
address_string = item.accountString() address_string = item.accountString()
if not addresses_string: if not addresses_string:
@ -3345,7 +3347,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuAddressBook.addSeparator() self.popMenuAddressBook.addSeparator()
for plugin in self.menu_plugins['address']: for plugin in self.menu_plugins['address']:
self.popMenuAddressBook.addAction(plugin) self.popMenuAddressBook.addAction(plugin)
self.popMenuAddressBook.exec_( self.popMenuAddressBook.exec(
self.ui.tableWidgetAddressBook.mapToGlobal(point)) self.ui.tableWidgetAddressBook.mapToGlobal(point))
# Group of functions for the Subscriptions dialog box # Group of functions for the Subscriptions dialog box
@ -3426,7 +3428,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuSubscriptions.addAction(self.actionMarkAllRead) self.popMenuSubscriptions.addAction(self.actionMarkAllRead)
if self.popMenuSubscriptions.isEmpty(): if self.popMenuSubscriptions.isEmpty():
return return
self.popMenuSubscriptions.exec_( self.popMenuSubscriptions.exec(
self.ui.treeWidgetSubscriptions.mapToGlobal(point)) self.ui.treeWidgetSubscriptions.mapToGlobal(point))
def widgetConvert(self, widget): def widgetConvert(self, widget):
@ -3532,7 +3534,7 @@ class MyForm(settingsmixin.SMainWindow):
if currentIndex >= 0 and currentIndex < len(messagelistList): if currentIndex >= 0 and currentIndex < len(messagelistList):
return ( return (
messagelistList[currentIndex] if retObj messagelistList[currentIndex] if retObj
else messagelistList[currentIndex].text().toUtf8().data()) else messagelistList[currentIndex].text())
def getCurrentSearchOption(self, currentIndex=None): def getCurrentSearchOption(self, currentIndex=None):
if currentIndex is None: if currentIndex is None:
@ -3653,18 +3655,18 @@ class MyForm(settingsmixin.SMainWindow):
currentColumn = 0 if currentFolder == "sent" else 1 currentColumn = 0 if currentFolder == "sent" else 1
if currentFolder == "sent": if currentFolder == "sent":
myAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole) myAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.ItemDataRole.UserRole)
otherAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole) otherAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole)
else: else:
myAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole) myAddress = tableWidget.item(currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole)
otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole) otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.ItemDataRole.UserRole)
account = accountClass(myAddress) account = accountClass(myAddress)
if isinstance(account, GatewayAccount) and otherAddress == account.relayAddress and ( if isinstance(account, GatewayAccount) and otherAddress == account.relayAddress and (
(currentColumn in [0, 2] and self.getCurrentFolder() == "sent") or (currentColumn in [0, 2] and self.getCurrentFolder() == "sent") or
(currentColumn in [1, 2] and self.getCurrentFolder() != "sent")): (currentColumn in [1, 2] and self.getCurrentFolder() != "sent")):
text = str(tableWidget.item(currentRow, currentColumn).label) text = str(tableWidget.item(currentRow, currentColumn).label)
else: 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 = QtWidgets.QApplication.clipboard()
clipboard.setText(text) clipboard.setText(text)
@ -3849,7 +3851,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuYourIdentities.addAction(self.actionMarkAllRead) self.popMenuYourIdentities.addAction(self.actionMarkAllRead)
if self.popMenuYourIdentities.isEmpty(): if self.popMenuYourIdentities.isEmpty():
return return
self.popMenuYourIdentities.exec_( self.popMenuYourIdentities.exec(
self.ui.treeWidgetYourIdentities.mapToGlobal(point)) self.ui.treeWidgetYourIdentities.mapToGlobal(point))
# TODO make one popMenu # TODO make one popMenu
@ -3878,7 +3880,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenu.addAction(self.actionMarkAllRead) self.popMenu.addAction(self.actionMarkAllRead)
if self.popMenu.isEmpty(): if self.popMenu.isEmpty():
return return
self.popMenu.exec_( self.popMenu.exec(
self.ui.treeWidgetChans.mapToGlobal(point)) self.ui.treeWidgetChans.mapToGlobal(point))
def on_context_menuInbox(self, point): def on_context_menuInbox(self, point):
@ -3897,7 +3899,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuInbox.addSeparator() self.popMenuInbox.addSeparator()
currentRow = tableWidget.currentRow() currentRow = tableWidget.currentRow()
account = accountClass( account = accountClass(
tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole)) tableWidget.item(currentRow, 0).data(QtCore.Qt.ItemDataRole.UserRole))
if account.type == AccountMixin.CHAN: if account.type == AccountMixin.CHAN:
self.popMenuInbox.addAction(self.actionReplyChan) self.popMenuInbox.addAction(self.actionReplyChan)
@ -3922,7 +3924,7 @@ class MyForm(settingsmixin.SMainWindow):
self.popMenuInbox.addAction(self.actionUndeleteTrashedMessage) self.popMenuInbox.addAction(self.actionUndeleteTrashedMessage)
else: else:
self.popMenuInbox.addAction(self.actionTrashInboxMessage) self.popMenuInbox.addAction(self.actionTrashInboxMessage)
self.popMenuInbox.exec_(tableWidget.mapToGlobal(point)) self.popMenuInbox.exec(tableWidget.mapToGlobal(point))
def on_context_menuSent(self, point): def on_context_menuSent(self, point):
currentRow = self.ui.tableWidgetInbox.currentRow() currentRow = self.ui.tableWidgetInbox.currentRow()
@ -3946,11 +3948,11 @@ class MyForm(settingsmixin.SMainWindow):
if status == 'toodifficult': if status == 'toodifficult':
self.popMenuSent.addAction(self.actionForceSend) 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): def inboxSearchLineEditUpdated(self, text):
# dynamic search for too short text is slow # dynamic search for too short text is slow
text = text.toUtf8() text = text
if 0 < len(text) < 3: if 0 < len(text) < 3:
return return
messagelist = self.getCurrentMessagelist() messagelist = self.getCurrentMessagelist()
@ -4007,7 +4009,7 @@ class MyForm(settingsmixin.SMainWindow):
if item.type == AccountMixin.ALL: if item.type == AccountMixin.ALL:
return return
newLabel = str(item.text(0), 'utf-8', 'ignore') newLabel = item.text(0)
oldLabel = item.defaultLabel() oldLabel = item.defaultLabel()
# unchanged, do not do anything either # unchanged, do not do anything either

View File

@ -150,10 +150,7 @@ class BMAccount(object):
self.toAddress = toAddress self.toAddress = toAddress
self.fromAddress = fromAddress self.fromAddress = fromAddress
if isinstance(subject, unicode): self.subject = subject
self.subject = str(subject)
else:
self.subject = subject
self.message = message self.message = message
self.fromLabel = self.getLabel(fromAddress) self.fromLabel = self.getLabel(fromAddress)
self.toLabel = self.getLabel(toAddress) self.toLabel = self.getLabel(toAddress)

View File

@ -8,7 +8,7 @@ import hashlib
from PyQt6 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
import queues import queues
import bitmessageqt.widgets import bitmessageqt.widgets as widgets
import state import state
from .account import AccountMixin, GatewayAccount, MailchuckAccount, accountClass from .account import AccountMixin, GatewayAccount, MailchuckAccount, accountClass
from addresses import addBMIfNotPresent, decodeAddress, encodeVarint from addresses import addBMIfNotPresent, decodeAddress, encodeVarint
@ -21,10 +21,6 @@ class AddressCheckMixin(object):
def __init__(self): def __init__(self):
self.valid = False self.valid = False
QtCore.QObject.connect( # pylint: disable=no-member
self.lineEditAddress,
QtCore.SIGNAL("textChanged(QString)"),
self.addressChanged)
def _onSuccess(self, addressVersion, streamNumber, ripe): def _onSuccess(self, addressVersion, streamNumber, ripe):
pass pass
@ -90,8 +86,8 @@ class AddressDataDialog(QtWidgets.QDialog, AddressCheckMixin):
"""Callback for QDIalog accepting value""" """Callback for QDIalog accepting value"""
if self.valid: if self.valid:
self.data = ( self.data = (
addBMIfNotPresent(str(self.lineEditAddress.text())), addBMIfNotPresent(self.lineEditAddress.text()),
str(self.lineEditLabel.text().toUtf8()) self.lineEditLabel.text()
) )
else: else:
queues.UISignalQueue.put(('updateStatusBar', _translate( queues.UISignalQueue.put(('updateStatusBar', _translate(
@ -110,6 +106,7 @@ class AddAddressDialog(AddressDataDialog):
AddressCheckMixin.__init__(self) AddressCheckMixin.__init__(self)
if address: if address:
self.lineEditAddress.setText(address) self.lineEditAddress.setText(address)
self.lineEditAddress.textChanged.connect(self.addressChanged)
class NewAddressDialog(QtWidgets.QDialog): class NewAddressDialog(QtWidgets.QDialog):
@ -125,7 +122,7 @@ class NewAddressDialog(QtWidgets.QDialog):
self.radioButtonExisting.click() self.radioButtonExisting.click()
self.comboBoxExisting.addItem(address) self.comboBoxExisting.addItem(address)
self.groupBoxDeterministic.setHidden(True) self.groupBoxDeterministic.setHidden(True)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
self.show() self.show()
def accept(self): def accept(self):
@ -142,7 +139,7 @@ class NewAddressDialog(QtWidgets.QDialog):
self.comboBoxExisting.currentText())[2] self.comboBoxExisting.currentText())[2]
queues.addressGeneratorQueue.put(( queues.addressGeneratorQueue.put((
'createRandomAddress', 4, streamNumberForAddress, 'createRandomAddress', 4, streamNumberForAddress,
str(self.newaddresslabel.text().toUtf8()), 1, "", self.newaddresslabel.text(), 1, "",
self.checkBoxEighteenByteRipe.isChecked() self.checkBoxEighteenByteRipe.isChecked()
)) ))
else: else:
@ -169,7 +166,7 @@ class NewAddressDialog(QtWidgets.QDialog):
'createDeterministicAddresses', 4, streamNumberForAddress, 'createDeterministicAddresses', 4, streamNumberForAddress,
"unused deterministic address", "unused deterministic address",
self.spinBoxNumberOfAddressesToMake.value(), self.spinBoxNumberOfAddressesToMake.value(),
self.lineEditPassphrase.text().toUtf8(), self.lineEditPassphrase.text(),
self.checkBoxEighteenByteRipe.isChecked() self.checkBoxEighteenByteRipe.isChecked()
)) ))
@ -181,6 +178,7 @@ class NewSubscriptionDialog(AddressDataDialog):
super(NewSubscriptionDialog, self).__init__(parent) super(NewSubscriptionDialog, self).__init__(parent)
widgets.load('newsubscriptiondialog.ui', self) widgets.load('newsubscriptiondialog.ui', self)
AddressCheckMixin.__init__(self) AddressCheckMixin.__init__(self)
self.lineEditAddress.textChanged.connect(self.addressChanged)
def _onSuccess(self, addressVersion, streamNumber, ripe): def _onSuccess(self, addressVersion, streamNumber, ripe):
if addressVersion <= 3: if addressVersion <= 3:
@ -222,7 +220,7 @@ class RegenerateAddressesDialog(QtWidgets.QDialog):
super(RegenerateAddressesDialog, self).__init__(parent) super(RegenerateAddressesDialog, self).__init__(parent)
widgets.load('regenerateaddresses.ui', self) widgets.load('regenerateaddresses.ui', self)
self.groupBox.setTitle('') self.groupBox.setTitle('')
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
class SpecialAddressBehaviorDialog(QtWidgets.QDialog): class SpecialAddressBehaviorDialog(QtWidgets.QDialog):
@ -257,11 +255,9 @@ class SpecialAddressBehaviorDialog(QtWidgets.QDialog):
else: else:
self.radioButtonBehaveNormalAddress.click() self.radioButtonBehaveNormalAddress.click()
mailingListName = config.safeGet(self.address, 'mailinglistname', '') mailingListName = config.safeGet(self.address, 'mailinglistname', '')
self.lineEditMailingListName.setText( self.lineEditMailingListName.setText(mailingListName)
unicode(mailingListName, 'utf-8')
)
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
self.show() self.show()
def accept(self): def accept(self):
@ -281,7 +277,7 @@ class SpecialAddressBehaviorDialog(QtWidgets.QDialog):
else: else:
self.config.set(str(self.address), 'mailinglist', 'true') self.config.set(str(self.address), 'mailinglist', 'true')
self.config.set(str(self.address), 'mailinglistname', str( self.config.set(str(self.address), 'mailinglistname', str(
self.lineEditMailingListName.text().toUtf8())) self.lineEditMailingListName.text()))
self.parent.setCurrentItemColor( self.parent.setCurrentItemColor(
QtGui.QColor(137, 4, 177)) # magenta QtGui.QColor(137, 4, 177)) # magenta
self.parent.rerenderComboBoxSendFrom() self.parent.rerenderComboBoxSendFrom()
@ -329,7 +325,7 @@ class EmailGatewayDialog(QtWidgets.QDialog):
else: else:
self.acct = MailchuckAccount(address) self.acct = MailchuckAccount(address)
self.lineEditEmail.setFocus() self.lineEditEmail.setFocus()
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
def accept(self): def accept(self):
"""Accept callback""" """Accept callback"""
@ -343,7 +339,7 @@ class EmailGatewayDialog(QtWidgets.QDialog):
if self.radioButtonRegister.isChecked() \ if self.radioButtonRegister.isChecked() \
or self.radioButtonRegister.isHidden(): or self.radioButtonRegister.isHidden():
email = str(self.lineEditEmail.text().toUtf8()) email = self.lineEditEmail.text()
self.acct.register(email) self.acct.register(email)
self.config.set(self.acct.fromAddress, 'label', email) self.config.set(self.acct.fromAddress, 'label', email)
self.config.set(self.acct.fromAddress, 'gateway', 'mailchuck') self.config.set(self.acct.fromAddress, 'gateway', 'mailchuck')

View File

@ -5,7 +5,7 @@ Address validator module.
from queue import Empty from queue import Empty
from PyQt6 import QtGui from PyQt6 import QtGui, QtWidgets
from addresses import decodeAddress, addBMIfNotPresent from addresses import decodeAddress, addBMIfNotPresent
from bmconfigparser import config from bmconfigparser import config
@ -32,7 +32,7 @@ class AddressPassPhraseValidatorMixin(object):
self.addressMandatory = addressMandatory self.addressMandatory = addressMandatory
self.isValid = False self.isValid = False
# save default text # 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): def setError(self, string):
"""Indicate that the validation is pending or failed""" """Indicate that the validation is pending or failed"""
@ -44,12 +44,12 @@ class AddressPassPhraseValidatorMixin(object):
self.feedBackObject.setText(string) self.feedBackObject.setText(string)
self.isValid = False self.isValid = False
if self.buttonBox: 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: 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")) _translate("AddressValidator", "Invalid"))
else: else:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText( self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText(
_translate("AddressValidator", "Validating...")) _translate("AddressValidator", "Validating..."))
def setOK(self, string): def setOK(self, string):
@ -62,8 +62,8 @@ class AddressPassPhraseValidatorMixin(object):
self.feedBackObject.setText(string) self.feedBackObject.setText(string)
self.isValid = True self.isValid = True
if self.buttonBox: if self.buttonBox:
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setEnabled(True) self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setEnabled(True)
self.buttonBox.button(QtGui.QDialogButtonBox.Ok).setText(self.okButtonLabel) self.buttonBox.button(QtWidgets.QDialogButtonBox.StandardButton.Ok).setText(self.okButtonLabel)
def checkQueue(self): def checkQueue(self):
"""Validator queue loop""" """Validator queue loop"""
@ -87,47 +87,47 @@ class AddressPassPhraseValidatorMixin(object):
if not addressGeneratorReturnValue: if not addressGeneratorReturnValue:
self.setError(_translate("AddressValidator", "Address already present as one of your identities.")) 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': if addressGeneratorReturnValue[0] == 'chan name does not match address':
self.setError( self.setError(
_translate( _translate(
"AddressValidator", "AddressValidator",
"Although the Bitmessage address you " "Although the Bitmessage address you "
"entered was valid, it doesn't match the chan name.")) "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.")) self.setOK(_translate("MainWindow", "Passphrase and address appear to be valid."))
def returnValid(self): def returnValid(self):
"""Return the value of whether the validation was successful""" """Return the value of whether the validation was successful"""
if self.isValid: if self.isValid:
return QtGui.QValidator.Acceptable return QtGui.QValidator.State.Acceptable
return QtGui.QValidator.Intermediate return QtGui.QValidator.State.Intermediate
def validate(self, s, pos): def validate(self, s, pos):
"""Top level validator method""" """Top level validator method"""
if self.addressObject is None: if self.addressObject is None:
address = None address = None
else: else:
address = str(self.addressObject.text().toUtf8()) address = self.addressObject.text()
if address == "": if address == "":
address = None address = None
if self.passPhraseObject is None: if self.passPhraseObject is None:
passPhrase = "" passPhrase = ""
else: else:
passPhrase = str(self.passPhraseObject.text().toUtf8()) passPhrase = self.passPhraseObject.text()
if passPhrase == "": if passPhrase == "":
passPhrase = None passPhrase = None
# no chan name # no chan name
if passPhrase is None: if passPhrase is None:
self.setError(_translate("AddressValidator", "Chan name/passphrase needed. You didn't enter a chan name.")) 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: if self.addressMandatory or address is not None:
# check if address already exists: # check if address already exists:
if address in config.addresses(): if address in config.addresses():
self.setError(_translate("AddressValidator", "Address already present as one of your identities.")) 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 # version too high
if decodeAddress(address)[0] == 'versiontoohigh': if decodeAddress(address)[0] == 'versiontoohigh':
@ -138,29 +138,29 @@ class AddressPassPhraseValidatorMixin(object):
" address might be valid, its version number" " address might be valid, its version number"
" is too new for us to handle. Perhaps you need" " is too new for us to handle. Perhaps you need"
" to upgrade Bitmessage.")) " to upgrade Bitmessage."))
return (QtGui.QValidator.Intermediate, pos) return (QtGui.QValidator.State.Intermediate, pos)
# invalid # invalid
if decodeAddress(address)[0] != 'success': if decodeAddress(address)[0] != 'success':
self.setError(_translate("AddressValidator", "The Bitmessage address is not valid.")) 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 # this just disables the OK button without changing the feedback text
# but only if triggered by textEdited, not by clicking the Ok button # 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) self.setError(None)
# check through generator # check through generator
if address is None: 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: else:
addressGeneratorQueue.put( addressGeneratorQueue.put(
('joinChan', addBMIfNotPresent(address), ('joinChan', addBMIfNotPresent(address),
"{} {}".format(str_chan, passPhrase), passPhrase, False)) "{} {}".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 (self.returnValid(), pos)
return (QtGui.QValidator.Intermediate, pos) return (QtGui.QValidator.State.Intermediate, pos)
def checkData(self): def checkData(self):
"""Validator Qt signal interface""" """Validator Qt signal interface"""

View File

@ -10,6 +10,7 @@ from PyQt6 import QtCore, QtGui, QtWidgets
from bmconfigparser import config from bmconfigparser import config
from .foldertree import AddressBookCompleter from .foldertree import AddressBookCompleter
from .blacklist import Blacklist from .blacklist import Blacklist
import bitmessageqt.settingsmixin as settingsmixin
from .networkstatus import NetworkStatus from .networkstatus import NetworkStatus
class Ui_MainWindow(object): class Ui_MainWindow(object):
@ -164,41 +165,41 @@ class Ui_MainWindow(object):
self.verticalLayout.setObjectName("verticalLayout") self.verticalLayout.setObjectName("verticalLayout")
self.tabWidgetSend = QtWidgets.QTabWidget(parent=self.send) self.tabWidgetSend = QtWidgets.QTabWidget(parent=self.send)
self.tabWidgetSend.setObjectName("tabWidgetSend") self.tabWidgetSend.setObjectName("tabWidgetSend")
self.tab = QtWidgets.QWidget() self.sendDirect = QtWidgets.QWidget()
self.tab.setObjectName("tab") self.sendDirect.setObjectName("sendDirect")
self.gridLayout_8 = QtWidgets.QGridLayout(self.tab) self.gridLayout_8 = QtWidgets.QGridLayout(self.sendDirect)
self.gridLayout_8.setObjectName("gridLayout_8") self.gridLayout_8.setObjectName("gridLayout_8")
self.verticalLayout_5 = QtWidgets.QVBoxLayout() self.verticalLayout_5 = QtWidgets.QVBoxLayout()
self.verticalLayout_5.setObjectName("verticalLayout_5") self.verticalLayout_5.setObjectName("verticalLayout_5")
self.gridLayout_2 = QtWidgets.QGridLayout() self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2") 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.label_3.setObjectName("label_3")
self.gridLayout_2.addWidget(self.label_3, 2, 0, 1, 1) 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.label_2.setObjectName("label_2")
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1) 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.setText("")
self.lineEditSubject.setObjectName("lineEditSubject") self.lineEditSubject.setObjectName("lineEditSubject")
self.gridLayout_2.addWidget(self.lineEditSubject, 2, 1, 1, 1) 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.label.setObjectName("label")
self.gridLayout_2.addWidget(self.label, 1, 0, 1, 1) 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.setMinimumSize(QtCore.QSize(300, 0))
self.comboBoxSendFrom.setObjectName("comboBoxSendFrom") self.comboBoxSendFrom.setObjectName("comboBoxSendFrom")
self.gridLayout_2.addWidget(self.comboBoxSendFrom, 0, 1, 1, 1) 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.lineEditTo.setObjectName("lineEditTo")
self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1) self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1)
self.lineEditTo.setCompleter(self.addressBookCompleter) self.lineEditTo.setCompleter(self.addressBookCompleter)
self.verticalLayout_5.addLayout(self.gridLayout_2) 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.textEditMessage.setObjectName("textEditMessage")
self.verticalLayout_5.addWidget(self.textEditMessage) self.verticalLayout_5.addWidget(self.textEditMessage)
self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1) 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 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2") self.tab_2.setObjectName("tab_2")
self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_2) self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_2)
@ -360,15 +361,15 @@ class Ui_MainWindow(object):
icon6 = QtGui.QIcon() icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap(":/newPrefix/images/subscriptions.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) icon6.addPixmap(QtGui.QPixmap(":/newPrefix/images/subscriptions.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.tabWidget.addTab(self.subscriptions, icon6, "") self.tabWidget.addTab(self.subscriptions, icon6, "")
self.tab_3 = QtWidgets.QWidget() self.chans = QtWidgets.QWidget()
self.tab_3.setObjectName("tab_3") self.chans.setObjectName("chans")
self.gridLayout_4 = QtWidgets.QGridLayout(self.tab_3) self.gridLayout_4 = QtWidgets.QGridLayout(self.chans)
self.gridLayout_4.setObjectName("gridLayout_4") self.gridLayout_4.setObjectName("gridLayout_4")
self.horizontalLayout_7 = QtWidgets.QHBoxLayout() self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
self.horizontalLayout_7.setObjectName("horizontalLayout_7") self.horizontalLayout_7.setObjectName("horizontalLayout_7")
self.verticalLayout_17 = QtWidgets.QVBoxLayout() self.verticalLayout_17 = QtWidgets.QVBoxLayout()
self.verticalLayout_17.setObjectName("verticalLayout_17") 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.setMaximumSize(QtCore.QSize(200, 16777215))
self.treeWidgetChans.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.treeWidgetChans.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
self.treeWidgetChans.setLineWidth(1) 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) 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.treeWidgetChans.headerItem().setIcon(0, icon7)
self.verticalLayout_17.addWidget(self.treeWidgetChans) 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.setMaximumSize(QtCore.QSize(200, 16777215))
self.pushButtonAddChan.setObjectName("pushButtonAddChan") self.pushButtonAddChan.setObjectName("pushButtonAddChan")
self.verticalLayout_17.addWidget(self.pushButtonAddChan) self.verticalLayout_17.addWidget(self.pushButtonAddChan)
@ -389,10 +390,10 @@ class Ui_MainWindow(object):
self.verticalLayout_8.setObjectName("verticalLayout_8") self.verticalLayout_8.setObjectName("verticalLayout_8")
self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6") 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.inboxSearchLineEditChans.setObjectName("inboxSearchLineEditChans")
self.horizontalLayout_6.addWidget(self.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.setObjectName("inboxSearchOptionChans")
self.inboxSearchOptionChans.addItem("") self.inboxSearchOptionChans.addItem("")
self.inboxSearchOptionChans.addItem("") self.inboxSearchOptionChans.addItem("")
@ -401,7 +402,7 @@ class Ui_MainWindow(object):
self.inboxSearchOptionChans.addItem("") self.inboxSearchOptionChans.addItem("")
self.horizontalLayout_6.addWidget(self.inboxSearchOptionChans) self.horizontalLayout_6.addWidget(self.inboxSearchOptionChans)
self.verticalLayout_8.addLayout(self.horizontalLayout_6) 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.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
self.tableWidgetInboxChans.setAlternatingRowColors(True) self.tableWidgetInboxChans.setAlternatingRowColors(True)
self.tableWidgetInboxChans.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) self.tableWidgetInboxChans.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
@ -427,7 +428,7 @@ class Ui_MainWindow(object):
self.tableWidgetInboxChans.verticalHeader().setVisible(False) self.tableWidgetInboxChans.verticalHeader().setVisible(False)
self.tableWidgetInboxChans.verticalHeader().setDefaultSectionSize(26) self.tableWidgetInboxChans.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_8.addWidget(self.tableWidgetInboxChans) 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.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessageChans.setReadOnly(True) self.textEditInboxMessageChans.setReadOnly(True)
self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans") self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans")
@ -436,7 +437,7 @@ class Ui_MainWindow(object):
self.gridLayout_4.addLayout(self.horizontalLayout_7, 0, 0, 1, 1) self.gridLayout_4.addLayout(self.horizontalLayout_7, 0, 0, 1, 1)
icon8 = QtGui.QIcon() icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) 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 = Blacklist()
self.blackwhitelist.setObjectName("blackwhitelist") self.blackwhitelist.setObjectName("blackwhitelist")
self.tabWidget.addTab(self.blackwhitelist, QtGui.QIcon(":/newPrefix/images/blacklist.png"), "") 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.radioButtonWhitelist.click()
self.blackwhitelist.rerenderBlackWhiteList() 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.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.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.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1)
self.MainDock.setWidget(self.centralwidget) self.MainDock.setWidget(self.centralwidget)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea.AllDockWidgetAreas, self.MainDock) MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea.AllDockWidgetAreas, self.MainDock)
@ -620,8 +521,12 @@ class Ui_MainWindow(object):
self.menubar.addAction(self.menuHelp.menuAction()) self.menubar.addAction(self.menuHelp.menuAction())
self.retranslateUi(MainWindow) self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(0) self.tabWidget.setCurrentIndex(
self.tabWidgetSend.setCurrentIndex(0) self.tabWidget.indexOf(self.inbox)
)
self.tabWidgetSend.setCurrentIndex(
self.tabWidgetSend.indexOf(self.sendDirect)
)
QtCore.QMetaObject.connectSlotsByName(MainWindow) QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage) MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage)
MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom) MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom)
@ -630,12 +535,6 @@ class Ui_MainWindow(object):
MainWindow.setTabOrder(self.lineEditSubject, self.textEditMessage) MainWindow.setTabOrder(self.lineEditSubject, self.textEditMessage)
MainWindow.setTabOrder(self.textEditMessage, self.pushButtonSend) MainWindow.setTabOrder(self.textEditMessage, self.pushButtonSend)
MainWindow.setTabOrder(self.pushButtonSend, self.pushButtonAddSubscription) 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 # Popup menu actions container for the Sent page
# pylint: disable=attribute-defined-outside-init # pylint: disable=attribute-defined-outside-init
@ -693,7 +592,7 @@ class Ui_MainWindow(object):
"p, li { white-space: pre-wrap; }\n" "p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Droid Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n" "</style></head><body style=\" font-family:\'Droid Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>")) "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>"))
self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab), _translate("MainWindow", "Send ordinary Message")) self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.sendDirect), _translate("MainWindow", "Send ordinary Message"))
self.label_8.setText(_translate("MainWindow", "From:")) self.label_8.setText(_translate("MainWindow", "From:"))
self.label_7.setText(_translate("MainWindow", "Subject:")) self.label_7.setText(_translate("MainWindow", "Subject:"))
self.textEditMessageBroadcast.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n" self.textEditMessageBroadcast.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
@ -703,7 +602,6 @@ class Ui_MainWindow(object):
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>")) "<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>"))
self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers")) self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers"))
self.pushButtonTTL.setText(_translate("MainWindow", "TTL:")) self.pushButtonTTL.setText(_translate("MainWindow", "TTL:"))
self.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "X days"))
self.pushButtonClear.setText(_translate("MainWindow", "Clear")) self.pushButtonClear.setText(_translate("MainWindow", "Clear"))
self.pushButtonSend.setText(_translate("MainWindow", "Send")) self.pushButtonSend.setText(_translate("MainWindow", "Send"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send"))
@ -742,32 +640,9 @@ class Ui_MainWindow(object):
item.setText(_translate("MainWindow", "Subject")) item.setText(_translate("MainWindow", "Subject"))
item = self.tableWidgetInboxChans.horizontalHeaderItem(3) item = self.tableWidgetInboxChans.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Received")) item.setText(_translate("MainWindow", "Received"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "Chans")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.chans), _translate("MainWindow", "Chans"))
self.radioButtonBlacklist.setText(_translate("MainWindow", "Use a Blacklist (Allow all incoming messages except those on the Blacklist)"))
self.radioButtonWhitelist.setText(_translate("MainWindow", "Use a Whitelist (Block all incoming messages except those on the Whitelist)"))
self.pushButtonAddBlacklist.setText(_translate("MainWindow", "Add new entry"))
self.tableWidgetBlacklist.setSortingEnabled(True)
item = self.tableWidgetBlacklist.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Name or Label"))
item = self.tableWidgetBlacklist.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "Address"))
self.blackwhitelist.retranslateUi()
self.tabWidget.setTabText(self.tabWidget.indexOf(self.blackwhitelist), _translate("MainWindow", "Blacklist"))
self.networkstatus.retranslateUi() self.networkstatus.retranslateUi()
self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status"))
item = self.tableWidgetConnectionCount.horizontalHeaderItem(0)
item.setText(_translate("MainWindow", "Stream #"))
item = self.tableWidgetConnectionCount.horizontalHeaderItem(1)
item.setText(_translate("MainWindow", "Connections"))
self.labelTotalConnections.setText(_translate("MainWindow", "Total connections:"))
self.labelStartupTime.setText(_translate("MainWindow", "Since startup:"))
self.labelMessageCount.setText(_translate("MainWindow", "Processed 0 person-to-person messages."))
self.labelPubkeyCount.setText(_translate("MainWindow", "Processed 0 public keys."))
self.labelBroadcastCount.setText(_translate("MainWindow", "Processed 0 broadcasts."))
self.labelLookupsPerSecond.setText(_translate("MainWindow", "Inventory lookups per second: 0"))
self.labelBytesRecvCount.setText(_translate("MainWindow", "Down: 0 KB/s"))
self.labelBytesSentCount.setText(_translate("MainWindow", "Up: 0 KB/s"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status"))
self.menuFile.setTitle(_translate("MainWindow", "File")) self.menuFile.setTitle(_translate("MainWindow", "File"))
self.menuSettings.setTitle(_translate("MainWindow", "Settings")) self.menuSettings.setTitle(_translate("MainWindow", "Settings"))
self.menuHelp.setTitle(_translate("MainWindow", "Help")) self.menuHelp.setTitle(_translate("MainWindow", "Help"))

View File

@ -1,6 +1,6 @@
--- bitmessageui.py.orig 2024-05-13 08:32:22.376971328 +0900 --- bitmessageui.py.orig 2024-05-13 08:32:22.376971328 +0900
+++ bitmessageui.py 2024-05-13 09:48:39.354481762 +0900 +++ bitmessageui.py 2024-05-14 15:56:24.921713575 +0900
@@ -7,7 +7,10 @@ @@ -7,7 +7,11 @@
from PyQt6 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
@ -8,11 +8,12 @@
+from bmconfigparser import config +from bmconfigparser import config
+from .foldertree import AddressBookCompleter +from .foldertree import AddressBookCompleter
+from .blacklist import Blacklist +from .blacklist import Blacklist
+import bitmessageqt.settingsmixin as settingsmixin
+from .networkstatus import NetworkStatus +from .networkstatus import NetworkStatus
class Ui_MainWindow(object): class Ui_MainWindow(object):
def setupUi(self, MainWindow): def setupUi(self, MainWindow):
@@ -140,6 +143,11 @@ @@ -140,6 +144,11 @@
self.tableWidgetAddressBook.horizontalHeader().setStretchLastSection(True) self.tableWidgetAddressBook.horizontalHeader().setStretchLastSection(True)
self.tableWidgetAddressBook.verticalHeader().setVisible(False) self.tableWidgetAddressBook.verticalHeader().setVisible(False)
self.verticalLayout_2.addWidget(self.tableWidgetAddressBook) self.verticalLayout_2.addWidget(self.tableWidgetAddressBook)
@ -24,15 +25,60 @@
self.pushButtonAddAddressBook = QtWidgets.QPushButton(parent=self.send) self.pushButtonAddAddressBook = QtWidgets.QPushButton(parent=self.send)
self.pushButtonAddAddressBook.setMaximumSize(QtCore.QSize(200, 16777215)) self.pushButtonAddAddressBook.setMaximumSize(QtCore.QSize(200, 16777215))
self.pushButtonAddAddressBook.setObjectName("pushButtonAddAddressBook") self.pushButtonAddAddressBook.setObjectName("pushButtonAddAddressBook")
@@ -184,6 +192,7 @@ @@ -156,40 +165,41 @@
self.lineEditTo = QtWidgets.QLineEdit(parent=self.tab) 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.lineEditTo.setObjectName("lineEditTo")
self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1) self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1)
+ self.lineEditTo.setCompleter(self.addressBookCompleter) + self.lineEditTo.setCompleter(self.addressBookCompleter)
self.verticalLayout_5.addLayout(self.gridLayout_2) self.verticalLayout_5.addLayout(self.gridLayout_2)
self.textEditMessage = QtWidgets.QTextEdit(parent=self.tab) - self.textEditMessage = QtWidgets.QTextEdit(parent=self.tab)
+ self.textEditMessage = QtWidgets.QTextEdit(parent=self.sendDirect)
self.textEditMessage.setObjectName("textEditMessage") self.textEditMessage.setObjectName("textEditMessage")
@@ -263,6 +272,9 @@ 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)
@@ -263,6 +273,9 @@
self.labelHumanFriendlyTTLDescription.setMaximumSize(QtCore.QSize(45, 16777215)) self.labelHumanFriendlyTTLDescription.setMaximumSize(QtCore.QSize(45, 16777215))
self.labelHumanFriendlyTTLDescription.setObjectName("labelHumanFriendlyTTLDescription") self.labelHumanFriendlyTTLDescription.setObjectName("labelHumanFriendlyTTLDescription")
self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription) self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription)
@ -42,34 +88,184 @@
self.pushButtonSend = QtWidgets.QPushButton(parent=self.send) self.pushButtonSend = QtWidgets.QPushButton(parent=self.send)
self.pushButtonSend.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.pushButtonSend.setMaximumSize(QtCore.QSize(16777215, 16777215))
self.pushButtonSend.setObjectName("pushButtonSend") self.pushButtonSend.setObjectName("pushButtonSend")
@@ -425,8 +437,14 @@ @@ -348,15 +361,15 @@
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)
@@ -368,7 +381,7 @@
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)
@@ -377,10 +390,10 @@
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("")
@@ -389,7 +402,7 @@
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)
@@ -415,7 +428,7 @@
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")
@@ -424,113 +437,20 @@
self.gridLayout_4.addLayout(self.horizontalLayout_7, 0, 0, 1, 1)
icon8 = QtGui.QIcon() icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off) 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.tab_3, icon8, "")
- self.blackwhitelist = QtWidgets.QWidget() - self.blackwhitelist = QtWidgets.QWidget()
+ self.tabWidget.addTab(self.chans, icon8, "")
+ self.blackwhitelist = Blacklist() + self.blackwhitelist = Blacklist()
self.blackwhitelist.setObjectName("blackwhitelist") self.blackwhitelist.setObjectName("blackwhitelist")
- 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 = QtWidgets.QWidget()
- 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.tabWidget.addTab(self.blackwhitelist, QtGui.QIcon(":/newPrefix/images/blacklist.png"), "") + self.tabWidget.addTab(self.blackwhitelist, QtGui.QIcon(":/newPrefix/images/blacklist.png"), "")
+ # Initialize the Blacklist or Whitelist + # Initialize the Blacklist or Whitelist
+ if config.get('bitmessagesettings', 'blackwhitelist') == 'white': + if config.get('bitmessagesettings', 'blackwhitelist') == 'white':
+ self.blackwhitelist.radioButtonWhitelist.click() + self.blackwhitelist.radioButtonWhitelist.click()
+ self.blackwhitelist.rerenderBlackWhiteList() + self.blackwhitelist.rerenderBlackWhiteList()
+ +
self.gridLayout_6 = QtWidgets.QGridLayout(self.blackwhitelist)
self.gridLayout_6.setObjectName("gridLayout_6")
self.radioButtonBlacklist = QtWidgets.QRadioButton(parent=self.blackwhitelist)
@@ -462,7 +480,8 @@
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 = QtWidgets.QWidget()
+ 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.networkstatus.setObjectName("networkstatus")
self.pushButtonStatusIcon = QtWidgets.QPushButton(parent=self.networkstatus)
self.pushButtonStatusIcon.setGeometry(QtCore.QRect(680, 440, 21, 23))
@@ -530,7 +549,7 @@
self.tabWidget.addTab(self.networkstatus, icon11, "")
self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1) self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1)
self.MainDock.setWidget(self.centralwidget) self.MainDock.setWidget(self.centralwidget)
- MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(None), self.MainDock) - MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(None), self.MainDock)
@ -77,7 +273,7 @@
self.menubar = QtWidgets.QMenuBar(parent=MainWindow) self.menubar = QtWidgets.QMenuBar(parent=MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 885, 27)) self.menubar.setGeometry(QtCore.QRect(0, 0, 885, 27))
self.menubar.setObjectName("menubar") self.menubar.setObjectName("menubar")
@@ -550,6 +569,8 @@ @@ -550,6 +470,8 @@
self.actionManageKeys = QtGui.QAction(parent=MainWindow) self.actionManageKeys = QtGui.QAction(parent=MainWindow)
self.actionManageKeys.setCheckable(False) self.actionManageKeys.setCheckable(False)
self.actionManageKeys.setEnabled(True) self.actionManageKeys.setEnabled(True)
@ -86,7 +282,7 @@
icon = QtGui.QIcon.fromTheme("dialog-password") icon = QtGui.QIcon.fromTheme("dialog-password")
self.actionManageKeys.setIcon(icon) self.actionManageKeys.setIcon(icon)
self.actionManageKeys.setObjectName("actionManageKeys") self.actionManageKeys.setObjectName("actionManageKeys")
@@ -561,6 +582,10 @@ @@ -561,6 +483,10 @@
icon = QtGui.QIcon.fromTheme("help-contents") icon = QtGui.QIcon.fromTheme("help-contents")
self.actionHelp.setIcon(icon) self.actionHelp.setIcon(icon)
self.actionHelp.setObjectName("actionHelp") self.actionHelp.setObjectName("actionHelp")
@ -97,7 +293,7 @@
self.actionAbout = QtGui.QAction(parent=MainWindow) self.actionAbout = QtGui.QAction(parent=MainWindow)
icon = QtGui.QIcon.fromTheme("help-about") icon = QtGui.QIcon.fromTheme("help-about")
self.actionAbout.setIcon(icon) self.actionAbout.setIcon(icon)
@@ -584,9 +609,11 @@ @@ -584,17 +510,23 @@
self.menuFile.addAction(self.actionManageKeys) self.menuFile.addAction(self.actionManageKeys)
self.menuFile.addAction(self.actionDeleteAllTrashedMessages) self.menuFile.addAction(self.actionDeleteAllTrashedMessages)
self.menuFile.addAction(self.actionRegenerateDeterministicAddresses) self.menuFile.addAction(self.actionRegenerateDeterministicAddresses)
@ -109,10 +305,31 @@
self.menuHelp.addAction(self.actionAbout) self.menuHelp.addAction(self.actionAbout)
self.menubar.addAction(self.menuFile.menuAction()) self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuSettings.menuAction()) self.menubar.addAction(self.menuSettings.menuAction())
@@ -610,6 +637,26 @@ self.menubar.addAction(self.menuHelp.menuAction())
MainWindow.setTabOrder(self.tableWidgetBlacklist, self.tableWidgetConnectionCount)
MainWindow.setTabOrder(self.tableWidgetConnectionCount, self.pushButtonStatusIcon)
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)
@@ -603,12 +535,26 @@
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 + # Popup menu actions container for the Sent page
+ # pylint: disable=attribute-defined-outside-init + # pylint: disable=attribute-defined-outside-init
+ self.sentContextMenuToolbar = QtWidgets.QToolBar() + self.sentContextMenuToolbar = QtWidgets.QToolBar()
@ -132,30 +349,59 @@
+ if dontconnect else + if dontconnect else
+ _translate("MainWindow", "Go offline", None) + _translate("MainWindow", "Go offline", None)
+ ) + )
+
def retranslateUi(self, MainWindow): def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate _translate = QtCore.QCoreApplication.translate
self.MainDock.setWindowTitle(_translate("MainWindow", "Bitmessage")) @@ -646,7 +592,7 @@
@@ -657,6 +704,7 @@ "p, li { white-space: pre-wrap; }\n"
"</style></head><body style=\" font-family:\'Droid Sans\'; font-size:9pt; font-weight:400; font-style:normal;\">\n"
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>"))
- self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab), _translate("MainWindow", "Send ordinary Message"))
+ self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.sendDirect), _translate("MainWindow", "Send ordinary Message"))
self.label_8.setText(_translate("MainWindow", "From:"))
self.label_7.setText(_translate("MainWindow", "Subject:"))
self.textEditMessageBroadcast.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
@@ -656,7 +602,7 @@
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\';\"><br /></p></body></html>"))
self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers")) self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers"))
self.pushButtonTTL.setText(_translate("MainWindow", "TTL:")) self.pushButtonTTL.setText(_translate("MainWindow", "TTL:"))
self.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "X days")) - self.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "X days"))
+ self.pushButtonClear.setText(_translate("MainWindow", "Clear")) + self.pushButtonClear.setText(_translate("MainWindow", "Clear"))
self.pushButtonSend.setText(_translate("MainWindow", "Send")) self.pushButtonSend.setText(_translate("MainWindow", "Send"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send"))
self.treeWidgetSubscriptions.headerItem().setText(0, _translate("MainWindow", "Subscriptions")) self.treeWidgetSubscriptions.headerItem().setText(0, _translate("MainWindow", "Subscriptions"))
@@ -703,7 +751,10 @@ @@ -694,28 +640,8 @@
item.setText(_translate("MainWindow", "Name or Label")) item.setText(_translate("MainWindow", "Subject"))
item = self.tableWidgetBlacklist.horizontalHeaderItem(1) item = self.tableWidgetInboxChans.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Address")) item.setText(_translate("MainWindow", "Received"))
+ self.blackwhitelist.retranslateUi() - self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("MainWindow", "Chans"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.blackwhitelist), _translate("MainWindow", "Blacklist")) - self.radioButtonBlacklist.setText(_translate("MainWindow", "Use a Blacklist (Allow all incoming messages except those on the Blacklist)"))
- self.radioButtonWhitelist.setText(_translate("MainWindow", "Use a Whitelist (Block all incoming messages except those on the Whitelist)"))
- self.pushButtonAddBlacklist.setText(_translate("MainWindow", "Add new entry"))
- self.tableWidgetBlacklist.setSortingEnabled(True)
- item = self.tableWidgetBlacklist.horizontalHeaderItem(0)
- item.setText(_translate("MainWindow", "Name or Label"))
- item = self.tableWidgetBlacklist.horizontalHeaderItem(1)
- item.setText(_translate("MainWindow", "Address"))
- self.tabWidget.setTabText(self.tabWidget.indexOf(self.blackwhitelist), _translate("MainWindow", "Blacklist"))
- item = self.tableWidgetConnectionCount.horizontalHeaderItem(0)
- item.setText(_translate("MainWindow", "Stream #"))
- item = self.tableWidgetConnectionCount.horizontalHeaderItem(1)
- item.setText(_translate("MainWindow", "Connections"))
- self.labelTotalConnections.setText(_translate("MainWindow", "Total connections:"))
- self.labelStartupTime.setText(_translate("MainWindow", "Since startup:"))
- self.labelMessageCount.setText(_translate("MainWindow", "Processed 0 person-to-person messages."))
- self.labelPubkeyCount.setText(_translate("MainWindow", "Processed 0 public keys."))
- self.labelBroadcastCount.setText(_translate("MainWindow", "Processed 0 broadcasts."))
- self.labelLookupsPerSecond.setText(_translate("MainWindow", "Inventory lookups per second: 0"))
- self.labelBytesRecvCount.setText(_translate("MainWindow", "Down: 0 KB/s"))
- self.labelBytesSentCount.setText(_translate("MainWindow", "Up: 0 KB/s"))
+ self.tabWidget.setTabText(self.tabWidget.indexOf(self.chans), _translate("MainWindow", "Chans"))
+ self.networkstatus.retranslateUi() + self.networkstatus.retranslateUi()
+ self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status")) self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status"))
item = self.tableWidgetConnectionCount.horizontalHeaderItem(0) self.menuFile.setTitle(_translate("MainWindow", "File"))
item.setText(_translate("MainWindow", "Stream #")) self.menuSettings.setTitle(_translate("MainWindow", "Settings"))
item = self.tableWidgetConnectionCount.horizontalHeaderItem(1) @@ -726,8 +652,10 @@
@@ -726,8 +777,10 @@
self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q")) self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
self.actionHelp.setText(_translate("MainWindow", "Help")) self.actionHelp.setText(_translate("MainWindow", "Help"))
self.actionHelp.setShortcut(_translate("MainWindow", "F1")) self.actionHelp.setShortcut(_translate("MainWindow", "F1"))

View File

@ -51,7 +51,7 @@ class Blacklist(QtWidgets.QWidget, RetranslateMixin):
def click_pushButtonAddBlacklist(self): def click_pushButtonAddBlacklist(self):
self.NewBlacklistDialogInstance = AddAddressDialog(self) self.NewBlacklistDialogInstance = AddAddressDialog(self)
if self.NewBlacklistDialogInstance.exec_(): if self.NewBlacklistDialogInstance.exec():
if self.NewBlacklistDialogInstance.labelAddressCheck.text() == \ if self.NewBlacklistDialogInstance.labelAddressCheck.text() == \
_translate("MainWindow", "Address is valid."): _translate("MainWindow", "Address is valid."):
address = addBMIfNotPresent(str( address = addBMIfNotPresent(str(
@ -68,16 +68,16 @@ class Blacklist(QtWidgets.QWidget, RetranslateMixin):
if queryreturn == []: if queryreturn == []:
self.tableWidgetBlacklist.setSortingEnabled(False) self.tableWidgetBlacklist.setSortingEnabled(False)
self.tableWidgetBlacklist.insertRow(0) self.tableWidgetBlacklist.insertRow(0)
newItem = QtGui.QTableWidgetItem(unicode( newItem = QtWidgets.QTableWidgetItem(
self.NewBlacklistDialogInstance.lineEditLabel.text().toUtf8(), 'utf-8')) self.NewBlacklistDialogInstance.lineEditLabel.text())
newItem.setIcon(avatarize(address)) newItem.setIcon(avatarize(address))
self.tableWidgetBlacklist.setItem(0, 0, newItem) self.tableWidgetBlacklist.setItem(0, 0, newItem)
newItem = QtGui.QTableWidgetItem(address) newItem = QtWidgets.QTableWidgetItem(address)
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
self.tableWidgetBlacklist.setItem(0, 1, newItem) self.tableWidgetBlacklist.setItem(0, 1, newItem)
self.tableWidgetBlacklist.setSortingEnabled(True) self.tableWidgetBlacklist.setSortingEnabled(True)
t = (str(self.NewBlacklistDialogInstance.lineEditLabel.text().toUtf8()), address, True) t = (self.NewBlacklistDialogInstance.lineEditLabel.text(), address, True)
if config.get('bitmessagesettings', 'blackwhitelist') == 'black': if config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sql = '''INSERT INTO blacklist VALUES (?,?,?)''' sql = '''INSERT INTO blacklist VALUES (?,?,?)'''
else: else:
@ -103,7 +103,7 @@ class Blacklist(QtWidgets.QWidget, RetranslateMixin):
def tableWidgetBlacklistItemChanged(self, item): def tableWidgetBlacklistItemChanged(self, item):
if item.column() == 0: if item.column() == 0:
addressitem = self.tableWidgetBlacklist.item(item.row(), 1) addressitem = self.tableWidgetBlacklist.item(item.row(), 1)
if isinstance(addressitem, QtGui.QTableWidgetItem): if isinstance(addressitem, QtWidgets.QTableWidgetItem):
if self.radioButtonBlacklist.isChecked(): if self.radioButtonBlacklist.isChecked():
sqlExecute('''UPDATE blacklist SET label=? WHERE address=?''', sqlExecute('''UPDATE blacklist SET label=? WHERE address=?''',
str(item.text()), str(addressitem.text())) str(item.text()), str(addressitem.text()))
@ -165,14 +165,14 @@ class Blacklist(QtWidgets.QWidget, RetranslateMixin):
for row in queryreturn: for row in queryreturn:
label, address, enabled = row label, address, enabled = row
self.tableWidgetBlacklist.insertRow(0) self.tableWidgetBlacklist.insertRow(0)
newItem = QtWidgets.QTableWidgetItem(unicode(label, 'utf-8')) newItem = QtWidgets.QTableWidgetItem(label)
if not enabled: if not enabled:
newItem.setTextColor(QtGui.QColor(128, 128, 128)) newItem.setTextColor(QtGui.QColor(128, 128, 128))
newItem.setIcon(avatarize(address)) newItem.setIcon(avatarize(address))
self.tableWidgetBlacklist.setItem(0, 0, newItem) self.tableWidgetBlacklist.setItem(0, 0, newItem)
newItem = QtWidgets.QTableWidgetItem(address) newItem = QtWidgets.QTableWidgetItem(address)
newItem.setFlags( newItem.setFlags(
QtCore.Qt.ItemIsSelectable | QtCore.Qt.ItemIsEnabled) QtCore.Qt.ItemFlag.ItemIsSelectable | QtCore.Qt.ItemFlag.ItemIsEnabled)
if not enabled: if not enabled:
newItem.setTextColor(QtGui.QColor(128, 128, 128)) newItem.setTextColor(QtGui.QColor(128, 128, 128))
self.tableWidgetBlacklist.setItem(0, 1, newItem) self.tableWidgetBlacklist.setItem(0, 1, newItem)
@ -185,7 +185,7 @@ class Blacklist(QtWidgets.QWidget, RetranslateMixin):
def on_action_BlacklistDelete(self): def on_action_BlacklistDelete(self):
currentRow = self.tableWidgetBlacklist.currentRow() currentRow = self.tableWidgetBlacklist.currentRow()
labelAtCurrentRow = self.tableWidgetBlacklist.item( labelAtCurrentRow = self.tableWidgetBlacklist.item(
currentRow, 0).text().toUtf8() currentRow, 0).text()
addressAtCurrentRow = self.tableWidgetBlacklist.item( addressAtCurrentRow = self.tableWidgetBlacklist.item(
currentRow, 1).text() currentRow, 1).text()
if config.get('bitmessagesettings', 'blackwhitelist') == 'black': if config.get('bitmessagesettings', 'blackwhitelist') == 'black':
@ -202,11 +202,11 @@ class Blacklist(QtWidgets.QWidget, RetranslateMixin):
currentRow = self.tableWidgetBlacklist.currentRow() currentRow = self.tableWidgetBlacklist.currentRow()
addressAtCurrentRow = self.tableWidgetBlacklist.item( addressAtCurrentRow = self.tableWidgetBlacklist.item(
currentRow, 1).text() currentRow, 1).text()
clipboard = QtGui.QApplication.clipboard() clipboard = QtWidgets.QApplication.clipboard()
clipboard.setText(str(addressAtCurrentRow)) clipboard.setText(str(addressAtCurrentRow))
def on_context_menuBlacklist(self, point): def on_context_menuBlacklist(self, point):
self.popMenuBlacklist.exec_( self.popMenuBlacklist.exec(
self.tableWidgetBlacklist.mapToGlobal(point)) self.tableWidgetBlacklist.mapToGlobal(point))
def on_action_BlacklistEnable(self): def on_action_BlacklistEnable(self):
@ -214,9 +214,9 @@ class Blacklist(QtWidgets.QWidget, RetranslateMixin):
addressAtCurrentRow = self.tableWidgetBlacklist.item( addressAtCurrentRow = self.tableWidgetBlacklist.item(
currentRow, 1).text() currentRow, 1).text()
self.tableWidgetBlacklist.item( self.tableWidgetBlacklist.item(
currentRow, 0).setTextColor(QtGui.QApplication.palette().text().color()) currentRow, 0).setTextColor(QtWidgets.QApplication.palette().text().color())
self.tableWidgetBlacklist.item( self.tableWidgetBlacklist.item(
currentRow, 1).setTextColor(QtGui.QApplication.palette().text().color()) currentRow, 1).setTextColor(QtWidgets.QApplication.palette().text().color())
if config.get('bitmessagesettings', 'blackwhitelist') == 'black': if config.get('bitmessagesettings', 'blackwhitelist') == 'black':
sqlExecute( sqlExecute(
'''UPDATE blacklist SET enabled=1 WHERE address=?''', '''UPDATE blacklist SET enabled=1 WHERE address=?''',

View File

@ -124,8 +124,7 @@ class AccountMixin(object):
AccountMixin.NORMAL, AccountMixin.NORMAL,
AccountMixin.CHAN, AccountMixin.MAILINGLIST): AccountMixin.CHAN, AccountMixin.MAILINGLIST):
try: try:
retval = str( retval = config.get(self.address, 'label')
config.get(self.address, 'label'), 'utf-8')
except Exception: except Exception:
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select label from addressbook where address=?''', self.address) '''select label from addressbook where address=?''', self.address)
@ -136,12 +135,11 @@ class AccountMixin(object):
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
retval, = row retval, = row
retval = str(retval, 'utf-8') retval = retval
elif self.address is None or self.type == AccountMixin.ALL: elif self.address is None or self.type == AccountMixin.ALL:
return str( return _translate("MainWindow", "All accounts")
str(_translate("MainWindow", "All accounts")), 'utf-8')
return retval or str(self.address, 'utf-8') return retval or self.address
class BMTreeWidgetItem(QtWidgets.QTreeWidgetItem, AccountMixin): class BMTreeWidgetItem(QtWidgets.QTreeWidgetItem, AccountMixin):
@ -236,11 +234,9 @@ class Ui_AddressWidget(BMTreeWidgetItem, SettingsMixin):
"MainWindow", "All accounts") "MainWindow", "All accounts")
else: else:
try: try:
return str( return config.get(self.address, 'label')
config.get(self.address, 'label'),
'utf-8', 'ignore')
except: except:
return str(self.address, 'utf-8') return self.address
def _getAddressBracket(self, unreadCount=False): def _getAddressBracket(self, unreadCount=False):
ret = "" if self.isExpanded() \ ret = "" if self.isExpanded() \
@ -264,8 +260,8 @@ class Ui_AddressWidget(BMTreeWidgetItem, SettingsMixin):
if role == QtCore.Qt.ItemDataRole.EditRole \ if role == QtCore.Qt.ItemDataRole.EditRole \
and self.type != AccountMixin.SUBSCRIPTION: and self.type != AccountMixin.SUBSCRIPTION:
config.set( config.set(
str(self.address), 'label', self.address, 'label',
str(value.toString().toUtf8()) value.toString()
if isinstance(value, QtCore.QVariant) if isinstance(value, QtCore.QVariant)
else value.encode('utf-8') else value.encode('utf-8')
) )
@ -311,8 +307,8 @@ class Ui_SubscriptionWidget(Ui_AddressWidget):
if queryreturn != []: if queryreturn != []:
for row in queryreturn: for row in queryreturn:
retval, = row retval, = row
return str(retval, 'utf-8', 'ignore') return retval
return str(self.address, 'utf-8') return self.address
def setType(self): def setType(self):
"""Set account type""" """Set account type"""
@ -323,10 +319,9 @@ class Ui_SubscriptionWidget(Ui_AddressWidget):
"""Save subscription label to database""" """Save subscription label to database"""
if role == QtCore.Qt.ItemDataRole.EditRole: if role == QtCore.Qt.ItemDataRole.EditRole:
if isinstance(value, QtCore.QVariant): if isinstance(value, QtCore.QVariant):
label = str( label = value.toString()
value.toString().toUtf8()).decode('utf-8', 'ignore')
else: else:
label = str(value, 'utf-8', 'ignore') label = value
sqlExecute( sqlExecute(
'''UPDATE subscriptions SET label=? WHERE address=?''', '''UPDATE subscriptions SET label=? WHERE address=?''',
label, self.address) label, self.address)
@ -407,9 +402,7 @@ class MessageList_AddressWidget(BMAddressWidget):
AccountMixin.NORMAL, AccountMixin.NORMAL,
AccountMixin.CHAN, AccountMixin.MAILINGLIST): AccountMixin.CHAN, AccountMixin.MAILINGLIST):
try: try:
newLabel = str( newLabel = config.get(self.address, 'label')
config.get(self.address, 'label'),
'utf-8', 'ignore')
except: except:
queryreturn = sqlQuery( queryreturn = sqlQuery(
'''select label from addressbook where address=?''', self.address) '''select label from addressbook where address=?''', self.address)
@ -418,7 +411,7 @@ class MessageList_AddressWidget(BMAddressWidget):
'''select label from subscriptions where address=?''', self.address) '''select label from subscriptions where address=?''', self.address)
if queryreturn: if queryreturn:
for row in queryreturn: for row in queryreturn:
newLabel = str(row[0], 'utf-8', 'ignore') newLabel = row[0]
self.label = newLabel self.label = newLabel
@ -456,7 +449,7 @@ class MessageList_SubjectWidget(BMTableWidgetItem):
if role == QtCore.Qt.ItemDataRole.UserRole: if role == QtCore.Qt.ItemDataRole.UserRole:
return self.subject return self.subject
if role == QtCore.Qt.ItemDataRole.ToolTipRole: if role == QtCore.Qt.ItemDataRole.ToolTipRole:
return escape(str(self.subject, 'utf-8')) return escape(self.subject)
return super(MessageList_SubjectWidget, self).data(role) return super(MessageList_SubjectWidget, self).data(role)
# label (or address) alphabetically, disabled at the end # label (or address) alphabetically, disabled at the end
@ -513,10 +506,7 @@ class Ui_AddressBookWidgetItem(BMAddressWidget):
def setData(self, role, value): def setData(self, role, value):
"""Set data""" """Set data"""
if role == QtCore.Qt.ItemDataRole.EditRole: if role == QtCore.Qt.ItemDataRole.EditRole:
self.label = str( self.label = value.toString() if isinstance(value, QtCore.QVariant) else value
value.toString().toUtf8()
if isinstance(value, QtCore.QVariant) else value
)
if self.type in ( if self.type in (
AccountMixin.NORMAL, AccountMixin.NORMAL,
AccountMixin.MAILINGLIST, AccountMixin.CHAN): AccountMixin.MAILINGLIST, AccountMixin.CHAN):
@ -584,14 +574,13 @@ class AddressBookCompleter(QtWidgets.QCompleter):
def splitPath(self, path): def splitPath(self, path):
"""Split on semicolon""" """Split on semicolon"""
text = str(path.toUtf8(), 'utf-8') text = path
return [text[:self.widget().cursorPosition()].split(';')[-1].strip()] return [text[:self.widget().cursorPosition()].split(';')[-1].strip()]
def pathFromIndex(self, index): def pathFromIndex(self, index):
"""Perform autocompletion (reimplemented QCompleter method)""" """Perform autocompletion (reimplemented QCompleter method)"""
autoString = str( autoString = index.data(QtCore.Qt.ItemDataRole.EditRole).toString()
index.data(QtCore.Qt.ItemDataRole.EditRole).toString().toUtf8(), 'utf-8') text = self.widget().text()
text = str(self.widget().text().toUtf8(), 'utf-8')
# If cursor position was saved, restore it, else save it # If cursor position was saved, restore it, else save it
if self.cursorPos != -1: if self.cursorPos != -1:

View File

@ -3,13 +3,13 @@
import glob import glob
import os import os
from PyQt4 import QtCore, QtGui from PyQt6 import QtCore, QtGui, QtWidgets
import paths import paths
from bmconfigparser import config from bmconfigparser import config
class LanguageBox(QtGui.QComboBox): class LanguageBox(QtWidgets.QComboBox):
"""LanguageBox class for Qt UI""" """LanguageBox class for Qt UI"""
languageName = { languageName = {
"system": "System Settings", "eo": "Esperanto", "system": "System Settings", "eo": "Esperanto",
@ -17,17 +17,17 @@ class LanguageBox(QtGui.QComboBox):
} }
def __init__(self, parent=None): def __init__(self, parent=None):
super(QtGui.QComboBox, self).__init__(parent) super(QtWidgets.QComboBox, self).__init__(parent)
self.populate() self.populate()
def populate(self): def populate(self):
"""Populates drop down list with all available languages.""" """Populates drop down list with all available languages."""
self.clear() self.clear()
localesPath = os.path.join(paths.codePath(), 'translations') localesPath = os.path.join(paths.codePath(), 'translations')
self.addItem(QtGui.QApplication.translate( self.addItem(QtWidgets.QApplication.translate(
"settingsDialog", "System Settings", "system"), "system") "settingsDialog", "System Settings", "system"), "system")
self.setCurrentIndex(0) self.setCurrentIndex(0)
self.setInsertPolicy(QtGui.QComboBox.InsertAlphabetically) self.setInsertPolicy(QtWidgets.QComboBox.InsertPolicy.InsertAlphabetically)
for translationFile in sorted( for translationFile in sorted(
glob.glob(os.path.join(localesPath, "bitmessage_*.qm")) glob.glob(os.path.join(localesPath, "bitmessage_*.qm"))
): ):

View File

@ -24,10 +24,7 @@ class MessageCompose(QtWidgets.QTextEdit):
self.zoomOut(1) self.zoomOut(1)
zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize
QtGui.QApplication.activeWindow().statusBar().showMessage( QtGui.QApplication.activeWindow().statusBar().showMessage(
QtGui.QApplication.translate("MainWindow", "Zoom level %1%").arg( QtGui.QApplication.translate("MainWindow", "Zoom level {0}%").format(str(zoom)))
str(zoom)
)
)
else: else:
# in QTextEdit, super does not zoom, only scroll # in QTextEdit, super does not zoom, only scroll
super(MessageCompose, self).wheelEvent(event) super(MessageCompose, self).wheelEvent(event)

View File

@ -164,7 +164,7 @@ class NetworkStatus(QtWidgets.QWidget, RetranslateMixin):
) )
self.tableWidgetConnectionCount.setItem( self.tableWidgetConnectionCount.setItem(
0, 2, 0, 2,
QtWidgets.QTableWidgetItem("%s" % (c.userAgent)) QtWidgets.QTableWidgetItem("%s" % (c.userAgent.decode()))
) )
self.tableWidgetConnectionCount.setItem( self.tableWidgetConnectionCount.setItem(
0, 3, 0, 3,

View File

@ -375,7 +375,7 @@ The 'Random Number' option is selected by default but deterministic addresses ha
<sender>radioButtonDeterministicAddress</sender> <sender>radioButtonDeterministicAddress</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>groupBoxDeterministic</receiver> <receiver>groupBoxDeterministic</receiver>
<slot>setShown(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>92</x> <x>92</x>
@ -391,7 +391,7 @@ The 'Random Number' option is selected by default but deterministic addresses ha
<sender>radioButtonRandomAddress</sender> <sender>radioButtonRandomAddress</sender>
<signal>toggled(bool)</signal> <signal>toggled(bool)</signal>
<receiver>groupBox</receiver> <receiver>groupBox</receiver>
<slot>setShown(bool)</slot> <slot>setVisible(bool)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>72</x> <x>72</x>

View File

@ -6,7 +6,7 @@ src/bitmessageqt/newchandialog.py
from PyQt6 import QtCore, QtGui, QtWidgets from PyQt6 import QtCore, QtGui, QtWidgets
import bitmessageqt.widgets import bitmessageqt.widgets as widgets
from addresses import addBMIfNotPresent from addresses import addBMIfNotPresent
from .addressvalidator import AddressValidator, PassPhraseValidator from .addressvalidator import AddressValidator, PassPhraseValidator
from queues import ( from queues import (
@ -21,30 +21,33 @@ class NewChanDialog(QtWidgets.QDialog):
super(NewChanDialog, self).__init__(parent) super(NewChanDialog, self).__init__(parent)
widgets.load('newchandialog.ui', self) widgets.load('newchandialog.ui', self)
self.parent = parent self.parent = parent
self.chanAddress.setValidator( # XXX unresolved
AddressValidator( #self.chanAddress.setValidator(
self.chanAddress, # AddressValidator(
self.chanPassPhrase, # self.chanAddress,
self.validatorFeedback, # self.chanPassPhrase,
self.buttonBox, # self.validatorFeedback,
False)) # self.buttonBox,
self.chanPassPhrase.setValidator( # False))
PassPhraseValidator( # XXX unresolved
self.chanPassPhrase, #self.chanPassPhrase.setValidator(
self.chanAddress, # PassPhraseValidator(
self.validatorFeedback, # self.chanPassPhrase,
self.buttonBox, # self.chanAddress,
False)) # self.validatorFeedback,
# self.buttonBox,
# False))
self.timer = QtCore.QTimer() self.timer = QtCore.QTimer()
QtCore.QObject.connect( # pylint: disable=no-member self.timer.timeout.connect(self.delayedUpdateStatus)
self.timer, QtCore.SIGNAL("timeout()"), self.delayedUpdateStatus)
self.timer.start(500) # milliseconds self.timer.start(500) # milliseconds
self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self.setAttribute(QtCore.Qt.WidgetAttribute.WA_DeleteOnClose)
self.show() self.show()
def delayedUpdateStatus(self): def delayedUpdateStatus(self):
"""Related to updating the UI for the chan passphrase validity""" """Related to updating the UI for the chan passphrase validity"""
# XXX unresolved
return
self.chanPassPhrase.validator().checkQueue() self.chanPassPhrase.validator().checkQueue()
def accept(self): def accept(self):
@ -52,32 +55,32 @@ class NewChanDialog(QtWidgets.QDialog):
self.timer.stop() self.timer.stop()
self.hide() self.hide()
apiAddressGeneratorReturnQueue.queue.clear() apiAddressGeneratorReturnQueue.queue.clear()
if self.chanAddress.text().toUtf8() == "": if self.chanAddress.text() == "":
addressGeneratorQueue.put( addressGeneratorQueue.put(
('createChan', 4, 1, str_chan + ' ' + str(self.chanPassPhrase.text().toUtf8()), ('createChan', 4, 1, str_chan + ' ' + self.chanPassPhrase.text(),
self.chanPassPhrase.text().toUtf8(), self.chanPassPhrase.text(),
True)) True))
else: else:
addressGeneratorQueue.put( addressGeneratorQueue.put(
('joinChan', addBMIfNotPresent(self.chanAddress.text().toUtf8()), ('joinChan', addBMIfNotPresent(self.chanAddress.text()),
str_chan + ' ' + str(self.chanPassPhrase.text().toUtf8()), str_chan + ' ' + self.chanPassPhrase.text(),
self.chanPassPhrase.text().toUtf8(), self.chanPassPhrase.text(),
True)) True))
addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True) addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True)
if addressGeneratorReturnValue and addressGeneratorReturnValue[0] != 'chan name does not match address': if addressGeneratorReturnValue and addressGeneratorReturnValue[0] != 'chan name does not match address':
UISignalQueue.put(('updateStatusBar', _translate( UISignalQueue.put(('updateStatusBar', _translate(
"newchandialog", "Successfully created / joined chan %1").arg(unicode(self.chanPassPhrase.text())))) "newchandialog", "Successfully created / joined chan {0}").format(self.chanPassPhrase.text())))
self.parent.ui.tabWidget.setCurrentIndex( self.parent.ui.tabWidget.setCurrentIndex(
self.parent.ui.tabWidget.indexOf(self.parent.ui.chans) self.parent.ui.tabWidget.indexOf(self.parent.ui.chans)
) )
self.done(QtGui.QDialog.Accepted) self.done(QtWidgets.QDialog.DialogCode.Accepted)
else: else:
UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining failed"))) UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining failed")))
self.done(QtGui.QDialog.Rejected) self.done(QtWidgets.QDialog.DialogCode.Rejected)
def reject(self): def reject(self):
"""Cancel joining the chan""" """Cancel joining the chan"""
self.timer.stop() self.timer.stop()
self.hide() self.hide()
UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining cancelled"))) UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining cancelled")))
self.done(QtGui.QDialog.Rejected) self.done(QtWidgets.QDialog.DialogCode.Rejected)

View File

@ -1,7 +1,7 @@
""" """
This module setting file is for settings This module setting file is for settings
""" """
from configparser import ConfigParser import configparser
import os import os
import sys import sys
import tempfile import tempfile
@ -16,7 +16,7 @@ import openclpow
import paths import paths
import queues import queues
import state import state
import bitmessageqt.widgets import bitmessageqt.widgets as widgets
from bmconfigparser import config as config_obj from bmconfigparser import config as config_obj
from helper_sql import sqlExecute, sqlStoredProcedure from helper_sql import sqlExecute, sqlStoredProcedure
from helper_startup import start_proxyconfig from helper_startup import start_proxyconfig
@ -29,9 +29,9 @@ from tr import _translate
def getSOCKSProxyType(config): def getSOCKSProxyType(config):
"""Get user socksproxytype setting from *config*""" """Get user socksproxytype setting from *config*"""
try: try:
result = ConfigParser.SafeConfigParser.get( result = configparser.ConfigParser.get(
config, 'bitmessagesettings', 'socksproxytype') config, 'bitmessagesettings', 'socksproxytype')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError): except (configparser.NoSectionError, configparser.NoOptionError):
return None return None
else: else:
if result.lower() in ('', 'none', 'false'): if result.lower() in ('', 'none', 'false'):
@ -80,7 +80,7 @@ class SettingsDialog(QtWidgets.QDialog):
self.tabWidgetSettings.setCurrentIndex( self.tabWidgetSettings.setCurrentIndex(
self.tabWidgetSettings.indexOf(self.tabNetworkSettings) self.tabWidgetSettings.indexOf(self.tabNetworkSettings)
) )
QtGui.QWidget.resize(self, QtGui.QWidget.sizeHint(self)) QtWidgets.QWidget.resize(self, QtWidgets.QWidget.sizeHint(self))
def adjust_from_config(self, config): def adjust_from_config(self, config):
"""Adjust all widgets state according to config settings""" """Adjust all widgets state according to config settings"""
@ -163,7 +163,7 @@ class SettingsDialog(QtWidgets.QDialog):
self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex()) self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex())
if self._proxy_type: if self._proxy_type:
for node, info in six.items( for node, info in six.iteritems(
knownnodes.knownNodes.get( knownnodes.knownNodes.get(
min(state.streamsInWhichIAmParticipating), []) min(state.streamsInWhichIAmParticipating), [])
): ):
@ -348,8 +348,8 @@ class SettingsDialog(QtWidgets.QDialog):
self.config.set('bitmessagesettings', 'replybelow', str( self.config.set('bitmessagesettings', 'replybelow', str(
self.checkBoxReplyBelow.isChecked())) self.checkBoxReplyBelow.isChecked()))
lang = str(self.languageComboBox.itemData( lang = self.languageComboBox.itemData(
self.languageComboBox.currentIndex()).toString()) self.languageComboBox.currentIndex())
self.config.set('bitmessagesettings', 'userlocale', lang) self.config.set('bitmessagesettings', 'userlocale', lang)
self.parent.change_translation() self.parent.change_translation()
@ -431,7 +431,7 @@ class SettingsDialog(QtWidgets.QDialog):
self.config.set('bitmessagesettings', 'maxuploadrate', str( self.config.set('bitmessagesettings', 'maxuploadrate', str(
int(float(self.lineEditMaxUploadRate.text())))) int(float(self.lineEditMaxUploadRate.text()))))
except ValueError: except ValueError:
QtGui.QMessageBox.about( QtWidgets.QMessageBox.about(
self, _translate("MainWindow", "Number needed"), self, _translate("MainWindow", "Number needed"),
_translate( _translate(
"MainWindow", "MainWindow",
@ -472,7 +472,7 @@ class SettingsDialog(QtWidgets.QDialog):
float(self.lineEditSmallMessageDifficulty.text()) float(self.lineEditSmallMessageDifficulty.text())
* defaults.networkDefaultPayloadLengthExtraBytes))) * defaults.networkDefaultPayloadLengthExtraBytes)))
if self.comboBoxOpenCL.currentText().toUtf8() != self.config.safeGet( if self.comboBoxOpenCL.currentText() != self.config.safeGet(
'bitmessagesettings', 'opencl'): 'bitmessagesettings', 'opencl'):
self.config.set( self.config.set(
'bitmessagesettings', 'opencl', 'bitmessagesettings', 'opencl',
@ -555,7 +555,7 @@ class SettingsDialog(QtWidgets.QDialog):
if state.maximumLengthOfTimeToBotherResendingMessages < 432000: if state.maximumLengthOfTimeToBotherResendingMessages < 432000:
# If the time period is less than 5 hours, we give # If the time period is less than 5 hours, we give
# zero values to all fields. No message will be sent again. # zero values to all fields. No message will be sent again.
QtGui.QMessageBox.about( QtWidgets.QMessageBox.about(
self, self,
_translate("MainWindow", "Will not resend ever"), _translate("MainWindow", "Will not resend ever"),
_translate( _translate(

View File

@ -8,7 +8,7 @@ import time
from PyQt6 import QtCore from PyQt6 import QtCore
import bitmessageqt.account import bitmessageqt.account as account
import defaults import defaults
import network.stats import network.stats
import paths import paths
@ -72,7 +72,7 @@ def checkAddressBook(myapp):
if queryreturn == []: if queryreturn == []:
sqlExecute( sqlExecute(
'INSERT INTO addressbook VALUES (?,?)', 'INSERT INTO addressbook VALUES (?,?)',
SUPPORT_LABEL.toUtf8(), SUPPORT_ADDRESS) SUPPORT_LABEL, SUPPORT_ADDRESS)
myapp.rerenderAddressBook() myapp.rerenderAddressBook()
@ -88,7 +88,7 @@ def createAddressIfNeeded(myapp):
if not checkHasNormalAddress(): if not checkHasNormalAddress():
queues.addressGeneratorQueue.put(( queues.addressGeneratorQueue.put((
'createRandomAddress', 4, 1, 'createRandomAddress', 4, 1,
str(SUPPORT_MY_LABEL.toUtf8()), SUPPORT_MY_LABEL,
1, "", False, 1, "", False,
defaults.networkDefaultProofOfWorkNonceTrialsPerByte, defaults.networkDefaultProofOfWorkNonceTrialsPerByte,
defaults.networkDefaultPayloadLengthExtraBytes defaults.networkDefaultPayloadLengthExtraBytes
@ -107,8 +107,8 @@ def createSupportMessage(myapp):
myapp.ui.lineEditSubject.setText(SUPPORT_SUBJECT) myapp.ui.lineEditSubject.setText(SUPPORT_SUBJECT)
addrIndex = myapp.ui.comboBoxSendFrom.findData( addrIndex = myapp.ui.comboBoxSendFrom.findData(
address, QtCore.Qt.UserRole, address, QtCore.Qt.ItemDataRole.UserRole,
QtCore.Qt.MatchFixedString | QtCore.Qt.MatchCaseSensitive) QtCore.Qt.MatchFlag.MatchFixedString | QtCore.Qt.MatchFlag.MatchCaseSensitive)
if addrIndex == -1: # something is very wrong if addrIndex == -1: # something is very wrong
return return
myapp.ui.comboBoxSendFrom.setCurrentIndex(addrIndex) myapp.ui.comboBoxSendFrom.setCurrentIndex(addrIndex)
@ -149,7 +149,7 @@ def createSupportMessage(myapp):
upnp = config.safeGet('bitmessagesettings', 'upnp', "N/A") upnp = config.safeGet('bitmessagesettings', 'upnp', "N/A")
connectedhosts = len(network.stats.connectedHostsList()) connectedhosts = len(network.stats.connectedHostsList())
myapp.ui.textEditMessage.setText(unicode(SUPPORT_MESSAGE, 'utf-8').format( myapp.ui.textEditMessage.setText(SUPPORT_MESSAGE.format(
version, os, architecture, pythonversion, opensslversion, frozen, version, os, architecture, pythonversion, opensslversion, frozen,
portablemode, cpow, openclpow, locale, socks, upnp, connectedhosts)) portablemode, cpow, openclpow, locale, socks, upnp, connectedhosts))

View File

@ -213,8 +213,8 @@ class addressGenerator(StoppableThread):
'updateStatusBar', 'updateStatusBar',
_translate( _translate(
"MainWindow", "MainWindow",
"Generating %1 new addresses." "Generating {0} new addresses."
).arg(str(numberOfAddressesToMake)) ).format(numberOfAddressesToMake)
)) ))
signingKeyNonce = 0 signingKeyNonce = 0
encryptionKeyNonce = 1 encryptionKeyNonce = 1
@ -306,9 +306,9 @@ class addressGenerator(StoppableThread):
'updateStatusBar', 'updateStatusBar',
_translate( _translate(
"MainWindow", "MainWindow",
"%1 is already in 'Your Identities'." "{0} is already in 'Your Identities'."
" Not adding it again." " Not adding it again."
).arg(address) ).format(address)
)) ))
else: else:
self.logger.debug('label: %s', label) self.logger.debug('label: %s', label)

View File

@ -85,7 +85,7 @@ def random_keys():
def deterministic_keys(passphrase, nonce): def deterministic_keys(passphrase, nonce):
"""Generate keys from *passphrase* and *nonce* (encoded as varint)""" """Generate keys from *passphrase* and *nonce* (encoded as varint)"""
priv = hashlib.sha512(passphrase + nonce).digest()[:32] priv = hashlib.sha512(passphrase.encode() + nonce).digest()[:32]
pub = pointMult(priv) pub = pointMult(priv)
return priv, pub return priv, pub