feature1_v4

This commit is contained in:
ikarakatsanis 2013-10-06 12:32:14 +04:00
parent 5fb08efe00
commit 44bd876a40

View File

@ -2027,34 +2027,34 @@ class MyForm(QtGui.QMainWindow):
if float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) >= 1 or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) == 0: if float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) >= 1 or float(self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) == 0:
shared.config.set('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', str(int(float( shared.config.set('bitmessagesettings', 'maxacceptablepayloadlengthextrabytes', str(int(float(
self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) * shared.networkDefaultPayloadLengthExtraBytes))) self.settingsDialogInstance.ui.lineEditMaxAcceptableSmallMessageDifficulty.text()) * shared.networkDefaultPayloadLengthExtraBytes)))
#my implementation starts here,it was a line here.AQWA #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 ((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 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', 'days')) != str(self.settingsDialogInstance.ui.lineEditDays.text())) or
((shared.config.get('bitmessagesettings', 'months')) != str(self.settingsDialogInstance.ui.lineEditMonths.text()))) : ((shared.config.get('bitmessagesettings', 'months')) != str(self.settingsDialogInstance.ui.lineEditMonths.text()))):
QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate( QMessageBox.about(self, _translate("MainWindow", "Restart"), _translate(
"MainWindow", "You must restart Bitmessage for the time period change to take effect.")) "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', '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', 'days', '')#these commands update each field in the keys.dat file.AQWA
shared.config.set('bitmessagesettings', 'months', '') shared.config.set('bitmessagesettings', 'months', '')
shared.config.set('bitmessagesettings', 'timeperiod', '-1') 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 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()))
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 + 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)) int(str(self.settingsDialogInstance.ui.lineEditMonths.text())) * (60 * 60 * 24 *365)/12))
#my implementation stops here, it was a line.AQWA
if (((shared.config.get('bitmessagesettings', 'hours')) != str(self.settingsDialogInstance.ui.lineEditHours.text())) or#inform user tha he needs to restart bitmessage 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()))
#my implementation stops here, there is a line.AQWA
# if str(self.settingsDialogInstance.ui.comboBoxMaxCores.currentText()) == 'All': # if str(self.settingsDialogInstance.ui.comboBoxMaxCores.currentText()) == 'All':
# shared.config.set('bitmessagesettings', 'maxcores', '99999') # shared.config.set('bitmessagesettings', 'maxcores', '99999')