Resolved pylint warning in settings module
This commit is contained in:
parent
524c21243b
commit
f5b4005c07
|
@ -455,55 +455,45 @@ class SettingsDialog(QtGui.QDialog, RetranslateMixin):
|
||||||
self.config.set('bitmessagesettings', 'stopresendingafterxdays', '')
|
self.config.set('bitmessagesettings', 'stopresendingafterxdays', '')
|
||||||
self.config.set('bitmessagesettings', 'stopresendingafterxmonths', '')
|
self.config.set('bitmessagesettings', 'stopresendingafterxmonths', '')
|
||||||
shared.maximumLengthOfTimeToBotherResendingMessages = float('inf')
|
shared.maximumLengthOfTimeToBotherResendingMessages = float('inf')
|
||||||
|
|
||||||
try:
|
try:
|
||||||
float(self.lineEditDays.text())
|
days = float(self.lineEditDays.text())
|
||||||
lineEditDaysIsValidFloat = True
|
except ValueError:
|
||||||
except:
|
|
||||||
lineEditDaysIsValidFloat = False
|
|
||||||
try:
|
|
||||||
float(self.lineEditMonths.text())
|
|
||||||
lineEditMonthsIsValidFloat = True
|
|
||||||
except:
|
|
||||||
lineEditMonthsIsValidFloat = False
|
|
||||||
if lineEditDaysIsValidFloat and not lineEditMonthsIsValidFloat:
|
|
||||||
self.lineEditMonths.setText("0")
|
|
||||||
if lineEditMonthsIsValidFloat and not lineEditDaysIsValidFloat:
|
|
||||||
self.lineEditDays.setText("0")
|
self.lineEditDays.setText("0")
|
||||||
if lineEditDaysIsValidFloat or lineEditMonthsIsValidFloat:
|
days = 0.0
|
||||||
if (
|
try:
|
||||||
float(self.lineEditDays.text()) >= 0 and
|
months = float(self.lineEditMonths.text())
|
||||||
float(self.lineEditMonths.text()) >= 0
|
except ValueError:
|
||||||
):
|
self.lineEditMonths.setText("0")
|
||||||
shared.maximumLengthOfTimeToBotherResendingMessages = (
|
months = 0.0
|
||||||
float(str(self.lineEditDays.text())) * 24 * 60 * 60 +
|
|
||||||
float(str(self.lineEditMonths.text())) *
|
if days >= 0 and months >= 0:
|
||||||
60 * 60 * 24 * 365 / 12
|
shared.maximumLengthOfTimeToBotherResendingMessages = \
|
||||||
|
days * 24 * 60 * 60 + months * 60 * 60 * 24 * 365 / 12
|
||||||
|
if shared.maximumLengthOfTimeToBotherResendingMessages < 432000:
|
||||||
|
# If the time period is less than 5 hours, we give
|
||||||
|
# zero values to all fields. No message will be sent again.
|
||||||
|
QtGui.QMessageBox.about(
|
||||||
|
self,
|
||||||
|
_translate("MainWindow", "Will not resend ever"),
|
||||||
|
_translate(
|
||||||
|
"MainWindow",
|
||||||
|
"Note that the time limit you entered is less"
|
||||||
|
" than the amount of time Bitmessage waits for"
|
||||||
|
" the first resend attempt therefore your"
|
||||||
|
" messages will never be resent.")
|
||||||
)
|
)
|
||||||
if shared.maximumLengthOfTimeToBotherResendingMessages < 432000:
|
self.config.set(
|
||||||
# If the time period is less than 5 hours, we give
|
'bitmessagesettings', 'stopresendingafterxdays', '0')
|
||||||
# zero values to all fields. No message will be sent again.
|
self.config.set(
|
||||||
QtGui.QMessageBox.about(
|
'bitmessagesettings', 'stopresendingafterxmonths', '0')
|
||||||
self,
|
shared.maximumLengthOfTimeToBotherResendingMessages = 0.0
|
||||||
_translate("MainWindow", "Will not resend ever"),
|
else:
|
||||||
_translate(
|
self.config.set(
|
||||||
"MainWindow",
|
'bitmessagesettings', 'stopresendingafterxdays', str(days))
|
||||||
"Note that the time limit you entered is less"
|
self.config.set(
|
||||||
" than the amount of time Bitmessage waits for"
|
'bitmessagesettings', 'stopresendingafterxmonths',
|
||||||
" the first resend attempt therefore your"
|
str(months))
|
||||||
" messages will never be resent.")
|
|
||||||
)
|
|
||||||
self.config.set(
|
|
||||||
'bitmessagesettings', 'stopresendingafterxdays', '0')
|
|
||||||
self.config.set(
|
|
||||||
'bitmessagesettings', 'stopresendingafterxmonths', '0')
|
|
||||||
shared.maximumLengthOfTimeToBotherResendingMessages = 0
|
|
||||||
else:
|
|
||||||
self.config.set(
|
|
||||||
'bitmessagesettings', 'stopresendingafterxdays',
|
|
||||||
str(float(self.lineEditDays.text())))
|
|
||||||
self.config.set(
|
|
||||||
'bitmessagesettings', 'stopresendingafterxmonths',
|
|
||||||
str(float(self.lineEditMonths.text())))
|
|
||||||
|
|
||||||
self.config.save()
|
self.config.save()
|
||||||
|
|
||||||
|
|
Reference in New Issue
Block a user