diff --git a/src/bitmessageqt/__init__.py b/src/bitmessageqt/__init__.py index 3280f2d8..f8563a9c 100644 --- a/src/bitmessageqt/__init__.py +++ b/src/bitmessageqt/__init__.py @@ -2027,34 +2027,47 @@ class MyForm(QtGui.QMainWindow): if float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) >= 1 or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) == 0: shared.config.set('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', str(int(float( self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) * shared.networkDefaultPayloadLengthExtraBytes))) - #my implementation starts here,it was a line here.AQWA - if ((self.settingsDialogInstance.ui.lineEditHours.text()=='') and (self.settingsDialogInstance.ui.lineEditDays.text()=='') and (self.settingsDialogInstance.ui.lineEditMonths.text()=='')): - if (((shared.config.get('bitmessagesettings', 'hours')) != str(self.settingsDialogInstance.ui.lineEditHours.text())) or #if we update the time period from one time period(f.e 1/0/0) to default -/-/,inform the user that restart is needed in order his changes to take effect.AQWA + #start:UI setting to stop trying to send messages after X hours/days/months + if ((self.settingsDialogInstance.ui.lineEditHours.text()=='') and (self.settingsDialogInstance.ui.lineEditDays.text()=='') and (self.settingsDialogInstance.ui.lineEditMonths.text()=='')):#We need to handle this special case. Bitmessage has its default behavior. The input is blank/blank/blank + if (((shared.config.get('bitmessagesettings', 'hours')) != str(self.settingsDialogInstance.ui.lineEditHours.text())) or #the user updated the input, restart is needed ((shared.config.get('bitmessagesettings', 'days')) != str(self.settingsDialogInstance.ui.lineEditDays.text())) or - ((shared.config.get('bitmessagesettings', 'months')) != str(self.settingsDialogInstance.ui.lineEditMonths.text()))): - QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( - "MainWindow", "You must restart Bitmessage for the time period change to take effect.")) - shared.config.set('bitmessagesettings', 'hours', '')#give default values to fields..this default situation is special and thats why its needs special treatment ;).AQWA - shared.config.set('bitmessagesettings', 'days', '')#these commands update each field in the keys.dat file.AQWA - shared.config.set('bitmessagesettings', 'months', '') - shared.config.set('bitmessagesettings', 'timeperiod', '-1') - else:#So,if all time period fields(hours,months,days) have valid values(valid values---> 0/0/0, 0/3/2, -/-/-, no valid--> -/0/5, 5/-/-), you can calculate the time period - if (int(str(self.settingsDialogInstance.ui.lineEditHours.text())) >=0 and int(str(self.settingsDialogInstance.ui.lineEditDays.text())) >=0 and - int(str(self.settingsDialogInstance.ui.lineEditMonths.text())) >=0): - if (((shared.config.get('bitmessagesettings', 'hours')) != str(self.settingsDialogInstance.ui.lineEditHours.text())) or #if we update the time period from one time period(f.e 1/0/0) to default -/-/,inform the user that restart is needed in order his changes to take effect.AQWA - ((shared.config.get('bitmessagesettings', 'days')) != str(self.settingsDialogInstance.ui.lineEditDays.text())) or ((shared.config.get('bitmessagesettings', 'months')) != str(self.settingsDialogInstance.ui.lineEditMonths.text()))): QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( - "MainWindow", "You must restart Bitmessage for the time period change to take effect.")) - shared.config.set('bitmessagesettings', 'hours', str(#this three commands update the fields of this new setting in keys.dat file.AQWA - self.settingsDialogInstance.ui.lineEditHours.text())) - shared.config.set('bitmessagesettings', 'days', str( - self.settingsDialogInstance.ui.lineEditDays.text())) - shared.config.set('bitmessagesettings', 'months', str( - self.settingsDialogInstance.ui.lineEditMonths.text())) + "MainWindow", "You must restart Bitmessage for the time period change to take effect.")) + shared.config.set('bitmessagesettings', 'hours', '') + shared.config.set('bitmessagesettings', 'days', '') + shared.config.set('bitmessagesettings', 'months', '') + shared.config.set('bitmessagesettings', 'timeperiod', '-1')#when bitmessage has its default resending behavior, we set timeperiod to -1. + else:#So,if all time period's variables (hours,days,months) have valid values, we calculate the time period + if (int(self.settingsDialogInstance.ui.lineEditHours.text()) >=0 and int(self.settingsDialogInstance.ui.lineEditDays.text()) >=0 and + int(self.settingsDialogInstance.ui.lineEditMonths.text()) >=0): shared.config.set('bitmessagesettings', 'timeperiod', str(int(str(self.settingsDialogInstance.ui.lineEditHours.text())) * 60 * 60 + int(str(self.settingsDialogInstance.ui.lineEditDays.text())) * 24 * 60 * 60 + int(str(self.settingsDialogInstance.ui.lineEditMonths.text())) * (60 * 60 * 24 *365)/12)) - #my implementation stops here, it was a line.AQWA + if int(shared.config.get('bitmessagesettings', 'timeperiod')) < 432000:#if the time period is less than 5 hours, we give zero values to all fields. No message will be sent again. + if ((shared.config.get('bitmessagesettings', 'hours')) != str(int(self.settingsDialogInstance.ui.lineEditHours.text())) or #if the user has given an input bigger than 5 days and he tries now to give an input less than 5 days, restart is needed + shared.config.get('bitmessagesettings', 'days') != str(int(self.settingsDialogInstance.ui.lineEditDays.text())) or + shared.config.get('bitmessagesettings', 'months') != str(int(self.settingsDialogInstance.ui.lineEditMonths.text()))): + if((shared.config.get('bitmessagesettings', 'hours')) != '0' or (shared.config.get('bitmessagesettings', 'days')) != '0' or#if the user has already given an input less than 5 days and he tries now to give again an input less than 5 days, there is no need for restart. Input values will remain zero + (shared.config.get('bitmessagesettings', 'months')) != '0'): + QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( + "MainWindow", "You must restart Bitmessage for the time period change to take effect.")) + shared.config.set('bitmessagesettings', 'hours', '0') + shared.config.set('bitmessagesettings', 'days', '0') + shared.config.set('bitmessagesettings', 'months', '0') + shared.config.set('bitmessagesettings', 'timeperiod', '0') + else: + if ((shared.config.get('bitmessagesettings', 'hours')) != str(int(self.settingsDialogInstance.ui.lineEditHours.text())) or + shared.config.get('bitmessagesettings', 'days') != str(int(self.settingsDialogInstance.ui.lineEditDays.text())) or + shared.config.get('bitmessagesettings', 'months') != str(int(self.settingsDialogInstance.ui.lineEditMonths.text()))): + QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(#the user updated the input, restart is needed + "MainWindow", "You must restart Bitmessage for the time period change to take effect.")) + shared.config.set('bitmessagesettings', 'hours', str(int( + self.settingsDialogInstance.ui.lineEditHours.text()))) + shared.config.set('bitmessagesettings', 'days', str(int( + self.settingsDialogInstance.ui.lineEditDays.text()))) + shared.config.set('bitmessagesettings', 'months', str(int( + self.settingsDialogInstance.ui.lineEditMonths.text()))) + #end # if str(self.settingsDialogInstance.ui.comboBoxMaxCores.currentText()) == 'All': # shared.config.set('bitmessagesettings', 'maxcores', '99999') @@ -2992,13 +3005,13 @@ class settingsDialog(QtGui.QDialog): QtCore.QObject.connect(self.ui.pushButtonNamecoinTest, QtCore.SIGNAL( "clicked()"), self.click_pushButtonNamecoinTest) - #Adjusting time period for resending messages tab.AQWA - self.ui.lineEditHours.setText(str(#Giving values to edit boxes in the UI.AQWA + #Adjusting time period to stop sending messages tab + self.ui.lineEditHours.setText(str( shared.config.get('bitmessagesettings', 'hours'))) self.ui.lineEditDays.setText(str( shared.config.get('bitmessagesettings', 'days'))) self.ui.lineEditMonths.setText(str( - shared.config.get('bitmessagesettings', 'months')))#AQWA. + shared.config.get('bitmessagesettings', 'months'))) #'System' tab removed for now. diff --git a/src/bitmessageqt/settings.py b/src/bitmessageqt/settings.py index f9c3518a..4667021b 100644 --- a/src/bitmessageqt/settings.py +++ b/src/bitmessageqt/settings.py @@ -318,10 +318,9 @@ class Ui_settingsDialog(object): self.gridLayout_8.addLayout(self.horizontalLayout, 1, 0, 1, 3) self.tabWidgetSettings.addTab(self.tabNamecoin, _fromUtf8("")) self.gridLayout.addWidget(self.tabWidgetSettings, 0, 0, 1, 1) -#this line existed before -#my new implementation starts here - self.tabResendingMessagesAdjustment=QtGui.QWidget()#all these lines are for the UI implementation, I dont think that you need special explanation about them.AQWA - self.tabResendingMessagesAdjustment.setObjectName(_fromUtf8("tabResendingMessagesAdjustment"))#Please note that approximately 58 line codes added to setting.ui also responsible for the UI.AQWA + #start:UI setting to stop trying to send messages after X hours/days/months + self.tabResendingMessagesAdjustment=QtGui.QWidget() + self.tabResendingMessagesAdjustment.setObjectName(_fromUtf8("tabResendingMessagesAdjustment")) self.gridLayout_9 = QtGui.QGridLayout(self.tabResendingMessagesAdjustment) self.gridLayout_9.setObjectName(_fromUtf8("gridLayout_9")) self.label_19 = QtGui.QLabel(self.tabResendingMessagesAdjustment) @@ -335,11 +334,11 @@ class Ui_settingsDialog(object): self.label_20 = QtGui.QLabel(self.tabResendingMessagesAdjustment) self.label_20.setLayoutDirection(QtCore.Qt.LeftToRight) self.label_20.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) - self.label_20.setObjectName(_fromUtf8("label_20"))#This are Qt code..I just add a label to my tab.AQWA + self.label_20.setObjectName(_fromUtf8("label_20")) self.gridLayout_9.addWidget(self.label_20, 2, 0, 1, 1) self.lineEditHours = QtGui.QLineEdit(self.tabResendingMessagesAdjustment) self.lineEditHours.setMaximumSize(QtCore.QSize(33, 16777)) - self.lineEditHours.setObjectName(_fromUtf8("lineEditHours"))##This are Qt code..I just add a edit box to my tab.AQWA + self.lineEditHours.setObjectName(_fromUtf8("lineEditHours")) self.gridLayout_9.addWidget(self.lineEditHours, 2, 1, 1, 1) self.label_22 = QtGui.QLabel(self.tabResendingMessagesAdjustment) self.label_22.setAlignment(QtCore.Qt.AlignRight|QtCore.Qt.AlignTrailing|QtCore.Qt.AlignVCenter) @@ -360,7 +359,7 @@ class Ui_settingsDialog(object): spacerItem15 = QtGui.QSpacerItem(20, 147, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) self.gridLayout_9.addItem(spacerItem15, 3, 1, 1, 1) self.tabWidgetSettings.addTab(self.tabResendingMessagesAdjustment, _fromUtf8("")) - #my new implementation stops here, it wasn't line here + #end self.retranslateUi(settingsDialog) self.tabWidgetSettings.setCurrentIndex(0) QtCore.QObject.connect(self.buttonBox, QtCore.SIGNAL(_fromUtf8("accepted()")), settingsDialog.accept) @@ -424,13 +423,13 @@ class Ui_settingsDialog(object): self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tab), _translate("settingsDialog", "Demanded difficulty", None)) self.label_15.setText(_translate("settingsDialog", "Here you may set the maximum amount of work you are willing to do to send a message to another person. Setting these values to 0 means that any value is acceptable.", None)) self.label_13.setText(_translate("settingsDialog", "Maximum acceptable total difficulty:", None)) - #my new implementation starts here,it wasn't line here.Too simple to explain :D..AQWA - self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabResendingMessagesAdjustment), _translate("settingsDialog", "Adjusting time period for resending messages", None)) - self.label_19.setText(_translate("settingsDialog", "
If you send a message to someone and he is offline for more than two days, Bitmessage will send the message again after an additional two days. This will be continued with exponential backoff forever. Messages will continue to be sent after 4, 8,16 days and so on until the receiver get them.
Here you can adjust Bitmessage to stop trying to send messages after X hours/days/months.
", None)) + #start:UI setting to stop trying to send messages after X hours/days/months + self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tabResendingMessagesAdjustment), _translate("settingsDialog", "Adjusting time period to stop sending messages", None)) + self.label_19.setText(_translate("settingsDialog", "If you send a message to someone and he is offline for more than two and a half days, Bitmessage will send the message again after an additional two and a half days. This will be continued with exponential backoff forever. Μessages will continue to be sent after 5, 10, 20 days etc. until the receiver gets them.
Leaving all the input fields blank means the default behavior which will continue the resending with exponential backoff.
Setting these values to 0/0/0 or less than 5 days mean that the client will not resend any messages.
Here you can adjust Bitmessage to stop trying to send messages after X hours/days/months.
", None)) self.label_20.setText(_translate("settingsDialog", "Time in hours/days/months:", None)) self.label_22.setText(_translate("settingsDialog", "/", None)) self.label_23.setText(_translate("settingsDialog", "/", None)) - #my new implementation stops here, it wasn't line here + #end self.label_14.setText(_translate("settingsDialog", "Maximum acceptable small message difficulty:", None)) self.tabWidgetSettings.setTabText(self.tabWidgetSettings.indexOf(self.tab_2), _translate("settingsDialog", "Max acceptable difficulty", None)) self.label_16.setText(_translate("settingsDialog", "Bitmessage can utilize a different Bitcoin-based program called Namecoin to make addresses human-friendly. For example, instead of having to tell your friend your long Bitmessage address, you can simply tell him to send a message to test.
(Getting your own Bitmessage address into Namecoin is still rather difficult).
Bitmessage can use either namecoind directly or a running nmcontrol instance.
", None)) diff --git a/src/bitmessageqt/settings.ui b/src/bitmessageqt/settings.ui index 94610c03..9ecdfa11 100644 --- a/src/bitmessageqt/settings.ui +++ b/src/bitmessageqt/settings.ui @@ -758,13 +758,13 @@