diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 7b684ff5..a4aac2e8 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -1428,7 +1428,7 @@ class MyForm(settingsmixin.SMainWindow): # addressbook def addressbookKeyPressEvent(self, event): """Handle keypress event in addressbook widget""" - if event.key() == QtCore.Qt.Key_Delete: + if event.key() == QtCore.Qt.Key.Key_Delete: self.on_action_AddressBookDelete() else: return QtWidgets.QTableWidget.keyPressEvent( @@ -1445,7 +1445,7 @@ class MyForm(settingsmixin.SMainWindow): def handleKeyPress(self, event, focus=None): """This method handles keypress events for all widgets on MyForm""" messagelist = self.getCurrentMessagelist() - if event.key() == QtCore.Qt.Key_Delete: + if event.key() == QtCore.Qt.Key.Key_Delete: if isinstance(focus, (MessageView, QtWidgets.QTableWidget)): folder = self.getCurrentFolder() if folder == "sent": @@ -1453,24 +1453,24 @@ class MyForm(settingsmixin.SMainWindow): else: self.on_action_InboxTrash() event.ignore() - elif QtWidgets.QApplication.queryKeyboardModifiers() == QtCore.Qt.NoModifier: - if event.key() == QtCore.Qt.Key_N: + elif QtWidgets.QApplication.queryKeyboardModifiers() == QtCore.Qt.KeyboardModifier.NoModifier: + if event.key() == QtCore.Qt.Key.Key_N: currentRow = messagelist.currentRow() if currentRow < messagelist.rowCount() - 1: messagelist.selectRow(currentRow + 1) event.ignore() - elif event.key() == QtCore.Qt.Key_P: + elif event.key() == QtCore.Qt.Key.Key_P: currentRow = messagelist.currentRow() if currentRow > 0: messagelist.selectRow(currentRow - 1) event.ignore() - elif event.key() == QtCore.Qt.Key_R: + elif event.key() == QtCore.Qt.Key.Key_R: if messagelist == self.ui.tableWidgetInboxChans: self.on_action_InboxReplyChan() else: self.on_action_InboxReply() event.ignore() - elif event.key() == QtCore.Qt.Key_C: + elif event.key() == QtCore.Qt.Key.Key_C: currentAddress = self.getCurrentAccount() if currentAddress: self.setSendFromComboBox(currentAddress) @@ -1482,7 +1482,7 @@ class MyForm(settingsmixin.SMainWindow): ) self.ui.lineEditTo.setFocus() event.ignore() - elif event.key() == QtCore.Qt.Key_F: + elif event.key() == QtCore.Qt.Key.Key_F: try: self.getCurrentSearchLine(retObj=True).setFocus() except AttributeError: @@ -2861,7 +2861,7 @@ class MyForm(settingsmixin.SMainWindow): content = ' '.join(lines) # To keep the whitespace between lines content = shared.fixPotentiallyInvalidUTF8Data(content) content = content - textEdit.setHtml(QtCore.QString(content)) + textEdit.setHtml(content) def on_action_InboxMarkUnread(self): tableWidget = self.getCurrentMessagelist() @@ -2928,7 +2928,7 @@ class MyForm(settingsmixin.SMainWindow): self.ui.comboBoxSendFrom, self.ui.comboBoxSendFromBroadcast ): for i in range(box.count()): - if str(box.itemData(i).toPyObject()) == address: + if box.itemData(i) == address: box.setCurrentIndex(i) break else: @@ -4071,7 +4071,7 @@ class MyForm(settingsmixin.SMainWindow): messageTextedit.setCurrentFont(QtGui.QFont()) messageTextedit.setTextColor(QtGui.QColor()) - messageTextedit.setPlainText(message) + messageTextedit.setContent(message) def tableWidgetAddressBookItemChanged(self, item): if item.type == AccountMixin.CHAN: diff --git a/src/bitmessageqt/bitmessageui.py b/src/bitmessageqt/bitmessageui.py index 139090b1..2d4ce3ee 100644 --- a/src/bitmessageqt/bitmessageui.py +++ b/src/bitmessageqt/bitmessageui.py @@ -9,9 +9,11 @@ from PyQt6 import QtCore, QtGui, QtWidgets from bmconfigparser import config from .foldertree import AddressBookCompleter -from .blacklist import Blacklist +from .messageview import MessageView +from .messagecompose import MessageCompose import bitmessageqt.settingsmixin as settingsmixin from .networkstatus import NetworkStatus +from .blacklist import Blacklist class Ui_MainWindow(object): def setupUi(self, MainWindow): @@ -105,7 +107,7 @@ class Ui_MainWindow(object): self.tableWidgetInbox.verticalHeader().setVisible(False) self.tableWidgetInbox.verticalHeader().setDefaultSectionSize(26) self.verticalLayout_7.addWidget(self.tableWidgetInbox) - self.textEditInboxMessage = QtWidgets.QTextEdit(parent=self.inbox) + self.textEditInboxMessage = MessageView(parent=self.inbox) self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessage.setReadOnly(True) self.textEditInboxMessage.setObjectName("textEditInboxMessage") @@ -200,34 +202,42 @@ class Ui_MainWindow(object): self.verticalLayout_5.addWidget(self.textEditMessage) self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1) self.tabWidgetSend.addTab(self.sendDirect, "") - self.tab_2 = QtWidgets.QWidget() - self.tab_2.setObjectName("tab_2") - self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_2) + self.sendBroadcast = QtWidgets.QWidget() + self.sendBroadcast.setObjectName("sendBroadcast") + self.gridLayout_9 = QtWidgets.QGridLayout(self.sendBroadcast) self.gridLayout_9.setObjectName("gridLayout_9") - self.verticalLayout_6 = QtWidgets.QVBoxLayout() - self.verticalLayout_6.setObjectName("verticalLayout_6") + self.verticalSplitter_6 = settingsmixin.SSplitter() + self.verticalSplitter_6.setObjectName("verticalSplitter_6") + self.verticalSplitter_6.setOrientation(QtCore.Qt.Orientation.Vertical) self.gridLayout_5 = QtWidgets.QGridLayout() self.gridLayout_5.setObjectName("gridLayout_5") - self.label_8 = QtWidgets.QLabel(parent=self.tab_2) + self.label_8 = QtWidgets.QLabel(self.sendBroadcast) self.label_8.setObjectName("label_8") self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1) - self.lineEditSubjectBroadcast = QtWidgets.QLineEdit(parent=self.tab_2) + self.lineEditSubjectBroadcast = QtWidgets.QLineEdit(self.sendBroadcast) self.lineEditSubjectBroadcast.setText("") self.lineEditSubjectBroadcast.setObjectName("lineEditSubjectBroadcast") self.gridLayout_5.addWidget(self.lineEditSubjectBroadcast, 1, 1, 1, 1) - self.label_7 = QtWidgets.QLabel(parent=self.tab_2) + self.label_7 = QtWidgets.QLabel(self.sendBroadcast) self.label_7.setObjectName("label_7") self.gridLayout_5.addWidget(self.label_7, 1, 0, 1, 1) - self.comboBoxSendFromBroadcast = QtWidgets.QComboBox(parent=self.tab_2) + self.comboBoxSendFromBroadcast = QtWidgets.QComboBox(self.sendBroadcast) self.comboBoxSendFromBroadcast.setMinimumSize(QtCore.QSize(300, 0)) self.comboBoxSendFromBroadcast.setObjectName("comboBoxSendFromBroadcast") self.gridLayout_5.addWidget(self.comboBoxSendFromBroadcast, 0, 1, 1, 1) - self.verticalLayout_6.addLayout(self.gridLayout_5) - self.textEditMessageBroadcast = QtWidgets.QTextEdit(parent=self.tab_2) + self.gridLayout_5_Widget = QtWidgets.QWidget() + self.gridLayout_5_Widget.setLayout(self.gridLayout_5) + self.verticalSplitter_6.addWidget(self.gridLayout_5_Widget) + self.textEditMessageBroadcast = MessageCompose(self.sendBroadcast) self.textEditMessageBroadcast.setObjectName("textEditMessageBroadcast") - self.verticalLayout_6.addWidget(self.textEditMessageBroadcast) - self.gridLayout_9.addLayout(self.verticalLayout_6, 0, 0, 1, 1) - self.tabWidgetSend.addTab(self.tab_2, "") + self.verticalSplitter_6.addWidget(self.textEditMessageBroadcast) + self.verticalSplitter_6.setStretchFactor(0, 0) + self.verticalSplitter_6.setStretchFactor(1, 1) + self.verticalSplitter_6.setCollapsible(0, False) + self.verticalSplitter_6.setCollapsible(1, False) + self.verticalSplitter_6.handle(1).setEnabled(False) + self.gridLayout_9.addWidget(self.verticalSplitter_6, 0, 0, 1, 1) + self.tabWidgetSend.addTab(self.sendBroadcast, "") self.verticalLayout.addWidget(self.tabWidgetSend) self.horizontalLayout_5 = QtWidgets.QHBoxLayout() self.horizontalLayout_5.setObjectName("horizontalLayout_5") @@ -351,7 +361,7 @@ class Ui_MainWindow(object): self.tableWidgetInboxSubscriptions.verticalHeader().setVisible(False) self.tableWidgetInboxSubscriptions.verticalHeader().setDefaultSectionSize(26) self.verticalLayout_4.addWidget(self.tableWidgetInboxSubscriptions) - self.textEditInboxMessageSubscriptions = QtWidgets.QTextEdit(parent=self.subscriptions) + self.textEditInboxMessageSubscriptions = MessageView(parent=self.subscriptions) self.textEditInboxMessageSubscriptions.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessageSubscriptions.setReadOnly(True) self.textEditInboxMessageSubscriptions.setObjectName("textEditInboxMessageSubscriptions") @@ -428,7 +438,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.chans) + self.textEditInboxMessageChans = MessageView(parent=self.chans) self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessageChans.setReadOnly(True) self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans") @@ -600,7 +610,7 @@ class Ui_MainWindow(object): "p, li { white-space: pre-wrap; }\n" "\n" "


")) - self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers")) + self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.sendBroadcast), _translate("MainWindow", "Send Message to your Subscribers")) self.pushButtonTTL.setText(_translate("MainWindow", "TTL:")) self.pushButtonClear.setText(_translate("MainWindow", "Clear")) self.pushButtonSend.setText(_translate("MainWindow", "Send")) diff --git a/src/bitmessageqt/bitmessageui.py.diff b/src/bitmessageqt/bitmessageui.py.diff index abb13228..136b7c80 100644 --- a/src/bitmessageqt/bitmessageui.py.diff +++ b/src/bitmessageqt/bitmessageui.py.diff @@ -1,19 +1,30 @@ ---- bitmessageui.py.orig 2024-05-13 08:32:22.376971328 +0900 -+++ bitmessageui.py 2024-05-14 15:56:24.921713575 +0900 -@@ -7,7 +7,11 @@ +--- bitmessageui.py.orig 2024-05-16 08:36:50.513403227 +0900 ++++ bitmessageui.py 2024-05-16 11:17:05.028916782 +0900 +@@ -7,7 +7,13 @@ from PyQt6 import QtCore, QtGui, QtWidgets - +from bmconfigparser import config +from .foldertree import AddressBookCompleter -+from .blacklist import Blacklist ++from .messageview import MessageView ++from .messagecompose import MessageCompose +import bitmessageqt.settingsmixin as settingsmixin +from .networkstatus import NetworkStatus ++from .blacklist import Blacklist class Ui_MainWindow(object): def setupUi(self, MainWindow): -@@ -140,6 +144,11 @@ +@@ -101,7 +107,7 @@ + self.tableWidgetInbox.verticalHeader().setVisible(False) + self.tableWidgetInbox.verticalHeader().setDefaultSectionSize(26) + self.verticalLayout_7.addWidget(self.tableWidgetInbox) +- self.textEditInboxMessage = QtWidgets.QTextEdit(parent=self.inbox) ++ self.textEditInboxMessage = MessageView(parent=self.inbox) + self.textEditInboxMessage.setBaseSize(QtCore.QSize(0, 500)) + self.textEditInboxMessage.setReadOnly(True) + self.textEditInboxMessage.setObjectName("textEditInboxMessage") +@@ -140,6 +146,11 @@ self.tableWidgetAddressBook.horizontalHeader().setStretchLastSection(True) self.tableWidgetAddressBook.verticalHeader().setVisible(False) self.verticalLayout_2.addWidget(self.tableWidgetAddressBook) @@ -25,7 +36,7 @@ self.pushButtonAddAddressBook = QtWidgets.QPushButton(parent=self.send) self.pushButtonAddAddressBook.setMaximumSize(QtCore.QSize(200, 16777215)) self.pushButtonAddAddressBook.setObjectName("pushButtonAddAddressBook") -@@ -156,40 +165,41 @@ +@@ -156,68 +167,77 @@ self.verticalLayout.setObjectName("verticalLayout") self.tabWidgetSend = QtWidgets.QTabWidget(parent=self.send) self.tabWidgetSend.setObjectName("tabWidgetSend") @@ -74,11 +85,61 @@ self.verticalLayout_5.addWidget(self.textEditMessage) self.gridLayout_8.addLayout(self.verticalLayout_5, 0, 0, 1, 1) - self.tabWidgetSend.addTab(self.tab, "") +- self.tab_2 = QtWidgets.QWidget() +- self.tab_2.setObjectName("tab_2") +- self.gridLayout_9 = QtWidgets.QGridLayout(self.tab_2) + 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.sendBroadcast = QtWidgets.QWidget() ++ self.sendBroadcast.setObjectName("sendBroadcast") ++ self.gridLayout_9 = QtWidgets.QGridLayout(self.sendBroadcast) + self.gridLayout_9.setObjectName("gridLayout_9") +- self.verticalLayout_6 = QtWidgets.QVBoxLayout() +- self.verticalLayout_6.setObjectName("verticalLayout_6") ++ self.verticalSplitter_6 = settingsmixin.SSplitter() ++ self.verticalSplitter_6.setObjectName("verticalSplitter_6") ++ self.verticalSplitter_6.setOrientation(QtCore.Qt.Orientation.Vertical) + self.gridLayout_5 = QtWidgets.QGridLayout() + self.gridLayout_5.setObjectName("gridLayout_5") +- self.label_8 = QtWidgets.QLabel(parent=self.tab_2) ++ self.label_8 = QtWidgets.QLabel(self.sendBroadcast) + self.label_8.setObjectName("label_8") + self.gridLayout_5.addWidget(self.label_8, 0, 0, 1, 1) +- self.lineEditSubjectBroadcast = QtWidgets.QLineEdit(parent=self.tab_2) ++ self.lineEditSubjectBroadcast = QtWidgets.QLineEdit(self.sendBroadcast) + self.lineEditSubjectBroadcast.setText("") + self.lineEditSubjectBroadcast.setObjectName("lineEditSubjectBroadcast") + self.gridLayout_5.addWidget(self.lineEditSubjectBroadcast, 1, 1, 1, 1) +- self.label_7 = QtWidgets.QLabel(parent=self.tab_2) ++ self.label_7 = QtWidgets.QLabel(self.sendBroadcast) + self.label_7.setObjectName("label_7") + self.gridLayout_5.addWidget(self.label_7, 1, 0, 1, 1) +- self.comboBoxSendFromBroadcast = QtWidgets.QComboBox(parent=self.tab_2) ++ self.comboBoxSendFromBroadcast = QtWidgets.QComboBox(self.sendBroadcast) + self.comboBoxSendFromBroadcast.setMinimumSize(QtCore.QSize(300, 0)) + self.comboBoxSendFromBroadcast.setObjectName("comboBoxSendFromBroadcast") + self.gridLayout_5.addWidget(self.comboBoxSendFromBroadcast, 0, 1, 1, 1) +- self.verticalLayout_6.addLayout(self.gridLayout_5) +- self.textEditMessageBroadcast = QtWidgets.QTextEdit(parent=self.tab_2) ++ self.gridLayout_5_Widget = QtWidgets.QWidget() ++ self.gridLayout_5_Widget.setLayout(self.gridLayout_5) ++ self.verticalSplitter_6.addWidget(self.gridLayout_5_Widget) ++ self.textEditMessageBroadcast = MessageCompose(self.sendBroadcast) + self.textEditMessageBroadcast.setObjectName("textEditMessageBroadcast") +- self.verticalLayout_6.addWidget(self.textEditMessageBroadcast) +- self.gridLayout_9.addLayout(self.verticalLayout_6, 0, 0, 1, 1) +- self.tabWidgetSend.addTab(self.tab_2, "") ++ self.verticalSplitter_6.addWidget(self.textEditMessageBroadcast) ++ self.verticalSplitter_6.setStretchFactor(0, 0) ++ self.verticalSplitter_6.setStretchFactor(1, 1) ++ self.verticalSplitter_6.setCollapsible(0, False) ++ self.verticalSplitter_6.setCollapsible(1, False) ++ self.verticalSplitter_6.handle(1).setEnabled(False) ++ self.gridLayout_9.addWidget(self.verticalSplitter_6, 0, 0, 1, 1) ++ self.tabWidgetSend.addTab(self.sendBroadcast, "") + self.verticalLayout.addWidget(self.tabWidgetSend) + self.horizontalLayout_5 = QtWidgets.QHBoxLayout() + self.horizontalLayout_5.setObjectName("horizontalLayout_5") +@@ -263,6 +283,9 @@ self.labelHumanFriendlyTTLDescription.setMaximumSize(QtCore.QSize(45, 16777215)) self.labelHumanFriendlyTTLDescription.setObjectName("labelHumanFriendlyTTLDescription") self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription) @@ -88,7 +149,16 @@ self.pushButtonSend = QtWidgets.QPushButton(parent=self.send) self.pushButtonSend.setMaximumSize(QtCore.QSize(16777215, 16777215)) self.pushButtonSend.setObjectName("pushButtonSend") -@@ -348,15 +361,15 @@ +@@ -338,7 +361,7 @@ + self.tableWidgetInboxSubscriptions.verticalHeader().setVisible(False) + self.tableWidgetInboxSubscriptions.verticalHeader().setDefaultSectionSize(26) + self.verticalLayout_4.addWidget(self.tableWidgetInboxSubscriptions) +- self.textEditInboxMessageSubscriptions = QtWidgets.QTextEdit(parent=self.subscriptions) ++ self.textEditInboxMessageSubscriptions = MessageView(parent=self.subscriptions) + self.textEditInboxMessageSubscriptions.setBaseSize(QtCore.QSize(0, 500)) + self.textEditInboxMessageSubscriptions.setReadOnly(True) + self.textEditInboxMessageSubscriptions.setObjectName("textEditInboxMessageSubscriptions") +@@ -348,15 +371,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, "") @@ -108,7 +178,7 @@ self.treeWidgetChans.setMaximumSize(QtCore.QSize(200, 16777215)) self.treeWidgetChans.setFrameShadow(QtWidgets.QFrame.Shadow.Sunken) self.treeWidgetChans.setLineWidth(1) -@@ -368,7 +381,7 @@ +@@ -368,7 +391,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) @@ -117,7 +187,7 @@ self.pushButtonAddChan.setMaximumSize(QtCore.QSize(200, 16777215)) self.pushButtonAddChan.setObjectName("pushButtonAddChan") self.verticalLayout_17.addWidget(self.pushButtonAddChan) -@@ -377,10 +390,10 @@ +@@ -377,10 +400,10 @@ self.verticalLayout_8.setObjectName("verticalLayout_8") self.horizontalLayout_6 = QtWidgets.QHBoxLayout() self.horizontalLayout_6.setObjectName("horizontalLayout_6") @@ -130,7 +200,7 @@ self.inboxSearchOptionChans.setObjectName("inboxSearchOptionChans") self.inboxSearchOptionChans.addItem("") self.inboxSearchOptionChans.addItem("") -@@ -389,7 +402,7 @@ +@@ -389,7 +412,7 @@ self.inboxSearchOptionChans.addItem("") self.horizontalLayout_6.addWidget(self.inboxSearchOptionChans) self.verticalLayout_8.addLayout(self.horizontalLayout_6) @@ -139,16 +209,16 @@ self.tableWidgetInboxChans.setEditTriggers(QtWidgets.QAbstractItemView.EditTrigger.NoEditTriggers) self.tableWidgetInboxChans.setAlternatingRowColors(True) self.tableWidgetInboxChans.setSelectionMode(QtWidgets.QAbstractItemView.SelectionMode.ExtendedSelection) -@@ -415,7 +428,7 @@ +@@ -415,7 +438,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 = MessageView(parent=self.chans) self.textEditInboxMessageChans.setBaseSize(QtCore.QSize(0, 500)) self.textEditInboxMessageChans.setReadOnly(True) self.textEditInboxMessageChans.setObjectName("textEditInboxMessageChans") -@@ -424,113 +437,20 @@ +@@ -424,113 +447,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) @@ -273,7 +343,7 @@ self.menubar = QtWidgets.QMenuBar(parent=MainWindow) self.menubar.setGeometry(QtCore.QRect(0, 0, 885, 27)) self.menubar.setObjectName("menubar") -@@ -550,6 +470,8 @@ +@@ -550,6 +480,8 @@ self.actionManageKeys = QtGui.QAction(parent=MainWindow) self.actionManageKeys.setCheckable(False) self.actionManageKeys.setEnabled(True) @@ -282,7 +352,7 @@ icon = QtGui.QIcon.fromTheme("dialog-password") self.actionManageKeys.setIcon(icon) self.actionManageKeys.setObjectName("actionManageKeys") -@@ -561,6 +483,10 @@ +@@ -561,6 +493,10 @@ icon = QtGui.QIcon.fromTheme("help-contents") self.actionHelp.setIcon(icon) self.actionHelp.setObjectName("actionHelp") @@ -293,7 +363,7 @@ self.actionAbout = QtGui.QAction(parent=MainWindow) icon = QtGui.QIcon.fromTheme("help-about") self.actionAbout.setIcon(icon) -@@ -584,17 +510,23 @@ +@@ -584,17 +520,23 @@ self.menuFile.addAction(self.actionManageKeys) self.menuFile.addAction(self.actionDeleteAllTrashedMessages) self.menuFile.addAction(self.actionRegenerateDeterministicAddresses) @@ -319,7 +389,7 @@ QtCore.QMetaObject.connectSlotsByName(MainWindow) MainWindow.setTabOrder(self.tableWidgetInbox, self.textEditInboxMessage) MainWindow.setTabOrder(self.textEditInboxMessage, self.comboBoxSendFrom) -@@ -603,12 +535,26 @@ +@@ -603,12 +545,26 @@ MainWindow.setTabOrder(self.lineEditSubject, self.textEditMessage) MainWindow.setTabOrder(self.textEditMessage, self.pushButtonSend) MainWindow.setTabOrder(self.pushButtonSend, self.pushButtonAddSubscription) @@ -352,7 +422,7 @@ def retranslateUi(self, MainWindow): _translate = QtCore.QCoreApplication.translate -@@ -646,7 +592,7 @@ +@@ -646,7 +602,7 @@ "p, li { white-space: pre-wrap; }\n" "\n" "


")) @@ -361,16 +431,19 @@ self.label_8.setText(_translate("MainWindow", "From:")) self.label_7.setText(_translate("MainWindow", "Subject:")) self.textEditMessageBroadcast.setHtml(_translate("MainWindow", "\n" -@@ -656,7 +602,7 @@ +@@ -654,9 +610,9 @@ + "p, li { white-space: pre-wrap; }\n" + "\n" "


")) - self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers")) +- self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.tab_2), _translate("MainWindow", "Send Message to your Subscribers")) ++ self.tabWidgetSend.setTabText(self.tabWidgetSend.indexOf(self.sendBroadcast), _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")) self.treeWidgetSubscriptions.headerItem().setText(0, _translate("MainWindow", "Subscriptions")) -@@ -694,28 +640,8 @@ +@@ -694,28 +650,8 @@ item.setText(_translate("MainWindow", "Subject")) item = self.tableWidgetInboxChans.horizontalHeaderItem(3) item.setText(_translate("MainWindow", "Received")) @@ -401,7 +474,7 @@ 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 @@ +@@ -726,8 +662,10 @@ self.actionExit.setShortcut(_translate("MainWindow", "Ctrl+Q")) self.actionHelp.setText(_translate("MainWindow", "Help")) self.actionHelp.setShortcut(_translate("MainWindow", "F1")) diff --git a/src/bitmessageqt/messageview.py b/src/bitmessageqt/messageview.py index 6d1d220b..350d0c7f 100644 --- a/src/bitmessageqt/messageview.py +++ b/src/bitmessageqt/messageview.py @@ -38,7 +38,7 @@ class MessageView(QtWidgets.QTextBrowser): def mousePressEvent(self, event): """Mouse press button event handler""" - if event.button() == QtCore.Qt.LeftButton and self.html and self.html.has_html and self.cursorForPosition( + if event.button() == QtCore.Qt.MouseButton.LeftButton and self.html and self.html.has_html and self.cursorForPosition( event.pos()).block().blockNumber() == 0: if self.mode == MessageView.MODE_PLAIN: self.showHTML() @@ -52,11 +52,11 @@ class MessageView(QtWidgets.QTextBrowser): # super will actually automatically take care of zooming super(MessageView, self).wheelEvent(event) if ( - QtGui.QApplication.queryKeyboardModifiers() & QtCore.Qt.ControlModifier - ) == QtCore.Qt.ControlModifier and event.orientation() == QtCore.Qt.Vertical: + QtWidgets.QApplication.queryKeyboardModifiers() & QtCore.Qt.KeyboardModifier.ControlModifier + ) == QtCore.Qt.KeyboardModifier.ControlModifier and event.orientation() == QtCore.Qt.Vertical: zoom = self.currentFont().pointSize() * 100 / self.defaultFontPointSize - QtGui.QApplication.activeWindow().statusBar().showMessage(_translate( - "MainWindow", "Zoom level %1%").arg(str(zoom))) + QtWidgets.QApplication.activeWindow().statusBar().showMessage(_translate( + "MainWindow", "Zoom level {0}%").format(str(zoom))) def setWrappingWidth(self, width=None): """Set word-wrapping width""" @@ -68,14 +68,15 @@ class MessageView(QtWidgets.QTextBrowser): def confirmURL(self, link): """Show a dialog requesting URL opening confirmation""" if link.scheme() == "mailto": - window = QtGui.QApplication.activeWindow() + window = QtWidgets.QApplication.activeWindow() window.ui.lineEditTo.setText(link.path()) - if link.hasQueryItem("subject"): + query = QtCore.QUrlQuery(link) + if query.hasQueryItem("subject"): window.ui.lineEditSubject.setText( - link.queryItemValue("subject")) - if link.hasQueryItem("body"): + query.queryItemValue("subject")) + if query.hasQueryItem("body"): window.ui.textEditMessage.setText( - link.queryItemValue("body")) + query.queryItemValue("body")) window.setSendFromComboBox() window.ui.tabWidgetSend.setCurrentIndex(0) window.ui.tabWidget.setCurrentIndex( @@ -83,18 +84,18 @@ class MessageView(QtWidgets.QTextBrowser): ) window.ui.textEditMessage.setFocus() return - reply = QtGui.QMessageBox.warning( + reply = QtWidgets.QMessageBox.warning( self, - QtGui.QApplication.translate( + QtWidgets.QApplication.translate( "MessageView", "Follow external link"), - QtGui.QApplication.translate( + QtWidgets.QApplication.translate( "MessageView", - "The link \"%1\" will open in a browser. It may be a security risk, it could de-anonymise you" - " or download malicious data. Are you sure?").arg(unicode(link.toString())), - QtGui.QMessageBox.Yes, - QtGui.QMessageBox.No) - if reply == QtGui.QMessageBox.Yes: + "The link \"{0}\" will open in a browser. It may be a security risk, it could de-anonymise you" + " or download malicious data. Are you sure?").format(link.toString()), + QtWidgets.QMessageBox.StandardButton.Yes, + QtWidgets.QMessageBox.StandardButton.No) + if reply == QtWidgets.QMessageBox.StandardButton.Yes: QtGui.QDesktopServices.openUrl(link) def loadResource(self, restype, name): @@ -123,8 +124,8 @@ class MessageView(QtWidgets.QTextBrowser): pos = self.out.find(">", self.outpos) if pos > self.outpos: self.outpos = pos + 1 - cursor.movePosition(QtGui.QTextCursor.End, QtGui.QTextCursor.MoveAnchor) - cursor.insertHtml(QtCore.QString(self.out[startpos:self.outpos])) + cursor.movePosition(QtGui.QTextCursor.MoveOperation.End, QtGui.QTextCursor.MoveMode.MoveAnchor) + cursor.insertHtml(str(self.out[startpos:self.outpos])) self.verticalScrollBar().setValue(position) self.rendering = False @@ -133,9 +134,8 @@ class MessageView(QtWidgets.QTextBrowser): self.mode = MessageView.MODE_PLAIN out = self.html.raw if self.html.has_html: - out = "
" + unicode( - QtGui.QApplication.translate( - "MessageView", "HTML detected, click here to display")) + "

" + out + out = "
" + QtWidgets.QApplication.translate( + "MessageView", "HTML detected, click here to display") + "

" + out self.out = out self.outpos = 0 self.setHtml("") @@ -145,8 +145,7 @@ class MessageView(QtWidgets.QTextBrowser): """Render message as HTML""" self.mode = MessageView.MODE_HTML out = self.html.sanitised - out = "
" + unicode( - QtGui.QApplication.translate("MessageView", "Click here to disable HTML")) + "

" + out + out = "
" + QtWidgets.QApplication.translate("MessageView", "Click here to disable HTML") + "

" + out self.out = out self.outpos = 0 self.setHtml("") diff --git a/src/bitmessageqt/safehtmlparser.py b/src/bitmessageqt/safehtmlparser.py index 853fd031..98122398 100644 --- a/src/bitmessageqt/safehtmlparser.py +++ b/src/bitmessageqt/safehtmlparser.py @@ -122,10 +122,6 @@ class SafeHTMLParser(HTMLParser): self.sanitised += "&" + name + ";" def feed(self, data): - try: - data = unicode(data, 'utf-8') - except UnicodeDecodeError: - data = unicode(data, 'utf-8', errors='replace') HTMLParser.feed(self, data) tmp = SafeHTMLParser.replace_pre(data) tmp = self.uriregex1.sub(r'\1', tmp)