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" "