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

View File

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

View File

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

View File

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

View File

@ -10,6 +10,7 @@ from PyQt6 import QtCore, QtGui, QtWidgets
from bmconfigparser import config
from .foldertree import AddressBookCompleter
from .blacklist import Blacklist
import bitmessageqt.settingsmixin as settingsmixin
from .networkstatus import NetworkStatus
class Ui_MainWindow(object):
@ -164,41 +165,41 @@ class Ui_MainWindow(object):
self.verticalLayout.setObjectName("verticalLayout")
self.tabWidgetSend = QtWidgets.QTabWidget(parent=self.send)
self.tabWidgetSend.setObjectName("tabWidgetSend")
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.gridLayout_8 = QtWidgets.QGridLayout(self.tab)
self.sendDirect = QtWidgets.QWidget()
self.sendDirect.setObjectName("sendDirect")
self.gridLayout_8 = QtWidgets.QGridLayout(self.sendDirect)
self.gridLayout_8.setObjectName("gridLayout_8")
self.verticalLayout_5 = QtWidgets.QVBoxLayout()
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2")
self.label_3 = QtWidgets.QLabel(parent=self.tab)
self.label_3 = QtWidgets.QLabel(parent=self.sendDirect)
self.label_3.setObjectName("label_3")
self.gridLayout_2.addWidget(self.label_3, 2, 0, 1, 1)
self.label_2 = QtWidgets.QLabel(parent=self.tab)
self.label_2 = QtWidgets.QLabel(parent=self.sendDirect)
self.label_2.setObjectName("label_2")
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
self.lineEditSubject = QtWidgets.QLineEdit(parent=self.tab)
self.lineEditSubject = QtWidgets.QLineEdit(parent=self.sendDirect)
self.lineEditSubject.setText("")
self.lineEditSubject.setObjectName("lineEditSubject")
self.gridLayout_2.addWidget(self.lineEditSubject, 2, 1, 1, 1)
self.label = QtWidgets.QLabel(parent=self.tab)
self.label = QtWidgets.QLabel(parent=self.sendDirect)
self.label.setObjectName("label")
self.gridLayout_2.addWidget(self.label, 1, 0, 1, 1)
self.comboBoxSendFrom = QtWidgets.QComboBox(parent=self.tab)
self.comboBoxSendFrom = QtWidgets.QComboBox(parent=self.sendDirect)
self.comboBoxSendFrom.setMinimumSize(QtCore.QSize(300, 0))
self.comboBoxSendFrom.setObjectName("comboBoxSendFrom")
self.gridLayout_2.addWidget(self.comboBoxSendFrom, 0, 1, 1, 1)
self.lineEditTo = QtWidgets.QLineEdit(parent=self.tab)
self.lineEditTo = QtWidgets.QLineEdit(parent=self.sendDirect)
self.lineEditTo.setObjectName("lineEditTo")
self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1)
self.lineEditTo.setCompleter(self.addressBookCompleter)
self.verticalLayout_5.addLayout(self.gridLayout_2)
self.textEditMessage = QtWidgets.QTextEdit(parent=self.tab)
self.textEditMessage = QtWidgets.QTextEdit(parent=self.sendDirect)
self.textEditMessage.setObjectName("textEditMessage")
self.verticalLayout_5.addWidget(self.textEditMessage)
self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1)
self.tabWidgetSend.addTab(self.tab, "")
self.tabWidgetSend.addTab(self.sendDirect, "")
self.tab_2 = QtWidgets.QWidget()
self.tab_2.setObjectName("tab_2")
self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_2)
@ -360,15 +361,15 @@ class Ui_MainWindow(object):
icon6 = QtGui.QIcon()
icon6.addPixmap(QtGui.QPixmap(":/newPrefix/images/subscriptions.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.tabWidget.addTab(self.subscriptions, icon6, "")
self.tab_3 = QtWidgets.QWidget()
self.tab_3.setObjectName("tab_3")
self.gridLayout_4 = QtWidgets.QGridLayout(self.tab_3)
self.chans = QtWidgets.QWidget()
self.chans.setObjectName("chans")
self.gridLayout_4 = QtWidgets.QGridLayout(self.chans)
self.gridLayout_4.setObjectName("gridLayout_4")
self.horizontalLayout_7 = QtWidgets.QHBoxLayout()
self.horizontalLayout_7.setObjectName("horizontalLayout_7")
self.verticalLayout_17 = QtWidgets.QVBoxLayout()
self.verticalLayout_17.setObjectName("verticalLayout_17")
self.treeWidgetChans = QtWidgets.QTreeWidget(parent=self.tab_3)
self.treeWidgetChans = QtWidgets.QTreeWidget(parent=self.chans)
self.treeWidgetChans.setMaximumSize(QtCore.QSize(200, 16777215))
self.treeWidgetChans.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken)
self.treeWidgetChans.setLineWidth(1)
@ -380,7 +381,7 @@ class Ui_MainWindow(object):
icon7.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Selected, QtGui.QIcon.State.Off)
self.treeWidgetChans.headerItem().setIcon(0, icon7)
self.verticalLayout_17.addWidget(self.treeWidgetChans)
self.pushButtonAddChan = QtWidgets.QPushButton(parent=self.tab_3)
self.pushButtonAddChan = QtWidgets.QPushButton(parent=self.chans)
self.pushButtonAddChan.setMaximumSize(QtCore.QSize(200, 16777215))
self.pushButtonAddChan.setObjectName("pushButtonAddChan")
self.verticalLayout_17.addWidget(self.pushButtonAddChan)
@ -389,10 +390,10 @@ class Ui_MainWindow(object):
self.verticalLayout_8.setObjectName("verticalLayout_8")
self.horizontalLayout_6 = QtWidgets.QHBoxLayout()
self.horizontalLayout_6.setObjectName("horizontalLayout_6")
self.inboxSearchLineEditChans = QtWidgets.QLineEdit(parent=self.tab_3)
self.inboxSearchLineEditChans = QtWidgets.QLineEdit(parent=self.chans)
self.inboxSearchLineEditChans.setObjectName("inboxSearchLineEditChans")
self.horizontalLayout_6.addWidget(self.inboxSearchLineEditChans)
self.inboxSearchOptionChans = QtWidgets.QComboBox(parent=self.tab_3)
self.inboxSearchOptionChans = QtWidgets.QComboBox(parent=self.chans)
self.inboxSearchOptionChans.setObjectName("inboxSearchOptionChans")
self.inboxSearchOptionChans.addItem("")
self.inboxSearchOptionChans.addItem("")
@ -401,7 +402,7 @@ class Ui_MainWindow(object):
self.inboxSearchOptionChans.addItem("")
self.horizontalLayout_6.addWidget(self.inboxSearchOptionChans)
self.verticalLayout_8.addLayout(self.horizontalLayout_6)
self.tableWidgetInboxChans = QtWidgets.QTableWidget(parent=self.tab_3)
self.tableWidgetInboxChans = QtWidgets.QTableWidget(parent=self.chans)
self.tableWidgetInboxChans.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers)
self.tableWidgetInboxChans.setAlternatingRowColors(True)
self.tableWidgetInboxChans.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection)
@ -427,7 +428,7 @@ class Ui_MainWindow(object):
self.tableWidgetInboxChans.verticalHeader().setVisible(False)
self.tableWidgetInboxChans.verticalHeader().setDefaultSectionSize(26)
self.verticalLayout_8.addWidget(self.tableWidgetInboxChans)
self.textEditInboxMessageChans = QtWidgets.QTextEdit(parent=self.tab_3)
self.textEditInboxMessageChans = QtWidgets.QTextEdit(parent=self.chans)
self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500))
self.textEditInboxMessageChans.setReadOnly(True)
self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans")
@ -436,7 +437,7 @@ class Ui_MainWindow(object):
self.gridLayout_4.addLayout(self.horizontalLayout_7, 0, 0, 1, 1)
icon8 = QtGui.QIcon()
icon8.addPixmap(QtGui.QPixmap(":/newPrefix/images/can-icon-16px.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.tabWidget.addTab(self.tab_3, icon8, "")
self.tabWidget.addTab(self.chans, icon8, "")
self.blackwhitelist = Blacklist()
self.blackwhitelist.setObjectName("blackwhitelist")
self.tabWidget.addTab(self.blackwhitelist, QtGui.QIcon(":/newPrefix/images/blacklist.png"), "")
@ -445,108 +446,8 @@ class Ui_MainWindow(object):
self.blackwhitelist.radioButtonWhitelist.click()
self.blackwhitelist.rerenderBlackWhiteList()
self.gridLayout_6 = QtWidgets.QGridLayout(self.blackwhitelist)
self.gridLayout_6.setObjectName("gridLayout_6")
self.radioButtonBlacklist = QtWidgets.QRadioButton(parent=self.blackwhitelist)
self.radioButtonBlacklist.setChecked(True)
self.radioButtonBlacklist.setObjectName("radioButtonBlacklist")
self.gridLayout_6.addWidget(self.radioButtonBlacklist, 0, 0, 1, 2)
self.radioButtonWhitelist = QtWidgets.QRadioButton(parent=self.blackwhitelist)
self.radioButtonWhitelist.setObjectName("radioButtonWhitelist")
self.gridLayout_6.addWidget(self.radioButtonWhitelist, 1, 0, 1, 2)
self.pushButtonAddBlacklist = QtWidgets.QPushButton(parent=self.blackwhitelist)
self.pushButtonAddBlacklist.setObjectName("pushButtonAddBlacklist")
self.gridLayout_6.addWidget(self.pushButtonAddBlacklist, 2, 0, 1, 1)
spacerItem = QtWidgets.QSpacerItem(689, 20, QtWidgets.QSizePolicy.Policy.Expanding, QtWidgets.QSizePolicy.Policy.Minimum)
self.gridLayout_6.addItem(spacerItem, 2, 1, 1, 1)
self.tableWidgetBlacklist = QtWidgets.QTableWidget(parent=self.blackwhitelist)
self.tableWidgetBlacklist.setAlternatingRowColors(True)
self.tableWidgetBlacklist.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.SingleSelection)
self.tableWidgetBlacklist.setSelectionBehavior(QtWidgets.QAbstractItemView.SelectionBehavior.SelectRows)
self.tableWidgetBlacklist.setObjectName("tableWidgetBlacklist")
self.tableWidgetBlacklist.setColumnCount(2)
self.tableWidgetBlacklist.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.tableWidgetBlacklist.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidgetBlacklist.setHorizontalHeaderItem(1, item)
self.tableWidgetBlacklist.horizontalHeader().setCascadingSectionResizes(True)
self.tableWidgetBlacklist.horizontalHeader().setDefaultSectionSize(400)
self.tableWidgetBlacklist.horizontalHeader().setHighlightSections(False)
self.tableWidgetBlacklist.horizontalHeader().setSortIndicatorShown(False)
self.tableWidgetBlacklist.horizontalHeader().setStretchLastSection(True)
self.tableWidgetBlacklist.verticalHeader().setVisible(False)
self.gridLayout_6.addWidget(self.tableWidgetBlacklist, 3, 0, 1, 2)
icon9 = QtGui.QIcon()
icon9.addPixmap(QtGui.QPixmap(":/newPrefix/images/blacklist.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.tabWidget.addTab(self.blackwhitelist, icon9, "")
self.networkstatus = NetworkStatus()
self.tabWidget.addTab(self.networkstatus, QtGui.QIcon(":/newPrefix/images/networkstatus.png"), "")
self.networkstatus.setObjectName("networkstatus")
self.pushButtonStatusIcon = QtWidgets.QPushButton(parent=self.networkstatus)
self.pushButtonStatusIcon.setGeometry(QtCore.QRect(680, 440, 21, 23))
self.pushButtonStatusIcon.setText("")
icon10 = QtGui.QIcon()
icon10.addPixmap(QtGui.QPixmap(":/newPrefix/images/redicon.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.pushButtonStatusIcon.setIcon(icon10)
self.pushButtonStatusIcon.setFlat(True)
self.pushButtonStatusIcon.setObjectName("pushButtonStatusIcon")
self.tableWidgetConnectionCount = QtWidgets.QTableWidget(parent=self.networkstatus)
self.tableWidgetConnectionCount.setGeometry(QtCore.QRect(20, 70, 241, 241))
palette = QtGui.QPalette()
brush = QtGui.QBrush(QtGui.QColor(212, 208, 200))
brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern)
palette.setBrush(QtGui.QPalette.ColorGroup.Active, QtGui.QPalette.ColorRole.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(212, 208, 200))
brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern)
palette.setBrush(QtGui.QPalette.ColorGroup.Inactive, QtGui.QPalette.ColorRole.Base, brush)
brush = QtGui.QBrush(QtGui.QColor(212, 208, 200))
brush.setStyle(QtCore.Qt.BrushStyle.SolidPattern)
palette.setBrush(QtGui.QPalette.ColorGroup.Disabled, QtGui.QPalette.ColorRole.Base, brush)
self.tableWidgetConnectionCount.setPalette(palette)
self.tableWidgetConnectionCount.setFrameShape(QtWidgets.QFrame.Shape.Box)
self.tableWidgetConnectionCount.setFrameShadow(QtWidgets.QFrame.Shadow.Plain)
self.tableWidgetConnectionCount.setProperty("showDropIndicator", False)
self.tableWidgetConnectionCount.setAlternatingRowColors(True)
self.tableWidgetConnectionCount.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.NoSelection)
self.tableWidgetConnectionCount.setObjectName("tableWidgetConnectionCount")
self.tableWidgetConnectionCount.setColumnCount(2)
self.tableWidgetConnectionCount.setRowCount(0)
item = QtWidgets.QTableWidgetItem()
self.tableWidgetConnectionCount.setHorizontalHeaderItem(0, item)
item = QtWidgets.QTableWidgetItem()
self.tableWidgetConnectionCount.setHorizontalHeaderItem(1, item)
self.tableWidgetConnectionCount.horizontalHeader().setCascadingSectionResizes(True)
self.tableWidgetConnectionCount.horizontalHeader().setHighlightSections(False)
self.tableWidgetConnectionCount.horizontalHeader().setStretchLastSection(True)
self.tableWidgetConnectionCount.verticalHeader().setVisible(False)
self.labelTotalConnections = QtWidgets.QLabel(parent=self.networkstatus)
self.labelTotalConnections.setGeometry(QtCore.QRect(20, 30, 401, 16))
self.labelTotalConnections.setObjectName("labelTotalConnections")
self.labelStartupTime = QtWidgets.QLabel(parent=self.networkstatus)
self.labelStartupTime.setGeometry(QtCore.QRect(320, 110, 331, 20))
self.labelStartupTime.setObjectName("labelStartupTime")
self.labelMessageCount = QtWidgets.QLabel(parent=self.networkstatus)
self.labelMessageCount.setGeometry(QtCore.QRect(350, 130, 361, 16))
self.labelMessageCount.setObjectName("labelMessageCount")
self.labelPubkeyCount = QtWidgets.QLabel(parent=self.networkstatus)
self.labelPubkeyCount.setGeometry(QtCore.QRect(350, 170, 331, 16))
self.labelPubkeyCount.setObjectName("labelPubkeyCount")
self.labelBroadcastCount = QtWidgets.QLabel(parent=self.networkstatus)
self.labelBroadcastCount.setGeometry(QtCore.QRect(350, 150, 351, 16))
self.labelBroadcastCount.setObjectName("labelBroadcastCount")
self.labelLookupsPerSecond = QtWidgets.QLabel(parent=self.networkstatus)
self.labelLookupsPerSecond.setGeometry(QtCore.QRect(320, 250, 291, 16))
self.labelLookupsPerSecond.setObjectName("labelLookupsPerSecond")
self.labelBytesRecvCount = QtWidgets.QLabel(parent=self.networkstatus)
self.labelBytesRecvCount.setGeometry(QtCore.QRect(350, 210, 251, 16))
self.labelBytesRecvCount.setObjectName("labelBytesRecvCount")
self.labelBytesSentCount = QtWidgets.QLabel(parent=self.networkstatus)
self.labelBytesSentCount.setGeometry(QtCore.QRect(350, 230, 251, 16))
self.labelBytesSentCount.setObjectName("labelBytesSentCount")
icon11 = QtGui.QIcon()
icon11.addPixmap(QtGui.QPixmap(":/newPrefix/images/networkstatus.png"), QtGui.QIcon.Mode.Normal, QtGui.QIcon.State.Off)
self.tabWidget.addTab(self.networkstatus, icon11, "")
self.gridLayout_10.addWidget(self.tabWidget, 0, 0, 1, 1)
self.MainDock.setWidget(self.centralwidget)
MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea.AllDockWidgetAreas, self.MainDock)
@ -620,8 +521,12 @@ class Ui_MainWindow(object):
self.menubar.addAction(self.menuHelp.menuAction())
self.retranslateUi(MainWindow)
self.tabWidget.setCurrentIndex(0)
self.tabWidgetSend.setCurrentIndex(0)
self.tabWidget.setCurrentIndex(
self.tabWidget.indexOf(self.inbox)
)
self.tabWidgetSend.setCurrentIndex(
self.tabWidgetSend.indexOf(self.sendDirect)
)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage)
MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom)
@ -630,12 +535,6 @@ class Ui_MainWindow(object):
MainWindow.setTabOrder(self.lineEditSubject, self.textEditMessage)
MainWindow.setTabOrder(self.textEditMessage, self.pushButtonSend)
MainWindow.setTabOrder(self.pushButtonSend, self.pushButtonAddSubscription)
MainWindow.setTabOrder(self.pushButtonAddSubscription, self.radioButtonBlacklist)
MainWindow.setTabOrder(self.radioButtonBlacklist, self.radioButtonWhitelist)
MainWindow.setTabOrder(self.radioButtonWhitelist, self.pushButtonAddBlacklist)
MainWindow.setTabOrder(self.pushButtonAddBlacklist, self.tableWidgetBlacklist)
MainWindow.setTabOrder(self.tableWidgetBlacklist, self.tableWidgetConnectionCount)
MainWindow.setTabOrder(self.tableWidgetConnectionCount, self.pushButtonStatusIcon)
# Popup menu actions container for the Sent page
# pylint: disable=attribute-defined-outside-init
@ -693,7 +592,7 @@ class Ui_MainWindow(object):
"p, li { white-space: pre-wrap; }\n"
"</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"
@ -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>"))
self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers"))
self.pushButtonTTL.setText(_translate("MainWindow", "TTL:"))
self.labelHumanFriendlyTTLDescription.setText(_translate("MainWindow", "X days"))
self.pushButtonClear.setText(_translate("MainWindow", "Clear"))
self.pushButtonSend.setText(_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 = self.tableWidgetInboxChans.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Received"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _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.tabWidget.setTabText(self.tabWidget.indexOf(self.chans), _translate("MainWindow", "Chans"))
self.networkstatus.retranslateUi()
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.menuSettings.setTitle(_translate("MainWindow", "Settings"))
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 2024-05-13 09:48:39.354481762 +0900
@@ -7,7 +7,10 @@
+++ bitmessageui.py 2024-05-14 15:56:24.921713575 +0900
@@ -7,7 +7,11 @@
from PyQt6 import QtCore, QtGui, QtWidgets
@ -8,11 +8,12 @@
+from bmconfigparser import config
+from .foldertree import AddressBookCompleter
+from .blacklist import Blacklist
+import bitmessageqt.settingsmixin as settingsmixin
+from .networkstatus import NetworkStatus
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
@@ -140,6 +143,11 @@
@@ -140,6 +144,11 @@
self.tableWidgetAddressBook.horizontalHeader().setStretchLastSection(True)
self.tableWidgetAddressBook.verticalHeader().setVisible(False)
self.verticalLayout_2.addWidget(self.tableWidgetAddressBook)
@ -24,15 +25,60 @@
self.pushButtonAddAddressBook = QtWidgets.QPushButton(parent=self.send)
self.pushButtonAddAddressBook.setMaximumSize(QtCore.QSize(200, 16777215))
self.pushButtonAddAddressBook.setObjectName("pushButtonAddAddressBook")
@@ -184,6 +192,7 @@
self.lineEditTo = QtWidgets.QLineEdit(parent=self.tab)
@@ -156,40 +165,41 @@
self.verticalLayout.setObjectName("verticalLayout")
self.tabWidgetSend = QtWidgets.QTabWidget(parent=self.send)
self.tabWidgetSend.setObjectName("tabWidgetSend")
- self.tab = QtWidgets.QWidget()
- self.tab.setObjectName("tab")
- self.gridLayout_8 = QtWidgets.QGridLayout(self.tab)
+ self.sendDirect = QtWidgets.QWidget()
+ self.sendDirect.setObjectName("sendDirect")
+ self.gridLayout_8 = QtWidgets.QGridLayout(self.sendDirect)
self.gridLayout_8.setObjectName("gridLayout_8")
self.verticalLayout_5 = QtWidgets.QVBoxLayout()
self.verticalLayout_5.setObjectName("verticalLayout_5")
self.gridLayout_2 = QtWidgets.QGridLayout()
self.gridLayout_2.setObjectName("gridLayout_2")
- self.label_3 = QtWidgets.QLabel(parent=self.tab)
+ self.label_3 = QtWidgets.QLabel(parent=self.sendDirect)
self.label_3.setObjectName("label_3")
self.gridLayout_2.addWidget(self.label_3, 2, 0, 1, 1)
- self.label_2 = QtWidgets.QLabel(parent=self.tab)
+ self.label_2 = QtWidgets.QLabel(parent=self.sendDirect)
self.label_2.setObjectName("label_2")
self.gridLayout_2.addWidget(self.label_2, 0, 0, 1, 1)
- self.lineEditSubject = QtWidgets.QLineEdit(parent=self.tab)
+ self.lineEditSubject = QtWidgets.QLineEdit(parent=self.sendDirect)
self.lineEditSubject.setText("")
self.lineEditSubject.setObjectName("lineEditSubject")
self.gridLayout_2.addWidget(self.lineEditSubject, 2, 1, 1, 1)
- self.label = QtWidgets.QLabel(parent=self.tab)
+ self.label = QtWidgets.QLabel(parent=self.sendDirect)
self.label.setObjectName("label")
self.gridLayout_2.addWidget(self.label, 1, 0, 1, 1)
- self.comboBoxSendFrom = QtWidgets.QComboBox(parent=self.tab)
+ self.comboBoxSendFrom = QtWidgets.QComboBox(parent=self.sendDirect)
self.comboBoxSendFrom.setMinimumSize(QtCore.QSize(300, 0))
self.comboBoxSendFrom.setObjectName("comboBoxSendFrom")
self.gridLayout_2.addWidget(self.comboBoxSendFrom, 0, 1, 1, 1)
- self.lineEditTo = QtWidgets.QLineEdit(parent=self.tab)
+ self.lineEditTo = QtWidgets.QLineEdit(parent=self.sendDirect)
self.lineEditTo.setObjectName("lineEditTo")
self.gridLayout_2.addWidget(self.lineEditTo, 1, 1, 1, 1)
+ self.lineEditTo.setCompleter(self.addressBookCompleter)
self.verticalLayout_5.addLayout(self.gridLayout_2)
self.textEditMessage = QtWidgets.QTextEdit(parent=self.tab)
- self.textEditMessage = QtWidgets.QTextEdit(parent=self.tab)
+ self.textEditMessage = QtWidgets.QTextEdit(parent=self.sendDirect)
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.setObjectName("labelHumanFriendlyTTLDescription")
self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription)
@ -42,34 +88,184 @@
self.pushButtonSend = QtWidgets.QPushButton(parent=self.send)
self.pushButtonSend.setMaximumSize(QtCore.QSize(16777215, 16777215))
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.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.tabWidget.addTab(self.chans, icon8, "")
+ self.blackwhitelist = Blacklist()
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"), "")
+ # Initialize the Blacklist or Whitelist
+ if config.get('bitmessagesettings', 'blackwhitelist') == 'white':
+ self.blackwhitelist.radioButtonWhitelist.click()
+ self.blackwhitelist.rerenderBlackWhiteList()
+
self.gridLayout_6 = QtWidgets.QGridLayout(self.blackwhitelist)
self.gridLayout_6.setObjectName("gridLayout_6")
self.radioButtonBlacklist = QtWidgets.QRadioButton(parent=self.blackwhitelist)
@@ -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.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.MainDock.setWidget(self.centralwidget)
- MainWindow.addDockWidget(QtCore.Qt.DockWidgetArea(None), self.MainDock)
@ -77,7 +273,7 @@
self.menubar = QtWidgets.QMenuBar(parent=MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 885, 27))
self.menubar.setObjectName("menubar")
@@ -550,6 +569,8 @@
@@ -550,6 +470,8 @@
self.actionManageKeys = QtGui.QAction(parent=MainWindow)
self.actionManageKeys.setCheckable(False)
self.actionManageKeys.setEnabled(True)
@ -86,7 +282,7 @@
icon = QtGui.QIcon.fromTheme("dialog-password")
self.actionManageKeys.setIcon(icon)
self.actionManageKeys.setObjectName("actionManageKeys")
@@ -561,6 +582,10 @@
@@ -561,6 +483,10 @@
icon = QtGui.QIcon.fromTheme("help-contents")
self.actionHelp.setIcon(icon)
self.actionHelp.setObjectName("actionHelp")
@ -97,7 +293,7 @@
self.actionAbout = QtGui.QAction(parent=MainWindow)
icon = QtGui.QIcon.fromTheme("help-about")
self.actionAbout.setIcon(icon)
@@ -584,9 +609,11 @@
@@ -584,17 +510,23 @@
self.menuFile.addAction(self.actionManageKeys)
self.menuFile.addAction(self.actionDeleteAllTrashedMessages)
self.menuFile.addAction(self.actionRegenerateDeterministicAddresses)
@ -109,10 +305,31 @@
self.menuHelp.addAction(self.actionAbout)
self.menubar.addAction(self.menuFile.menuAction())
self.menubar.addAction(self.menuSettings.menuAction())
@@ -610,6 +637,26 @@
MainWindow.setTabOrder(self.tableWidgetBlacklist, self.tableWidgetConnectionCount)
MainWindow.setTabOrder(self.tableWidgetConnectionCount, self.pushButtonStatusIcon)
self.menubar.addAction(self.menuHelp.menuAction())
self.retranslateUi(MainWindow)
- self.tabWidget.setCurrentIndex(0)
- self.tabWidgetSend.setCurrentIndex(0)
+ self.tabWidget.setCurrentIndex(
+ self.tabWidget.indexOf(self.inbox)
+ )
+ self.tabWidgetSend.setCurrentIndex(
+ self.tabWidgetSend.indexOf(self.sendDirect)
+ )
QtCore.QMetaObject.connectSlotsByName(MainWindow)
MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage)
MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom)
@@ -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
+ # pylint: disable=attribute-defined-outside-init
+ self.sentContextMenuToolbar = QtWidgets.QToolBar()
@ -132,30 +349,59 @@
+ if dontconnect else
+ _translate("MainWindow", "Go offline", None)
+ )
+
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
self.MainDock.setWindowTitle(_translate("MainWindow", "Bitmessage"))
@@ -657,6 +704,7 @@
@@ -646,7 +592,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.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.pushButtonSend.setText(_translate("MainWindow", "Send"))
self.tabWidget.setTabText(self.tabWidget.indexOf(self.send), _translate("MainWindow", "Send"))
self.treeWidgetSubscriptions.headerItem().setText(0, _translate("MainWindow", "Subscriptions"))
@@ -703,7 +751,10 @@
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"))
@@ -694,28 +640,8 @@
item.setText(_translate("MainWindow", "Subject"))
item = self.tableWidgetInboxChans.horizontalHeaderItem(3)
item.setText(_translate("MainWindow", "Received"))
- self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _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.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.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)
@@ -726,8 +777,10 @@
self.tabWidget.setTabText(self.tabWidget.indexOf(self.networkstatus), _translate("MainWindow", "Network Status"))
self.menuFile.setTitle(_translate("MainWindow", "File"))
self.menuSettings.setTitle(_translate("MainWindow", "Settings"))
@@ -726,8 +652,10 @@
self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q"))
self.actionHelp.setText(_translate("MainWindow", "Help"))
self.actionHelp.setShortcut(_translate("MainWindow", "F1"))

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ src/bitmessageqt/newchandialog.py
from PyQt6 import QtCore, QtGui, QtWidgets
import bitmessageqt.widgets
import bitmessageqt.widgets as widgets
from addresses import addBMIfNotPresent
from .addressvalidator import AddressValidator, PassPhraseValidator
from queues import (
@ -21,30 +21,33 @@ class NewChanDialog(QtWidgets.QDialog):
super(NewChanDialog, self).__init__(parent)
widgets.load('newchandialog.ui', self)
self.parent = parent
self.chanAddress.setValidator(
AddressValidator(
self.chanAddress,
self.chanPassPhrase,
self.validatorFeedback,
self.buttonBox,
False))
self.chanPassPhrase.setValidator(
PassPhraseValidator(
self.chanPassPhrase,
self.chanAddress,
self.validatorFeedback,
self.buttonBox,
False))
# XXX unresolved
#self.chanAddress.setValidator(
# AddressValidator(
# self.chanAddress,
# self.chanPassPhrase,
# self.validatorFeedback,
# self.buttonBox,
# False))
# XXX unresolved
#self.chanPassPhrase.setValidator(
# PassPhraseValidator(
# self.chanPassPhrase,
# self.chanAddress,
# self.validatorFeedback,
# self.buttonBox,
# False))
self.timer = QtCore.QTimer()
QtCore.QObject.connect( # pylint: disable=no-member
self.timer, QtCore.SIGNAL("timeout()"), self.delayedUpdateStatus)
self.timer.timeout.connect(self.delayedUpdateStatus)
self.timer.start(500) # milliseconds
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
self.setAttribute(QtCore.Qt.WidgetAttribute.WA_DeleteOnClose)
self.show()
def delayedUpdateStatus(self):
"""Related to updating the UI for the chan passphrase validity"""
# XXX unresolved
return
self.chanPassPhrase.validator().checkQueue()
def accept(self):
@ -52,32 +55,32 @@ class NewChanDialog(QtWidgets.QDialog):
self.timer.stop()
self.hide()
apiAddressGeneratorReturnQueue.queue.clear()
if self.chanAddress.text().toUtf8() == "":
if self.chanAddress.text() == "":
addressGeneratorQueue.put(
('createChan', 4, 1, str_chan + ' ' + str(self.chanPassPhrase.text().toUtf8()),
self.chanPassPhrase.text().toUtf8(),
('createChan', 4, 1, str_chan + ' ' + self.chanPassPhrase.text(),
self.chanPassPhrase.text(),
True))
else:
addressGeneratorQueue.put(
('joinChan', addBMIfNotPresent(self.chanAddress.text().toUtf8()),
str_chan + ' ' + str(self.chanPassPhrase.text().toUtf8()),
self.chanPassPhrase.text().toUtf8(),
('joinChan', addBMIfNotPresent(self.chanAddress.text()),
str_chan + ' ' + self.chanPassPhrase.text(),
self.chanPassPhrase.text(),
True))
addressGeneratorReturnValue = apiAddressGeneratorReturnQueue.get(True)
if addressGeneratorReturnValue and addressGeneratorReturnValue[0] != 'chan name does not match address':
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.indexOf(self.parent.ui.chans)
)
self.done(QtGui.QDialog.Accepted)
self.done(QtWidgets.QDialog.DialogCode.Accepted)
else:
UISignalQueue.put(('updateStatusBar', _translate("newchandialog", "Chan creation / joining failed")))
self.done(QtGui.QDialog.Rejected)
self.done(QtWidgets.QDialog.DialogCode.Rejected)
def reject(self):
"""Cancel joining the chan"""
self.timer.stop()
self.hide()
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
"""
from configparser import ConfigParser
import configparser
import os
import sys
import tempfile
@ -16,7 +16,7 @@ import openclpow
import paths
import queues
import state
import bitmessageqt.widgets
import bitmessageqt.widgets as widgets
from bmconfigparser import config as config_obj
from helper_sql import sqlExecute, sqlStoredProcedure
from helper_startup import start_proxyconfig
@ -29,9 +29,9 @@ from tr import _translate
def getSOCKSProxyType(config):
"""Get user socksproxytype setting from *config*"""
try:
result = ConfigParser.SafeConfigParser.get(
result = configparser.ConfigParser.get(
config, 'bitmessagesettings', 'socksproxytype')
except (ConfigParser.NoSectionError, ConfigParser.NoOptionError):
except (configparser.NoSectionError, configparser.NoOptionError):
return None
else:
if result.lower() in ('', 'none', 'false'):
@ -80,7 +80,7 @@ class SettingsDialog(QtWidgets.QDialog):
self.tabWidgetSettings.setCurrentIndex(
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):
"""Adjust all widgets state according to config settings"""
@ -163,7 +163,7 @@ class SettingsDialog(QtWidgets.QDialog):
self.comboBoxProxyTypeChanged(self.comboBoxProxyType.currentIndex())
if self._proxy_type:
for node, info in six.items(
for node, info in six.iteritems(
knownnodes.knownNodes.get(
min(state.streamsInWhichIAmParticipating), [])
):
@ -348,8 +348,8 @@ class SettingsDialog(QtWidgets.QDialog):
self.config.set('bitmessagesettings', 'replybelow', str(
self.checkBoxReplyBelow.isChecked()))
lang = str(self.languageComboBox.itemData(
self.languageComboBox.currentIndex()).toString())
lang = self.languageComboBox.itemData(
self.languageComboBox.currentIndex())
self.config.set('bitmessagesettings', 'userlocale', lang)
self.parent.change_translation()
@ -431,7 +431,7 @@ class SettingsDialog(QtWidgets.QDialog):
self.config.set('bitmessagesettings', 'maxuploadrate', str(
int(float(self.lineEditMaxUploadRate.text()))))
except ValueError:
QtGui.QMessageBox.about(
QtWidgets.QMessageBox.about(
self, _translate("MainWindow", "Number needed"),
_translate(
"MainWindow",
@ -472,7 +472,7 @@ class SettingsDialog(QtWidgets.QDialog):
float(self.lineEditSmallMessageDifficulty.text())
* defaults.networkDefaultPayloadLengthExtraBytes)))
if self.comboBoxOpenCL.currentText().toUtf8() != self.config.safeGet(
if self.comboBoxOpenCL.currentText() != self.config.safeGet(
'bitmessagesettings', 'opencl'):
self.config.set(
'bitmessagesettings', 'opencl',
@ -555,7 +555,7 @@ class SettingsDialog(QtWidgets.QDialog):
if state.maximumLengthOfTimeToBotherResendingMessages < 432000:
# If the time period is less than 5 hours, we give
# zero values to all fields. No message will be sent again.
QtGui.QMessageBox.about(
QtWidgets.QMessageBox.about(
self,
_translate("MainWindow", "Will not resend ever"),
_translate(

View File

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

View File

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

View File

@ -85,7 +85,7 @@ def random_keys():
def deterministic_keys(passphrase, nonce):
"""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)
return priv, pub