Fixed: Code style and lint issues

This commit is contained in:
coffeedogs 2018-06-15 12:54:41 +01:00
parent d9f0a8708b
commit e5e9f70c2a
No known key found for this signature in database
GPG Key ID: 9D818C503D0B7E70

View File

@ -2510,13 +2510,13 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
if self.getCurrentFolder(treeWidget) != "sent": if self.getCurrentFolder(treeWidget) != "sent":
continue continue
if ( if (
treeWidget == self.ui.treeWidgetYourIdentities treeWidget == self.ui.treeWidgetYourIdentities and
and self.getCurrentAccount(treeWidget) not in (fromAddress, None, False) self.getCurrentAccount(treeWidget) not in (fromAddress, None, False)
): ):
continue continue
elif ( elif (
treeWidget in [self.ui.treeWidgetSubscriptions, self.ui.treeWidgetChans] treeWidget in [self.ui.treeWidgetSubscriptions, self.ui.treeWidgetChans] and
and self.getCurrentAccount(treeWidget) != toAddress self.getCurrentAccount(treeWidget) != toAddress
): ):
continue continue
elif not helper_search.check_match( elif not helper_search.check_match(
@ -2562,9 +2562,9 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
): ):
continue continue
if ( if (
tableWidget == inbox tableWidget == inbox and
and self.getCurrentAccount(treeWidget) == acct.address self.getCurrentAccount(treeWidget) == acct.address and
and self.getCurrentFolder(treeWidget) in ["inbox", None] self.getCurrentFolder(treeWidget) in ["inbox", None]
): ):
ret = self.addMessageListItemInbox( ret = self.addMessageListItemInbox(
inbox, inbox,
@ -2577,9 +2577,9 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
0, 0,
) )
elif ( elif (
treeWidget == self.ui.treeWidgetYourIdentities treeWidget == self.ui.treeWidgetYourIdentities and
and self.getCurrentAccount(treeWidget) is None self.getCurrentAccount(treeWidget) is None and
and self.getCurrentFolder(treeWidget) in ["inbox", "new", None] self.getCurrentFolder(treeWidget) in ["inbox", "new", None]
): ):
ret = self.addMessageListItemInbox( ret = self.addMessageListItemInbox(
tableWidget, tableWidget,
@ -2604,12 +2604,12 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
unicode(acct.fromLabel, 'utf-8')), unicode(acct.fromLabel, 'utf-8')),
sound.SOUND_UNKNOWN sound.SOUND_UNKNOWN
) )
# pylint: disable=undefined-loop-variable
if ( if (
self.getCurrentAccount() is not None self.getCurrentAccount() is not None and (
and ( self.getCurrentFolder(treeWidget) not in ("inbox", None) or
self.getCurrentFolder(treeWidget) not in ("inbox", None) # pylint: disable=undefined-loop-variable self.getCurrentAccount(treeWidget) != acct.address
or self.getCurrentAccount(treeWidget) != acct.address # pylint: disable=undefined-loop-variable )
)
): ):
# Ubuntu should notify of new message irespective of # Ubuntu should notify of new message irespective of
# whether it's in current message list or not # whether it's in current message list or not
@ -2619,6 +2619,7 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
if acct.feedback == GatewayAccount.REGISTRATION_DENIED: if acct.feedback == GatewayAccount.REGISTRATION_DENIED:
dialogs.EmailGatewayDialog( dialogs.EmailGatewayDialog(
self, BMConfigParser(), acct).exec_() self, BMConfigParser(), acct).exec_()
# pylint: enable=undefined-loop-variable
def click_pushButtonAddAddressBook(self, dialog=None): def click_pushButtonAddAddressBook(self, dialog=None):
"""TBC""" """TBC"""
@ -2777,8 +2778,8 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
upnpThread.start() upnpThread.start()
if ( if (
BMConfigParser().get('bitmessagesettings', 'socksproxytype') == 'none' BMConfigParser().get('bitmessagesettings', 'socksproxytype') == 'none' and
and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS' self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] == 'SOCKS'
): ):
if shared.statusIconColor != 'red': if shared.statusIconColor != 'red':
QtGui.QMessageBox.about( QtGui.QMessageBox.about(
@ -2792,8 +2793,8 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
"Bitmessage now to close existing connections (if any)."))) "Bitmessage now to close existing connections (if any).")))
if ( if (
BMConfigParser().get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' BMConfigParser().get('bitmessagesettings', 'socksproxytype')[0:5] == 'SOCKS' and
and self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] != 'SOCKS' self.settingsDialogInstance.ui.comboBoxProxyType.currentText()[0:5] != 'SOCKS'
): ):
self.statusbar.clearMessage() self.statusbar.clearMessage()
state.resetNetworkProtocolAvailability() # just in case we changed something in the network connectivity state.resetNetworkProtocolAvailability() # just in case we changed something in the network connectivity
@ -2861,8 +2862,8 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
acceptableDifficultyChanged = False acceptableDifficultyChanged = False
if ( if (
float(self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) >= 1 float(self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) >= 1 or
or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) == 0 float(self.settingsDialogInstance.ui.lineEditMaxAcceptableTotalDifficulty.text()) == 0
): ):
if BMConfigParser().get( if BMConfigParser().get(
'bitmessagesettings', 'bitmessagesettings',
@ -2881,8 +2882,8 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
) * defaults.networkDefaultProofOfWorkNonceTrialsPerByte))) ) * defaults.networkDefaultProofOfWorkNonceTrialsPerByte)))
if ( if (
float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) >= 1 float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) >= 1 or
or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) == 0 float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) == 0
): ):
if BMConfigParser().get( if BMConfigParser().get(
'bitmessagesettings', 'bitmessagesettings',
@ -2910,8 +2911,8 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
# start:UI setting to stop trying to send messages after X days/months # start:UI setting to stop trying to send messages after X days/months
# I'm open to changing this UI to something else if someone has a better idea. # I'm open to changing this UI to something else if someone has a better idea.
if ( if (
self.settingsDialogInstance.ui.lineEditDays.text() == '' self.settingsDialogInstance.ui.lineEditDays.text() == '' and
and self.settingsDialogInstance.ui.lineEditMonths.text() == '' self.settingsDialogInstance.ui.lineEditMonths.text() == ''
): # We need to handle this special case. Bitmessage has its default behavior. The input is blank/blank ): # We need to handle this special case. Bitmessage has its default behavior. The input is blank/blank
BMConfigParser().set('bitmessagesettings', 'stopresendingafterxdays', '') BMConfigParser().set('bitmessagesettings', 'stopresendingafterxdays', '')
BMConfigParser().set('bitmessagesettings', 'stopresendingafterxmonths', '') BMConfigParser().set('bitmessagesettings', 'stopresendingafterxmonths', '')
@ -2932,8 +2933,8 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
self.settingsDialogInstance.ui.lineEditDays.setText("0") self.settingsDialogInstance.ui.lineEditDays.setText("0")
if lineEditDaysIsValidFloat or lineEditMonthsIsValidFloat: if lineEditDaysIsValidFloat or lineEditMonthsIsValidFloat:
if ( if (
float(self.settingsDialogInstance.ui.lineEditDays.text()) >= 0 float(self.settingsDialogInstance.ui.lineEditDays.text()) >= 0 and
and float(self.settingsDialogInstance.ui.lineEditMonths.text()) >= 0 float(self.settingsDialogInstance.ui.lineEditMonths.text()) >= 0
): ):
shared.maximumLengthOfTimeToBotherResendingMessages = sum( shared.maximumLengthOfTimeToBotherResendingMessages = sum(
float(str(self.settingsDialogInstance.ui.lineEditDays.text())) * 24 * 60 * 60, float(str(self.settingsDialogInstance.ui.lineEditDays.text())) * 24 * 60 * 60,
@ -4246,6 +4247,7 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
def on_action_ClipboardMessagelist(self): def on_action_ClipboardMessagelist(self):
"""TBC""" """TBC"""
# pylint: disable=too-many-boolean-expressions
tableWidget = self.getCurrentMessagelist() tableWidget = self.getCurrentMessagelist()
currentColumn = tableWidget.currentColumn() currentColumn = tableWidget.currentColumn()
@ -4263,12 +4265,11 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole) otherAddress = tableWidget.item(currentRow, 1).data(QtCore.Qt.UserRole)
account = accountClass(myAddress) account = accountClass(myAddress)
if ( if (
isinstance(account, GatewayAccount) isinstance(account, GatewayAccount) and
and otherAddress == account.relayAddress otherAddress == account.relayAddress and (
and ( currentColumn in [0, 2] and self.getCurrentFolder() == "sent" or
currentColumn in [0, 2] and self.getCurrentFolder() == "sent" currentColumn in [1, 2] and self.getCurrentFolder() != "sent"
or currentColumn in [1, 2] and self.getCurrentFolder() != "sent" )
)
): ):
text = str(tableWidget.item(currentRow, currentColumn).label) text = str(tableWidget.item(currentRow, currentColumn).label)
@ -4614,9 +4615,9 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
return return
# only account names of normal addresses (no chans/mailinglists) # only account names of normal addresses (no chans/mailinglists)
if ( if (
not isinstance(item, Ui_AddressWidget) not isinstance(item, Ui_AddressWidget) or
or not self.getCurrentTreeWidget() not self.getCurrentTreeWidget() or
or self.getCurrentTreeWidget().currentItem() is None self.getCurrentTreeWidget().currentItem() is None
): ):
return return
@ -4687,8 +4688,8 @@ class MyForm(settingsmixin.SMainWindow): # pylint: disable=too-many-public-meth
self.updateUnreadStatus(tableWidget, currentRow, msgid) self.updateUnreadStatus(tableWidget, currentRow, msgid)
# propagate # propagate
if ( if (
folder != 'sent' folder != 'sent' and
and sqlExecute('''UPDATE inbox SET read=1 WHERE msgid=? AND read=0''', msgid) > 0 sqlExecute('''UPDATE inbox SET read=1 WHERE msgid=? AND read=0''', msgid) > 0
): ):
self.propagateUnreadCount() self.propagateUnreadCount()