From 1077548eb6a571c42937d08c0d645a79401382e6 Mon Sep 17 00:00:00 2001 From: Kashiko Koibumi Date: Fri, 17 May 2024 11:51:03 +0900 Subject: [PATCH] Revert "fix complains from flake8; part 2" This reverts commit bcf02ff9bbf2619100df45039cf4f76cc20d857a. --- run-autopep8.sh | 2 +- run-flake8.sh | 2 - src/bitmessageqt/__init__.py | 164 ++++++++++++++-------------- src/bitmessageqt/address_dialogs.py | 2 +- src/bitmessageqt/bitmessageui.py | 47 +++----- src/bitmessageqt/dialogs.py | 2 +- src/bitmessageqt/languagebox.py | 2 +- src/bitmessageqt/messageview.py | 4 +- src/bitmessageqt/migrationwizard.py | 5 +- src/bitmessageqt/newchandialog.py | 5 +- src/bitmessageqt/retranslateui.py | 4 +- src/bitmessageqt/settingsmixin.py | 2 +- src/bitmessageqt/statusbar.py | 2 +- src/bitmessageqt/widgets.py | 1 + 14 files changed, 108 insertions(+), 136 deletions(-) delete mode 100755 run-flake8.sh diff --git a/run-autopep8.sh b/run-autopep8.sh index 8fb0dab7..701a6c0d 100755 --- a/run-autopep8.sh +++ b/run-autopep8.sh @@ -1,2 +1,2 @@ #!/bin/sh -autopep8 --in-place --recursive --max-line-length=119 src src/bitmessageqt +autopep8 --in-place --recursive src src/bitmessageqt diff --git a/run-flake8.sh b/run-flake8.sh deleted file mode 100755 index 21583717..00000000 --- a/run-flake8.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -flake8 --max-line-length=119 --config=setup.cfg src/*.py src/network/*.py src/storage/*.py src/bitmessageqt/*.py diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 56380fa0..dd922a25 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -16,8 +16,8 @@ from datetime import datetime, timedelta from sqlite3 import register_adapter from PyQt6 import QtCore, QtGui, QtWidgets -from PyQt6.QtWidgets import QMessageBox from PyQt6.QtNetwork import QLocalSocket, QLocalServer + import shared import state from debug import logger @@ -613,11 +613,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 = QMessageBox.question( - self, 'Message', displayMsg, - QMessageBox.StandardButton.Yes, - QMessageBox.StandardButton.No) - if reply == 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() @@ -1504,11 +1502,11 @@ class MyForm(settingsmixin.SMainWindow): def click_actionManageKeys(self): if 'darwin' in sys.platform or 'linux' in sys.platform: if state.appdata == '': - # reply = 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 = QMessageBox.information( + reply = QtWidgets.QMessageBox.information( self, 'keys.dat?', _translate( @@ -1516,10 +1514,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." ), - QMessageBox.StandardButton.Ok) + QtWidgets.QMessageBox.StandardButton.Ok) else: - QMessageBox.information( + QtWidgets.QMessageBox.information( self, 'keys.dat?', _translate( @@ -1528,10 +1526,10 @@ class MyForm(settingsmixin.SMainWindow): "\n {0} \n" "It is important that you back up this file." ).format(state.appdata), - QMessageBox.StandardButton.Ok) + QtWidgets.QMessageBox.StandardButton.Ok) elif sys.platform == 'win32' or sys.platform == 'win64': if state.appdata == '': - reply = QMessageBox.question( + reply = QtWidgets.QMessageBox.question( self, _translate("MainWindow", "Open keys.dat?"), _translate( @@ -1540,10 +1538,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.)"), - QMessageBox.StandardButton.Yes, - QMessageBox.StandardButton.No) + QtWidgets.QMessageBox.StandardButton.Yes, + QtWidgets.QMessageBox.StandardButton.No) else: - reply = QMessageBox.question( + reply = QtWidgets.QMessageBox.question( self, _translate("MainWindow", "Open keys.dat?"), _translate( @@ -1551,18 +1549,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), - QMessageBox.StandardButton.Yes, QMessageBox.StandardButton.No) - if reply == 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 QMessageBox.question( + if QtWidgets.QMessageBox.question( self, _translate("MainWindow", "Delete trash?"), _translate("MainWindow", "Are you sure you want to delete all trashed messages?"), - QMessageBox.StandardButton.Yes, - QMessageBox.StandardButton.No) == QMessageBox.StandardButton.No: + QtWidgets.QMessageBox.StandardButton.Yes, + QtWidgets.QMessageBox.StandardButton.No) == QtWidgets.QMessageBox.StandardButton.No: return sqlStoredProcedure('deleteandvacuume') self.rerenderTabTreeMessages() @@ -1589,7 +1587,7 @@ class MyForm(settingsmixin.SMainWindow): dialog = dialogs.RegenerateAddressesDialog(self) if dialog.exec(): if dialog.lineEditPassphrase.text() == "": - QMessageBox.about( + QtWidgets.QMessageBox.about( self, _translate("MainWindow", "bad passphrase"), _translate( "MainWindow", @@ -1602,7 +1600,7 @@ class MyForm(settingsmixin.SMainWindow): addressVersionNumber = int( dialog.lineEditAddressVersionNumber.text()) except: - QMessageBox.about( + QtWidgets.QMessageBox.about( self, _translate("MainWindow", "Bad address version number"), _translate( @@ -1612,7 +1610,7 @@ class MyForm(settingsmixin.SMainWindow): )) return if addressVersionNumber < 3 or addressVersionNumber > 4: - QMessageBox.about( + QtWidgets.QMessageBox.about( self, _translate("MainWindow", "Bad address version number"), _translate( @@ -1668,7 +1666,7 @@ class MyForm(settingsmixin.SMainWindow): self.ui.blackwhitelist.init_blacklist_popup_menu(False) if event.type() == QtCore.QEvent.Type.WindowStateChange: if self.windowState() & QtCore.Qt.WindowState.WindowMinimized: - if config.getboolean('bitmessagesettings', 'minimizetotray') and 'darwin' not in sys.platform: + if config.getboolean('bitmessagesettings', 'minimizetotray') and not 'darwin' in sys.platform: QtCore.QTimer.singleShot(0, self.appIndicatorHide) elif event.oldState() & QtCore.Qt.WindowState.WindowMinimized: # The window state has just been changed to @@ -1901,7 +1899,7 @@ class MyForm(settingsmixin.SMainWindow): def displayAlert(self, title, text, exitAfterUserClicksOk): self.updateStatusBar(text) - QMessageBox.critical(self, title, text, QMessageBox.StandardButton.Ok) + QtWidgets.QMessageBox.critical(self, title, text, QtWidgets.QMessageBox.StandardButton.Ok) if exitAfterUserClicksOk: os._exit(0) @@ -1977,7 +1975,7 @@ class MyForm(settingsmixin.SMainWindow): self.rerenderTabTreeSubscriptions() def click_pushButtonTTL(self): - QMessageBox.information( + QtWidgets.QMessageBox.information( self, 'Time To Live', _translate( @@ -1986,7 +1984,7 @@ 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."""), - QMessageBox.StandardButton.Ok) + QtWidgets.QMessageBox.StandardButton.Ok) def click_pushButtonClear(self): self.ui.lineEditSubject.setText("") @@ -1999,9 +1997,7 @@ class MyForm(settingsmixin.SMainWindow): self.ui.textEditMessageBroadcast.clear() def click_pushButtonSend(self): - encoding = 2 - if QtWidgets.QApplication.queryKeyboardModifiers() & QtCore.Qt.KeyboardModifier.ShiftModifier: - encoding = 3 + encoding = 3 if QtWidgets.QApplication.queryKeyboardModifiers() & QtCore.Qt.KeyboardModifier.ShiftModifier else 2 self.statusbar.clearMessage() @@ -2031,7 +2027,7 @@ class MyForm(settingsmixin.SMainWindow): users can send messages of any length. """ if len(message) > (2 ** 18 - 500): - QMessageBox.about( + QtWidgets.QMessageBox.about( self, _translate("MainWindow", "Message too long"), _translate( "MainWindow", @@ -2063,15 +2059,14 @@ class MyForm(settingsmixin.SMainWindow): subject = acct.subject toAddress = acct.toAddress else: - if 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?"), - QMessageBox.StandardButton.Yes - | QMessageBox.StandardButton.No) != 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 @@ -2168,7 +2163,7 @@ class MyForm(settingsmixin.SMainWindow): toAddress = addBMIfNotPresent(toAddress) if addressVersionNumber > 4 or addressVersionNumber <= 1: - QMessageBox.about( + QtWidgets.QMessageBox.about( self, _translate("MainWindow", "Address version number"), _translate( @@ -2178,7 +2173,7 @@ class MyForm(settingsmixin.SMainWindow): ).format(toAddress, str(addressVersionNumber))) continue if streamNumber > 1 or streamNumber == 0: - QMessageBox.about( + QtWidgets.QMessageBox.about( self, _translate("MainWindow", "Stream number"), _translate( @@ -2587,13 +2582,13 @@ class MyForm(settingsmixin.SMainWindow): self.ui.textEditMessage.setFocus() def on_action_MarkAllRead(self): - if 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?" - ), QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No - ) != QMessageBox.StandardButton.Yes: + ), QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No + ) != QtWidgets.QMessageBox.StandardButton.Yes: return tableWidget = self.getCurrentMessagelist() @@ -2604,7 +2599,7 @@ class MyForm(settingsmixin.SMainWindow): msgids = [] for i in range(0, idCount): msgids.append(tableWidget.item(i, 3).data()) - for col in range(tableWidget.columnCount()): + for col in xrange(tableWidget.columnCount()): tableWidget.item(i, col).setUnread(False) markread = sqlExecuteChunked( @@ -2621,7 +2616,7 @@ class MyForm(settingsmixin.SMainWindow): def network_switch(self): dontconnect_option = not config.safeGetBoolean( 'bitmessagesettings', 'dontconnect') - reply = QMessageBox.question( + reply = QtWidgets.QMessageBox.question( self, _translate("MainWindow", "Disconnecting") if dontconnect_option else _translate("MainWindow", "Connecting"), _translate( @@ -2630,9 +2625,9 @@ class MyForm(settingsmixin.SMainWindow): ) if dontconnect_option else _translate( "MainWindow", "Bitmessage will now start connecting to network. Are you sure?" - ), QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.Cancel, - QMessageBox.StandardButton.Cancel) - if reply != QMessageBox.StandardButton.Yes: + ), QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.Cancel, + QtWidgets.QMessageBox.StandardButton.Cancel) + if reply != QtWidgets.QMessageBox.StandardButton.Yes: return config.set( 'bitmessagesettings', 'dontconnect', str(dontconnect_option)) @@ -2659,7 +2654,7 @@ class MyForm(settingsmixin.SMainWindow): # C PoW currently doesn't support interrupting and OpenCL is untested if getPowType() == "python" and (powQueueSize() > 0 or pendingUpload() > 0): - reply = QMessageBox.question( + reply = QtWidgets.QMessageBox.question( self, _translate("MainWindow", "Proof of work pending"), _translate( "MainWindow", @@ -2673,15 +2668,15 @@ class MyForm(settingsmixin.SMainWindow): ) + "\n\n" + _translate( "MainWindow", "Wait until these tasks finish?"), - QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No - | QMessageBox.StandardButton.Cancel, QMessageBox.StandardButton.Cancel) - if reply == QMessageBox.StandardButton.No: + QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No + | QtWidgets.QMessageBox.StandardButton.Cancel, QtWidgets.QMessageBox.StandardButton.Cancel) + if reply == QtWidgets.QMessageBox.StandardButton.No: waitForPow = False - elif reply == QMessageBox.StandardButton.Cancel: + elif reply == QtWidgets.QMessageBox.StandardButton.Cancel: return if pendingDownload() > 0: - reply = QMessageBox.question( + reply = QtWidgets.QMessageBox.question( self, _translate("MainWindow", "Synchronisation pending"), _translate( "MainWindow", @@ -2691,16 +2686,16 @@ class MyForm(settingsmixin.SMainWindow): " synchronisation finishes?", None, pendingDownload() ), - QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No - | QMessageBox.StandardButton.Cancel, QMessageBox.StandardButton.Cancel) - if reply == QMessageBox.StandardButton.Yes: + QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No + | QtWidgets.QMessageBox.StandardButton.Cancel, QtWidgets.QMessageBox.StandardButton.Cancel) + if reply == QtWidgets.QMessageBox.StandardButton.Yes: self.wait = waitForSync = True - elif reply == QMessageBox.StandardButton.Cancel: + elif reply == QtWidgets.QMessageBox.StandardButton.Cancel: return if state.statusIconColor == 'red' and not config.safeGetBoolean( 'bitmessagesettings', 'dontconnect'): - reply = QMessageBox.question( + reply = QtWidgets.QMessageBox.question( self, _translate("MainWindow", "Not connected"), _translate( "MainWindow", @@ -2708,12 +2703,12 @@ class MyForm(settingsmixin.SMainWindow): " quit now, it may cause delivery delays. Wait until" " connected and the synchronisation finishes?" ), - QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No - | QMessageBox.StandardButton.Cancel, QMessageBox.StandardButton.Cancel) - if reply == QMessageBox.StandardButton.Yes: + QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No + | QtWidgets.QMessageBox.StandardButton.Cancel, QtWidgets.QMessageBox.StandardButton.Cancel) + if reply == QtWidgets.QMessageBox.StandardButton.Yes: waitForConnection = True self.wait = waitForSync = True - elif reply == QMessageBox.StandardButton.Cancel: + elif reply == QtWidgets.QMessageBox.StandardButton.Cancel: return self.quitAccepted = True @@ -2855,7 +2850,7 @@ class MyForm(settingsmixin.SMainWindow): lines = messageText.split('\n') totalLines = len(lines) - for i in range(totalLines): + for i in xrange(totalLines): if 'Message ostensibly from ' in lines[i]: lines[i] = '

%s

' % ( lines[i]) @@ -2921,8 +2916,7 @@ class MyForm(settingsmixin.SMainWindow): # Wrap and quote lines/paragraphs new to this message. else: return quoteWrapper.fill(line) - return '\n'.join( - [quote_line(line) for line in message.splitlines()]) + '\n\n' + return '\n'.join([quote_line(l) for l in message.splitlines()]) + '\n\n' def setSendFromComboBox(self, address=None): if address is None: @@ -2992,23 +2986,23 @@ class MyForm(settingsmixin.SMainWindow): ) # toAddressAtCurrentInboxRow = fromAddressAtCurrentInboxRow elif not config.has_section(toAddressAtCurrentInboxRow): - QMessageBox.information( + QtWidgets.QMessageBox.information( self, _translate("MainWindow", "Address is gone"), _translate( "MainWindow", "Bitmessage cannot find your address {0}. Perhaps you" " removed it?" - ).format(toAddressAtCurrentInboxRow), QMessageBox.StandardButton.Ok) + ).format(toAddressAtCurrentInboxRow), QtWidgets.QMessageBox.StandardButton.Ok) elif not config.getboolean( toAddressAtCurrentInboxRow, 'enabled'): - QMessageBox.information( + QtWidgets.QMessageBox.information( self, _translate("MainWindow", "Address disabled"), _translate( "MainWindow", "Error: The address from which you are trying to send" " is disabled. You\'ll have to enable it on the" " \'Your Identities\' tab before using it." - ), QMessageBox.StandardButton.Ok) + ), QtWidgets.QMessageBox.StandardButton.Ok) else: self.setBroadcastEnablementDependingOnWhetherThisIsAMailingListAddress(toAddressAtCurrentInboxRow) broadcast_tab_index = self.ui.tabWidgetSend.indexOf( @@ -3154,8 +3148,8 @@ class MyForm(settingsmixin.SMainWindow): idCount = len(inventoryHashesToTrash) sqlExecuteChunked( ("DELETE FROM inbox" if folder == "trash" or shifted else - "UPDATE inbox SET folder='trash', read=1") - + " WHERE msgid IN ({0})", idCount, *inventoryHashesToTrash) + "UPDATE inbox SET folder='trash', read=1") + + " WHERE msgid IN ({0})", idCount, *inventoryHashesToTrash) tableWidget.selectRow(0 if currentRow == 0 else currentRow - 1) tableWidget.setUpdatesEnabled(True) self.propagateUnreadCount(folder) @@ -3362,7 +3356,7 @@ class MyForm(settingsmixin.SMainWindow): self.click_pushButtonAddSubscription() def on_action_SubscriptionsDelete(self): - if QMessageBox.question( + if QtWidgets.QMessageBox.question( self, "Delete subscription?", _translate( "MainWindow", @@ -3373,8 +3367,8 @@ class MyForm(settingsmixin.SMainWindow): " messages, but you can still view messages you" " already received.\n\nAre you sure you want to" " delete the subscription?" - ), QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No - ) != QMessageBox.StandardButton.Yes: + ), QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No + ) != QtWidgets.QMessageBox.StandardButton.Yes: return address = self.getCurrentAccount() sqlExecute('''DELETE FROM subscriptions WHERE address=?''', @@ -3597,7 +3591,7 @@ class MyForm(settingsmixin.SMainWindow): if account.type == AccountMixin.NORMAL: return # maybe in the future elif account.type == AccountMixin.CHAN: - if QMessageBox.question( + if QtWidgets.QMessageBox.question( self, "Delete channel?", _translate( "MainWindow", @@ -3608,8 +3602,8 @@ class MyForm(settingsmixin.SMainWindow): " messages, but you can still view messages you" " already received.\n\nAre you sure you want to" " delete the channel?" - ), QMessageBox.StandardButton.Yes | QMessageBox.StandardButton.No - ) == QMessageBox.StandardButton.Yes: + ), QtWidgets.QMessageBox.StandardButton.Yes | QtWidgets.QMessageBox.StandardButton.No + ) == QtWidgets.QMessageBox.StandardButton.Yes: config.remove_section(str(account.address)) else: return @@ -3745,11 +3739,11 @@ class MyForm(settingsmixin.SMainWindow): if exists | (len(current_files) > 0): displayMsg = _translate( "MainWindow", "Do you really want to remove this avatar?") - overwrite = QMessageBox.question( + overwrite = QtWidgets.QMessageBox.question( self, 'Message', displayMsg, - QMessageBox.StandardButton.Yes, QMessageBox.StandardButton.No) + QtWidgets.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.No) else: - overwrite = QMessageBox.StandardButton.No + overwrite = QtWidgets.QMessageBox.StandardButton.No else: # ask whether to overwrite old avatar if exists | (len(current_files) > 0): @@ -3757,15 +3751,15 @@ class MyForm(settingsmixin.SMainWindow): "MainWindow", "You have already set an avatar for this address." " Do you really want to overwrite it?") - overwrite = QMessageBox.question( + overwrite = QtWidgets.QMessageBox.question( self, 'Message', displayMsg, - QMessageBox.StandardButton.Yes, QMessageBox.StandardButton.No) + QtWidgets.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.No) else: - overwrite = QMessageBox.StandardButton.No + overwrite = QtWidgets.QMessageBox.StandardButton.No # copy the image file to the appdata folder - if (not exists) | (overwrite == QMessageBox.StandardButton.Yes): - if overwrite == QMessageBox.StandardButton.Yes: + if (not exists) | (overwrite == QtWidgets.QMessageBox.StandardButton.Yes): + if overwrite == QtWidgets.QMessageBox.StandardButton.Yes: for file in current_files: QtCore.QFile.remove(file) QtCore.QFile.remove(destination) @@ -3815,15 +3809,15 @@ class MyForm(settingsmixin.SMainWindow): pattern = destfile.lower() for item in os.listdir(destdir): if item.lower() == pattern: - overwrite = QMessageBox.question( + overwrite = QtWidgets.QMessageBox.question( self, _translate("MainWindow", "Message"), _translate( "MainWindow", "You have already set a notification sound" " for this address book entry." " Do you really want to overwrite it?"), - QMessageBox.StandardButton.Yes, QMessageBox.StandardButton.No - ) == QMessageBox.StandardButton.Yes + QtWidgets.QMessageBox.StandardButton.Yes, QtWidgets.QMessageBox.StandardButton.No + ) == QtWidgets.QMessageBox.StandardButton.Yes if overwrite: QtCore.QFile.remove(os.path.join(destdir, item)) break diff --git a/src/bitmessageqt/address_dialogs.py b/src/bitmessageqt/address_dialogs.py index 937b7f81..30af4d9e 100644 --- a/src/bitmessageqt/address_dialogs.py +++ b/src/bitmessageqt/address_dialogs.py @@ -5,7 +5,7 @@ Dialogs that work with BM address. import hashlib -from PyQt6 import QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets import queues import bitmessageqt.widgets as widgets diff --git a/src/bitmessageqt/bitmessageui.py b/src/bitmessageqt/bitmessageui.py index 1f21ff34..268b4ae1 100644 --- a/src/bitmessageqt/bitmessageui.py +++ b/src/bitmessageqt/bitmessageui.py @@ -608,41 +608,22 @@ class Ui_MainWindow(object): self.label_3.setText(_translate("MainWindow", "Subject:")) self.label_2.setText(_translate("MainWindow", "From:")) self.label.setText(_translate("MainWindow", "To:")) - self.textEditMessage.setHtml( - _translate("MainWindow", "\n" - "" - "\n" - "


")) - self.tabWidgetSend.setTabText( - self.tabWidgetSend.indexOf(self.sendDirect), - _translate("MainWindow", "Send ordinary Message")) + self.textEditMessage.setHtml(_translate("MainWindow", "\n" + "\n" + "


")) + 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", "\n" - "" - "\n" - "


")) - self.tabWidgetSend.setTabText( - self.tabWidgetSend.indexOf(self.sendBroadcast), - _translate("MainWindow", "Send Message to your Subscribers")) + self.textEditMessageBroadcast.setHtml(_translate("MainWindow", "\n" + "\n" + "


")) + 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/dialogs.py b/src/bitmessageqt/dialogs.py index a7c0d942..401b8f08 100644 --- a/src/bitmessageqt/dialogs.py +++ b/src/bitmessageqt/dialogs.py @@ -2,7 +2,7 @@ Custom dialog classes """ # pylint: disable=too-few-public-methods -from PyQt6 import QtWidgets +from PyQt6 import QtGui, QtWidgets import paths import bitmessageqt.widgets as widgets diff --git a/src/bitmessageqt/languagebox.py b/src/bitmessageqt/languagebox.py index 02773534..00ead98a 100644 --- a/src/bitmessageqt/languagebox.py +++ b/src/bitmessageqt/languagebox.py @@ -3,7 +3,7 @@ import glob import os -from PyQt6 import QtCore, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets import paths from bmconfigparser import config diff --git a/src/bitmessageqt/messageview.py b/src/bitmessageqt/messageview.py index c77cc55d..8c8b09ad 100644 --- a/src/bitmessageqt/messageview.py +++ b/src/bitmessageqt/messageview.py @@ -38,9 +38,7 @@ class MessageView(QtWidgets.QTextBrowser): def mousePressEvent(self, event): """Mouse press button event handler""" - b = event.button() - lb = QtCore.Qt.MouseButton.LeftButton - if b == lb 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() diff --git a/src/bitmessageqt/migrationwizard.py b/src/bitmessageqt/migrationwizard.py index 4187ae85..d6539d5a 100644 --- a/src/bitmessageqt/migrationwizard.py +++ b/src/bitmessageqt/migrationwizard.py @@ -1,5 +1,5 @@ #!/usr/bin/env python2.7 -from PyQt6 import QtGui, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets class MigrationWizardIntroPage(QtWidgets.QWizardPage): @@ -8,8 +8,7 @@ class MigrationWizardIntroPage(QtWidgets.QWizardPage): self.setTitle("Migrating configuration") label = QtGui.QLabel("This wizard will help you to migrate your configuration. " - "You can still keep using PyBitMessage" - " once you migrate, the changes are backwards compatible.") + "You can still keep using PyBitMessage once you migrate, the changes are backwards compatible.") label.setWordWrap(True) layout = QtGui.QVBoxLayout() diff --git a/src/bitmessageqt/newchandialog.py b/src/bitmessageqt/newchandialog.py index 224bdc20..0dd7784a 100644 --- a/src/bitmessageqt/newchandialog.py +++ b/src/bitmessageqt/newchandialog.py @@ -4,12 +4,11 @@ src/bitmessageqt/newchandialog.py """ -from PyQt6 import QtCore, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets import bitmessageqt.widgets as widgets from addresses import addBMIfNotPresent -# XXX unresolved -# from .addressvalidator import AddressValidator, PassPhraseValidator +from .addressvalidator import AddressValidator, PassPhraseValidator from queues import ( addressGeneratorQueue, apiAddressGeneratorReturnQueue, UISignalQueue) from tr import _translate diff --git a/src/bitmessageqt/retranslateui.py b/src/bitmessageqt/retranslateui.py index a382545f..e987378b 100644 --- a/src/bitmessageqt/retranslateui.py +++ b/src/bitmessageqt/retranslateui.py @@ -1,4 +1,6 @@ -from PyQt6 import QtWidgets +from os import path +from PyQt6 import QtGui, QtWidgets +from debug import logger import bitmessageqt.widgets as widgets diff --git a/src/bitmessageqt/settingsmixin.py b/src/bitmessageqt/settingsmixin.py index 3cc8dc38..0e2d319b 100644 --- a/src/bitmessageqt/settingsmixin.py +++ b/src/bitmessageqt/settingsmixin.py @@ -5,7 +5,7 @@ src/settingsmixin.py """ -from PyQt6 import QtCore, QtWidgets +from PyQt6 import QtCore, QtGui, QtWidgets class SettingsMixin(object): diff --git a/src/bitmessageqt/statusbar.py b/src/bitmessageqt/statusbar.py index a3f4bf79..a7162cc9 100644 --- a/src/bitmessageqt/statusbar.py +++ b/src/bitmessageqt/statusbar.py @@ -2,7 +2,7 @@ """Status bar Module""" from time import time -from PyQt6 import QtWidgets +from PyQt6 import QtGui, QtWidgets class BMStatusBar(QtWidgets.QStatusBar): diff --git a/src/bitmessageqt/widgets.py b/src/bitmessageqt/widgets.py index 223c498b..1ed2533a 100644 --- a/src/bitmessageqt/widgets.py +++ b/src/bitmessageqt/widgets.py @@ -1,6 +1,7 @@ from PyQt6 import uic import os.path import paths +import sys def resource_path(resFile):