diff --git a/setup.cfg b/setup.cfg index 64a5909dce..1799a6fee0 100644 --- a/setup.cfg +++ b/setup.cfg @@ -24,7 +24,7 @@ ignore = bitmessagekivy [pylint.messages_control] disable = invalid-name,bare-except,broad-except,relative-import, - superfluous-parens,bad-option-value + superfluous-parens,bad-option-value,fixme # invalid-name: needs fixing during a large, project-wide refactor # bare-except,broad-except: Need fixing once thorough testing is easier # bad-option-value is for backward compatibility between python 2 and 3 @@ -42,7 +42,7 @@ ignore = bitmessagekivy [MESSAGES CONTROL] disable = invalid-name,bare-except,broad-except,relative-import, - superfluous-parens,bad-option-value + superfluous-parens,bad-option-value,fixme [DESIGN] max-args = 8 diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index b9eb7e0ee7..d553e885b3 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -425,9 +425,6 @@ def init_sent_popup_menu(self, connectSignal=True): self.actionSentReply = self.ui.sentContextMenuToolbar.addAction( _translate("MainWindow", "Send update"), self.on_action_SentReply) - # self.popMenuSent = QtGui.QMenu( self ) - # self.popMenuSent.addAction( self.actionSentClipboard ) - # self.popMenuSent.addAction( self.actionTrashSentMessage ) def rerenderTabTreeSubscriptions(self): treeWidget = self.ui.treeWidgetSubscriptions @@ -1298,8 +1295,8 @@ def loadMessagelist( tableWidget.setUpdatesEnabled(True) # create application indicator - def appIndicatorInit(self, app): - self.initTrayIcon("can-icon-24px-red.png", app) + def appIndicatorInit(self, _app): + self.initTrayIcon("can-icon-24px-red.png", _app) traySignal = "activated(QSystemTrayIcon::ActivationReason)" QtCore.QObject.connect(self.tray, QtCore.SIGNAL( traySignal), self.__icon_activated) @@ -1369,7 +1366,7 @@ def getUnread(self): queryreturn = sqlQuery(''' SELECT msgid, toaddress, read FROM inbox where folder='inbox' ''') - for msgid, toAddress, read in queryreturn: + for _, toAddress, read in queryreturn: if not read: # increment the unread subscriptions if True (1) @@ -1724,13 +1721,6 @@ def showConnectDialog(self): else: self._firstrun = False - def showMigrationWizard(self, level): - self.migrationWizardInstance = Ui_MigrationWizard(["a"]) - if self.migrationWizardInstance.exec_(): - pass - else: - pass - def changeEvent(self, event): if event.type() == QtCore.QEvent.LanguageChange: self.ui.retranslateUi(self) @@ -1820,10 +1810,12 @@ def setStatusIcon(self, color): "MainWindow", "Connected")) self.setTrayIconFile("can-icon-24px-%s.png" % color) - def initTrayIcon(self, iconFileName, app): + def initTrayIcon(self, iconFileName, _app): self.currentTrayIconFileName = iconFileName self.tray = QtGui.QSystemTrayIcon( - self.calcTrayIcon(iconFileName, self.findInboxUnreadCount()), app) + self.calcTrayIcon(iconFileName, + self.findInboxUnreadCount()), + _app) def setTrayIconFile(self, iconFileName): self.currentTrayIconFileName = iconFileName @@ -1925,10 +1917,7 @@ def updateSentItemStatusByAckdata(self, ackdata, textToDisplay): if self.getCurrentFolder(treeWidget) != "sent": continue for i in range(sent.rowCount()): - toAddress = sent.item(i, 0).data(QtCore.Qt.UserRole) tableAckdata = sent.item(i, 3).data() - status, addressVersionNumber, streamNumber, ripe = decodeAddress( - toAddress) if ackdata == tableAckdata: sent.item(i, 3).setToolTip(textToDisplay) try: @@ -1966,18 +1955,18 @@ def removeInboxRowByMsgid(self, msgid): inbox.removeRow(i) def newVersionAvailable(self, version): - self.notifiedNewVersion = ".".join(str(n) for n in version) + notifiedNewVersion = ".".join(str(n) for n in version) self.updateStatusBar(_translate( "MainWindow", "New version of PyBitmessage is available: %1. Download it" " from https://github.com/Bitmessage/PyBitmessage/releases/latest" - ).arg(self.notifiedNewVersion)) + ).arg(notifiedNewVersion)) def displayAlert(self, title, text, exitAfterUserClicksOk): self.updateStatusBar(text) QtGui.QMessageBox.critical(self, title, text, QtGui.QMessageBox.Ok) if exitAfterUserClicksOk: - os._exit(0) + os._exit(0) # pylint: disable=protected-access def rerenderMessagelistFromLabels(self): for messagelist in (self.ui.tableWidgetInbox, @@ -1994,11 +1983,15 @@ def rerenderMessagelistToLabels(self): messagelist.item(i, 0).setLabel() def rerenderAddressBook(self): - def addRow(address, label, type): + def addRow(address, label, row_type): self.ui.tableWidgetAddressBook.insertRow(0) - newItem = Ui_AddressBookWidgetItemLabel(address, text_type(label, 'utf-8'), type) + newItem = Ui_AddressBookWidgetItemLabel(address, + text_type(label, 'utf-8'), + row_type) self.ui.tableWidgetAddressBook.setItem(0, 0, newItem) - newItem = Ui_AddressBookWidgetItemAddress(address, text_type(label, 'utf-8'), type) + newItem = Ui_AddressBookWidgetItemAddress(address, + text_type(label, 'utf-8'), + row_type) self.ui.tableWidgetAddressBook.setItem(0, 1, newItem) oldRows = {} @@ -2099,7 +2092,7 @@ def click_pushButtonSend(self): too an exact number you are welcome to but I think that it would be a better use of time to support message continuation so that users can send messages of any length. - """ + """ # pylint: disable=pointless-string-statement if len(message) > (2 ** 18 - 500): QtGui.QMessageBox.about( self, _translate("MainWindow", "Message too long"), @@ -2329,7 +2322,7 @@ def click_pushButtonSend(self): def click_pushButtonLoadFromAddressBook(self): self.ui.tabWidget.setCurrentIndex(5) - for i in range(4): + for _ in range(4): time.sleep(0.1) self.statusbar.clearMessage() time.sleep(0.1) @@ -2873,7 +2866,7 @@ def quit(self): QtCore.QEventLoop.AllEvents, 1000 ) self.saveSettings() - for attr, obj in iteritems(self.ui.__dict__): + for _, obj in iteritems(self.ui.__dict__): if hasattr(obj, "__class__") \ and isinstance(obj, settingsmixin.SettingsMixin): saveMethod = getattr(obj, "saveSettings", None) @@ -3403,14 +3396,14 @@ def on_action_AddressBookSubscribe(self): ) def on_context_menuAddressBook(self, point): - self.popMenuAddressBook = QtGui.QMenu(self) - self.popMenuAddressBook.addAction(self.actionAddressBookSend) - self.popMenuAddressBook.addAction(self.actionAddressBookClipboard) - self.popMenuAddressBook.addAction(self.actionAddressBookSubscribe) - self.popMenuAddressBook.addAction(self.actionAddressBookSetAvatar) - self.popMenuAddressBook.addAction(self.actionAddressBookSetSound) - self.popMenuAddressBook.addSeparator() - self.popMenuAddressBook.addAction(self.actionAddressBookNew) + popMenuAddressBook = QtGui.QMenu(self) + popMenuAddressBook.addAction(self.actionAddressBookSend) + popMenuAddressBook.addAction(self.actionAddressBookClipboard) + popMenuAddressBook.addAction(self.actionAddressBookSubscribe) + popMenuAddressBook.addAction(self.actionAddressBookSetAvatar) + popMenuAddressBook.addAction(self.actionAddressBookSetSound) + popMenuAddressBook.addSeparator() + popMenuAddressBook.addAction(self.actionAddressBookNew) normal = True selected_items = self.getAddressbookSelectedItems() for item in selected_items: @@ -3419,13 +3412,13 @@ def on_context_menuAddressBook(self, point): break if normal: # only if all selected addressbook items are normal, allow delete - self.popMenuAddressBook.addAction(self.actionAddressBookDelete) + popMenuAddressBook.addAction(self.actionAddressBookDelete) if len(selected_items) == 1: self._contact_selected = selected_items.pop() - self.popMenuAddressBook.addSeparator() + popMenuAddressBook.addSeparator() for plugin in self.menu_plugins['address']: - self.popMenuAddressBook.addAction(plugin) - self.popMenuAddressBook.exec_( + popMenuAddressBook.addAction(plugin) + popMenuAddressBook.exec_( self.ui.tableWidgetAddressBook.mapToGlobal(point)) # Group of functions for the Subscriptions dialog box @@ -3482,31 +3475,31 @@ def on_action_SubscriptionsDisable(self): def on_context_menuSubscriptions(self, point): currentItem = self.getCurrentItem() - self.popMenuSubscriptions = QtGui.QMenu(self) + popMenuSubscriptions = QtGui.QMenu(self) if isinstance(currentItem, Ui_AddressWidget): - self.popMenuSubscriptions.addAction(self.actionsubscriptionsNew) - self.popMenuSubscriptions.addAction(self.actionsubscriptionsDelete) - self.popMenuSubscriptions.addSeparator() + popMenuSubscriptions.addAction(self.actionsubscriptionsNew) + popMenuSubscriptions.addAction(self.actionsubscriptionsDelete) + popMenuSubscriptions.addSeparator() if currentItem.isEnabled: - self.popMenuSubscriptions.addAction(self.actionsubscriptionsDisable) + popMenuSubscriptions.addAction(self.actionsubscriptionsDisable) else: - self.popMenuSubscriptions.addAction(self.actionsubscriptionsEnable) - self.popMenuSubscriptions.addAction(self.actionsubscriptionsSetAvatar) - self.popMenuSubscriptions.addSeparator() - self.popMenuSubscriptions.addAction(self.actionsubscriptionsClipboard) - self.popMenuSubscriptions.addAction(self.actionsubscriptionsSend) - self.popMenuSubscriptions.addSeparator() + popMenuSubscriptions.addAction(self.actionsubscriptionsEnable) + popMenuSubscriptions.addAction(self.actionsubscriptionsSetAvatar) + popMenuSubscriptions.addSeparator() + popMenuSubscriptions.addAction(self.actionsubscriptionsClipboard) + popMenuSubscriptions.addAction(self.actionsubscriptionsSend) + popMenuSubscriptions.addSeparator() self._contact_selected = currentItem # preloaded gui.menu plugins with prefix 'address' for plugin in self.menu_plugins['address']: - self.popMenuSubscriptions.addAction(plugin) - self.popMenuSubscriptions.addSeparator() + popMenuSubscriptions.addAction(plugin) + popMenuSubscriptions.addSeparator() if self.getCurrentFolder() != 'sent': - self.popMenuSubscriptions.addAction(self.actionMarkAllRead) - if self.popMenuSubscriptions.isEmpty(): + popMenuSubscriptions.addAction(self.actionMarkAllRead) + if popMenuSubscriptions.isEmpty(): return - self.popMenuSubscriptions.exec_( + popMenuSubscriptions.exec_( self.ui.treeWidgetSubscriptions.mapToGlobal(point)) def widgetConvert(self, widget): @@ -3838,8 +3831,8 @@ def setAvatar(self, addressAtCurrentRow): # copy the image file to the appdata folder if (not exists) | (overwrite == QtGui.QMessageBox.Yes): if overwrite == QtGui.QMessageBox.Yes: - for file in current_files: - QtCore.QFile.remove(file) + for _ in current_files: + QtCore.QFile.remove(_) QtCore.QFile.remove(destination) # copy it if sourcefile != '': @@ -3906,60 +3899,60 @@ def setAddressSound(self, addr): def on_context_menuYourIdentities(self, point): currentItem = self.getCurrentItem() - self.popMenuYourIdentities = QtGui.QMenu(self) + popMenuYourIdentities = QtGui.QMenu(self) if isinstance(currentItem, Ui_AddressWidget): - self.popMenuYourIdentities.addAction(self.actionNewYourIdentities) - self.popMenuYourIdentities.addSeparator() - self.popMenuYourIdentities.addAction(self.actionClipboardYourIdentities) - self.popMenuYourIdentities.addSeparator() + popMenuYourIdentities.addAction(self.actionNewYourIdentities) + popMenuYourIdentities.addSeparator() + popMenuYourIdentities.addAction(self.actionClipboardYourIdentities) + popMenuYourIdentities.addSeparator() if currentItem.isEnabled: - self.popMenuYourIdentities.addAction(self.actionDisableYourIdentities) + popMenuYourIdentities.addAction(self.actionDisableYourIdentities) else: - self.popMenuYourIdentities.addAction(self.actionEnableYourIdentities) - self.popMenuYourIdentities.addAction(self.actionSetAvatarYourIdentities) - self.popMenuYourIdentities.addAction(self.actionSpecialAddressBehaviorYourIdentities) - self.popMenuYourIdentities.addAction(self.actionEmailGateway) - self.popMenuYourIdentities.addSeparator() + popMenuYourIdentities.addAction(self.actionEnableYourIdentities) + popMenuYourIdentities.addAction(self.actionSetAvatarYourIdentities) + popMenuYourIdentities.addAction(self.actionSpecialAddressBehaviorYourIdentities) + popMenuYourIdentities.addAction(self.actionEmailGateway) + popMenuYourIdentities.addSeparator() if currentItem.type != AccountMixin.ALL: self._contact_selected = currentItem # preloaded gui.menu plugins with prefix 'address' for plugin in self.menu_plugins['address']: - self.popMenuYourIdentities.addAction(plugin) - self.popMenuYourIdentities.addSeparator() + popMenuYourIdentities.addAction(plugin) + popMenuYourIdentities.addSeparator() if self.getCurrentFolder() != 'sent': - self.popMenuYourIdentities.addAction(self.actionMarkAllRead) - if self.popMenuYourIdentities.isEmpty(): + popMenuYourIdentities.addAction(self.actionMarkAllRead) + if popMenuYourIdentities.isEmpty(): return - self.popMenuYourIdentities.exec_( + popMenuYourIdentities.exec_( self.ui.treeWidgetYourIdentities.mapToGlobal(point)) # TODO make one popMenu def on_context_menuChan(self, point): currentItem = self.getCurrentItem() - self.popMenu = QtGui.QMenu(self) + popMenu = QtGui.QMenu(self) if isinstance(currentItem, Ui_AddressWidget): - self.popMenu.addAction(self.actionNew) - self.popMenu.addAction(self.actionDelete) - self.popMenu.addSeparator() + popMenu.addAction(self.actionNew) + popMenu.addAction(self.actionDelete) + popMenu.addSeparator() if currentItem.isEnabled: - self.popMenu.addAction(self.actionDisable) + popMenu.addAction(self.actionDisable) else: - self.popMenu.addAction(self.actionEnable) - self.popMenu.addAction(self.actionSetAvatar) - self.popMenu.addSeparator() - self.popMenu.addAction(self.actionClipboard) - self.popMenu.addAction(self.actionSend) - self.popMenu.addSeparator() + popMenu.addAction(self.actionEnable) + popMenu.addAction(self.actionSetAvatar) + popMenu.addSeparator() + popMenu.addAction(self.actionClipboard) + popMenu.addAction(self.actionSend) + popMenu.addSeparator() self._contact_selected = currentItem # preloaded gui.menu plugins with prefix 'address' for plugin in self.menu_plugins['address']: - self.popMenu.addAction(plugin) - self.popMenu.addSeparator() + popMenu.addAction(plugin) + popMenu.addSeparator() if self.getCurrentFolder() != 'sent': - self.popMenu.addAction(self.actionMarkAllRead) - if self.popMenu.isEmpty(): + popMenu.addAction(self.actionMarkAllRead) + if popMenu.isEmpty(): return - self.popMenu.exec_( + popMenu.exec_( self.ui.treeWidgetChans.mapToGlobal(point)) def on_context_menuInbox(self, point): @@ -3972,50 +3965,51 @@ def on_context_menuInbox(self, point): self.on_context_menuSent(point) return - self.popMenuInbox = QtGui.QMenu(self) - self.popMenuInbox.addAction(self.actionForceHtml) - self.popMenuInbox.addAction(self.actionMarkUnread) - self.popMenuInbox.addSeparator() + popMenuInbox = QtGui.QMenu(self) + popMenuInbox.addAction(self.actionForceHtml) + popMenuInbox.addAction(self.actionMarkUnread) + popMenuInbox.addSeparator() currentRow = tableWidget.currentRow() account = accountClass( tableWidget.item(currentRow, 0).data(QtCore.Qt.UserRole)) if account.type == AccountMixin.CHAN: - self.popMenuInbox.addAction(self.actionReplyChan) - self.popMenuInbox.addAction(self.actionReply) - self.popMenuInbox.addAction(self.actionAddSenderToAddressBook) + popMenuInbox.addAction(self.actionReplyChan) + popMenuInbox.addAction(self.actionReply) + popMenuInbox.addAction(self.actionAddSenderToAddressBook) + # pylint: disable=no-member self.actionClipboardMessagelist = self.ui.inboxContextMenuToolbar.addAction( _translate("MainWindow", "Copy subject to clipboard") if tableWidget.currentColumn() == 2 else _translate("MainWindow", "Copy address to clipboard"), self.on_action_ClipboardMessagelist) - self.popMenuInbox.addAction(self.actionClipboardMessagelist) + popMenuInbox.addAction(self.actionClipboardMessagelist) # pylint: disable=no-member self._contact_selected = tableWidget.item(currentRow, 1) # preloaded gui.menu plugins with prefix 'address' for plugin in self.menu_plugins['address']: - self.popMenuInbox.addAction(plugin) - self.popMenuInbox.addSeparator() - self.popMenuInbox.addAction(self.actionAddSenderToBlackList) - self.popMenuInbox.addSeparator() - self.popMenuInbox.addAction(self.actionSaveMessageAs) + popMenuInbox.addAction(plugin) + popMenuInbox.addSeparator() + popMenuInbox.addAction(self.actionAddSenderToBlackList) + popMenuInbox.addSeparator() + popMenuInbox.addAction(self.actionSaveMessageAs) if currentFolder == "trash": - self.popMenuInbox.addAction(self.actionUndeleteTrashedMessage) + popMenuInbox.addAction(self.actionUndeleteTrashedMessage) else: - self.popMenuInbox.addAction(self.actionTrashInboxMessage) - self.popMenuInbox.exec_(tableWidget.mapToGlobal(point)) + popMenuInbox.addAction(self.actionTrashInboxMessage) + popMenuInbox.exec_(tableWidget.mapToGlobal(point)) def on_context_menuSent(self, point): currentRow = self.ui.tableWidgetInbox.currentRow() - self.popMenuSent = QtGui.QMenu(self) - self.popMenuSent.addAction(self.actionSentClipboard) + popMenuSent = QtGui.QMenu(self) + popMenuSent.addAction(self.actionSentClipboard) self._contact_selected = self.ui.tableWidgetInbox.item(currentRow, 0) # preloaded gui.menu plugins with prefix 'address' for plugin in self.menu_plugins['address']: - self.popMenuSent.addAction(plugin) - self.popMenuSent.addSeparator() - self.popMenuSent.addAction(self.actionTrashSentMessage) - self.popMenuSent.addAction(self.actionSentReply) + popMenuSent.addAction(plugin) + popMenuSent.addSeparator() + popMenuSent.addAction(self.actionTrashSentMessage) + popMenuSent.addAction(self.actionSentReply) # Check to see if this item is toodifficult and display an additional # menu option (Force Send) if it is. @@ -4025,9 +4019,9 @@ def on_context_menuSent(self, point): for row in queryreturn: status, = row if status == 'toodifficult': - self.popMenuSent.addAction(self.actionForceSend) + popMenuSent.addAction(self.actionForceSend) - self.popMenuSent.exec_(self.ui.tableWidgetInbox.mapToGlobal(point)) + popMenuSent.exec_(self.ui.tableWidgetInbox.mapToGlobal(point)) def inboxSearchLineEditUpdated(self, text): # dynamic search for too short text is slow @@ -4213,7 +4207,7 @@ def resetNamecoinConnection(self): def initSettings(self): self.loadSettings() - for attr, obj in iteritems(self.ui.__dict__): + for _, obj in iteritems(self.ui.__dict__): if hasattr(obj, "__class__") and \ isinstance(obj, settingsmixin.SettingsMixin): loadMethod = getattr(obj, "loadSettings", None) @@ -4315,12 +4309,6 @@ def run(): if myapp._firstrun: myapp.showConnectDialog() # ask the user if we may connect -# try: -# if config.get('bitmessagesettings', 'mailchuck') < 1: -# myapp.showMigrationWizard(config.get('bitmessagesettings', 'mailchuck')) -# except: -# myapp.showMigrationWizard(0) - # only show after wizards and connect dialogs have completed if not config.getboolean('bitmessagesettings', 'startintray'): myapp.show() diff --git a/src/bitmessageqt/bitmessageui.py b/src/bitmessageqt/bitmessageui.py index e16c2642ad..c43b0ab979 100644 --- a/src/bitmessageqt/bitmessageui.py +++ b/src/bitmessageqt/bitmessageui.py @@ -7,7 +7,6 @@ # # WARNING! All changes made in this file will be lost! -# pylint: disable=attribute-defined-outside-init from PyQt4 import QtCore, QtGui # pylint: disable=import-error from bmconfigparser import config from foldertree import AddressBookCompleter @@ -57,6 +56,7 @@ def _translate(context, text, disambig, class Ui_MainWindow(object): + # pylint: disable=attribute-defined-outside-init def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(885, 580) @@ -182,7 +182,8 @@ def setupUi(self, MainWindow): self.horizontalSplitter_3.setCollapsible(1, False) self.gridLayout.addWidget(self.horizontalSplitter_3) icon2 = QtGui.QIcon() - icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/inbox.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon2.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/inbox.png")), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tabWidget.addTab(self.inbox, icon2, _fromUtf8("")) self.send = QtGui.QWidget() self.send.setObjectName(_fromUtf8("send")) @@ -204,7 +205,8 @@ def setupUi(self, MainWindow): item = QtGui.QTableWidgetItem() icon3 = QtGui.QIcon() icon3.addPixmap( - QtGui.QPixmap(_fromUtf8(":/newPrefix/images/addressbook.png")), QtGui.QIcon.Selected, QtGui.QIcon.Off + QtGui.QPixmap(_fromUtf8(":/newPrefix/images/addressbook.png")), + QtGui.QIcon.Selected, QtGui.QIcon.Off ) item.setIcon(icon3) self.tableWidgetAddressBook.setHorizontalHeaderItem(0, item) @@ -366,7 +368,8 @@ def setupUi(self, MainWindow): self.labelHumanFriendlyTTLDescription.setSizePolicy(sizePolicy) self.labelHumanFriendlyTTLDescription.setMinimumSize(QtCore.QSize(45, 0)) self.labelHumanFriendlyTTLDescription.setObjectName(_fromUtf8("labelHumanFriendlyTTLDescription")) - self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription, 1, QtCore.Qt.AlignLeft) + self.horizontalLayout_5.addWidget(self.labelHumanFriendlyTTLDescription, + 1, QtCore.Qt.AlignLeft) self.pushButtonClear = QtGui.QPushButton(self.send) self.pushButtonClear.setObjectName(_fromUtf8("pushButtonClear")) self.horizontalLayout_5.addWidget(self.pushButtonClear, 0, QtCore.Qt.AlignRight) @@ -388,7 +391,8 @@ def setupUi(self, MainWindow): self.horizontalSplitter.setCollapsible(1, False) self.gridLayout_7.addWidget(self.horizontalSplitter, 0, 0, 1, 1) icon4 = QtGui.QIcon() - icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/send.png")), QtGui.QIcon.Normal, QtGui.QIcon.Off) + icon4.addPixmap(QtGui.QPixmap(_fromUtf8(":/newPrefix/images/send.png")), + QtGui.QIcon.Normal, QtGui.QIcon.Off) self.tabWidget.addTab(self.send, icon4, _fromUtf8("")) self.subscriptions = QtGui.QWidget() self.subscriptions.setObjectName(_fromUtf8("subscriptions")) @@ -691,7 +695,6 @@ def setupUi(self, MainWindow): MainWindow.setTabOrder(self.textEditMessage, self.pushButtonAddSubscription) # Popup menu actions container for the Sent page - # pylint: disable=attribute-defined-outside-init self.sentContextMenuToolbar = QtGui.QToolBar() # Popup menu actions container for chans tree self.addressContextMenuToolbar = QtGui.QToolBar() @@ -739,7 +742,8 @@ def retranslateUi(self, MainWindow): self.label_2.setText(_translate("MainWindow", "From:", None)) self.label.setText(_translate("MainWindow", "To:", None)) self.tabWidgetSend.setTabText( - self.tabWidgetSend.indexOf(self.sendDirect), _translate("MainWindow", "Send ordinary Message", None) + self.tabWidgetSend.indexOf(self.sendDirect), + _translate("MainWindow", "Send ordinary Message", None) ) self.label_8.setText(_translate("MainWindow", "From:", None)) self.label_7.setText(_translate("MainWindow", "Subject:", None)) @@ -822,17 +826,7 @@ def retranslateUi(self, MainWindow): self.actionRegenerateDeterministicAddresses.setText( _translate("MainWindow", "Regenerate deterministic addresses", None) ) - self.actionDeleteAllTrashedMessages.setText(_translate("MainWindow", "Delete all trashed messages", None)) + self.actionDeleteAllTrashedMessages.setText( + _translate("MainWindow", "Delete all trashed messages", None)) self.actionJoinChan.setText(_translate("MainWindow", "Join / Create chan", None)) self.updateNetworkSwitchMenuLabel() - - -if __name__ == "__main__": - import sys - - app = QtGui.QApplication(sys.argv) - MainWindow = settingsmixin.SMainWindow() - ui = Ui_MainWindow() - ui.setupUi(MainWindow) - MainWindow.show() - sys.exit(app.exec_()) diff --git a/src/bitmessageqt/messagecompose.py b/src/bitmessageqt/messagecompose.py index 59c6b567f8..70a1dca8db 100644 --- a/src/bitmessageqt/messagecompose.py +++ b/src/bitmessageqt/messagecompose.py @@ -2,7 +2,7 @@ Message editor with a wheel zoom functionality """ -from PyQt4 import QtCore, QtGui # pylint disable=import-error +from PyQt4 import QtCore, QtGui # pylint: disable=import-error class MessageCompose(QtGui.QTextEdit): diff --git a/src/bitmessageqt/tests/test_widgets.py b/src/bitmessageqt/tests/test_widgets.py index 6652072fff..b105cc5904 100644 --- a/src/bitmessageqt/tests/test_widgets.py +++ b/src/bitmessageqt/tests/test_widgets.py @@ -8,6 +8,7 @@ import sys import unittest +# pylint: disable=import-outside-toplevel,unused-import try: from PyQt4 import QtCore, QtGui, QtTest has_qt = True diff --git a/src/bitmessageqt/utils.py b/src/bitmessageqt/utils.py index 80e7945f57..7eee0d3e68 100644 --- a/src/bitmessageqt/utils.py +++ b/src/bitmessageqt/utils.py @@ -105,11 +105,9 @@ def avatarize(address): lower_default = state.appdata + 'avatars/' + 'default.' + ext.lower() upper_default = state.appdata + 'avatars/' + 'default.' + ext.upper() if os.path.isfile(lower_default): - default = lower_default idcon.addFile(lower_default) return idcon elif os.path.isfile(upper_default): - default = upper_default idcon.addFile(upper_default) return idcon # If no avatar is found diff --git a/src/build_osx.py b/src/build_osx.py index d83e9b9bc9..2e5f54b504 100644 --- a/src/build_osx.py +++ b/src/build_osx.py @@ -1,7 +1,7 @@ """Building osx.""" import os from glob import glob -from PyQt4 import QtCore +from PyQt4 import QtCore # pylint: disable=import-error from setuptools import setup name = "Bitmessage" diff --git a/src/class_smtpDeliver.py b/src/class_smtpDeliver.py index 634dee171a..fb10774eb8 100644 --- a/src/class_smtpDeliver.py +++ b/src/class_smtpDeliver.py @@ -7,6 +7,7 @@ from email.header import Header from six.moves import email_mime_text +# pylint: disable=import-error from six.moves.urllib import parse as urlparse import queues diff --git a/src/class_sqlThread.py b/src/class_sqlThread.py index 144976f6b7..ab9e1c31a6 100644 --- a/src/class_sqlThread.py +++ b/src/class_sqlThread.py @@ -9,6 +9,7 @@ import threading import time +# pylint: disable=import-error,redefined-builtin from six.moves.reprlib import repr try: @@ -34,8 +35,12 @@ class sqlThread(threading.Thread): def __init__(self): threading.Thread.__init__(self, name="SQL") + self.conn = None + self.cur = None - def run(self): # pylint: disable=too-many-locals, too-many-branches, too-many-statements + # pylint: disable=protected-access,too-many-locals + # pylint: disable=too-many-branches,too-many-statements + def run(self): """Process SQL queries from `.helper_sql.sqlSubmitQueue`""" helper_sql.sql_available = True config_ready.wait() diff --git a/src/helper_msgcoding.py b/src/helper_msgcoding.py index 05fa1c1b7a..5f72ac9eea 100644 --- a/src/helper_msgcoding.py +++ b/src/helper_msgcoding.py @@ -56,6 +56,7 @@ def __init__(self, message, encoding=BITMESSAGE_ENCODING_SIMPLE): else: raise MsgEncodeException("Unknown encoding %i" % (encoding)) + # pylint: disable=no-member def encodeExtended(self, message): """Handle extended encoding""" try: @@ -118,6 +119,7 @@ def decodeExtended(self, data): try: tmp = msgpack.loads(tmp) + # pylint: disable=no-member except (msgpack.exceptions.UnpackException, msgpack.exceptions.ExtraData): logger.error("Error msgunpacking message") diff --git a/src/main-android-live.py b/src/main-android-live.py index c880280e4a..89b8208a0e 100644 --- a/src/main-android-live.py +++ b/src/main-android-live.py @@ -3,7 +3,7 @@ import state import sys from bitmessagemain import main -from termcolor import colored +from termcolor import colored # pylint: disable=import-error print(colored('kivy is not supported at the moment for this version..', 'red')) sys.exit() diff --git a/src/mockbm/kivy_main.py b/src/mockbm/kivy_main.py index 4cf4da9823..29441d9e7b 100644 --- a/src/mockbm/kivy_main.py +++ b/src/mockbm/kivy_main.py @@ -4,7 +4,7 @@ """Mock kivy app with mock threads.""" import os -from kivy.config import Config +from kivy.config import Config # pylint: disable=import-error from pybitmessage.mockbm import multiqueue from pybitmessage import state diff --git a/src/openclpow.py b/src/openclpow.py index 5391590c58..66ef0d10d2 100644 --- a/src/openclpow.py +++ b/src/openclpow.py @@ -38,6 +38,7 @@ def initCL(): del gpus[:] ctx = False try: + # pylint: disable=no-member hash_dt = numpy.dtype([('target', numpy.uint64), ('v', numpy.str_, 73)]) try: for platform in cl.get_platforms(): @@ -74,6 +75,7 @@ def openclEnabled(): return bool(enabledGpus) +# pylint: disable=no-member def do_opencl_pow(hash_, target): """Perform PoW using OpenCL""" output = numpy.zeros(1, dtype=[('v', numpy.uint64, 1)]) diff --git a/src/paths.py b/src/paths.py index e0d4333407..4ea995a803 100644 --- a/src/paths.py +++ b/src/paths.py @@ -76,7 +76,7 @@ def codePath(): return os.path.dirname(__file__) return ( os.environ.get('RESOURCEPATH') - # pylint: disable=protected-access + # pylint: disable=no-member,protected-access if frozen == "macosx_app" else sys._MEIPASS) diff --git a/src/plugins/notification_notify2.py b/src/plugins/notification_notify2.py index e5e7e6e559..f33d08c8ed 100644 --- a/src/plugins/notification_notify2.py +++ b/src/plugins/notification_notify2.py @@ -5,7 +5,7 @@ import gi gi.require_version('Notify', '0.7') -from gi.repository import Notify # noqa:E402 pylint: disable=import-error +from gi.repository import Notify # noqa:E402 pylint: disable=import-error,no-name-in-module Notify.init('pybitmessage') diff --git a/src/pyelliptic/openssl.py b/src/pyelliptic/openssl.py index 6cc90fd43c..397299ddad 100644 --- a/src/pyelliptic/openssl.py +++ b/src/pyelliptic/openssl.py @@ -9,7 +9,7 @@ import ctypes import sys -# pylint: disable=protected-access +# pylint: disable=no-member,protected-access OpenSSL = None diff --git a/src/tr.py b/src/tr.py index eec82c37d3..eda88f0a27 100644 --- a/src/tr.py +++ b/src/tr.py @@ -41,7 +41,7 @@ def translateText(context, text, n=None): enableGUI = True if enableGUI: try: - from PyQt4 import QtCore, QtGui + from PyQt4 import QtCore, QtGui # pylint: disable=import-error except Exception as err: print('PyBitmessage requires PyQt unless you want to run it as a daemon' ' and interact with it using the API.' diff --git a/src/upnp.py b/src/upnp.py index 58a4ccec56..6dd7c70e4d 100644 --- a/src/upnp.py +++ b/src/upnp.py @@ -10,6 +10,7 @@ from random import randint from xml.dom.minidom import Document # nosec B408 +# pylint: disable=import-error from defusedxml.minidom import parseString from six.moves import http_client as httplib from six.moves.urllib.parse import urlparse