changes in keys.dat, edit hours/days/months is working now, variable time_period inserted

This commit is contained in:
ikarakatsanis 2013-09-28 04:47:16 +04:00
parent ae01c186f4
commit e1fc820226
3 changed files with 48 additions and 2 deletions

View File

@ -2036,6 +2036,23 @@ 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
time_period = (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)
if time_period < shared.maximumAgeOfAnObjectThatIAmWillingToAccept * 2:
QMessageBox.about(self, _translate("MainWindow", "Error"), _translate(
"MainWindow", "You must insert a time period longer than 5 days."))
shared.config.set('bitmessagesettings', 'hours', '0')
shared.config.set('bitmessagesettings', 'days', '5')
shared.config.set('bitmessagesettings', 'months', '0')
else:
shared.config.set('bitmessagesettings', 'hours', str(
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
# if str(self.settingsDialogInstance.ui.comboBoxMaxCores.currentText()) == 'All':
# shared.config.set('bitmessagesettings', 'maxcores', '99999')
@ -2973,6 +2990,15 @@ class settingsDialog(QtGui.QDialog):
QtCore.QObject.connect(self.ui.pushButtonNamecoinTest, QtCore.SIGNAL(
"clicked()"), self.click_pushButtonNamecoinTest)
#Adjust 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')))
#'System' tab removed for now.
"""try:
maxCores = shared.config.getint('bitmessagesettings', 'maxcores')

View File

@ -256,6 +256,19 @@ class sqlThread(threading.Thread):
# Are you hoping to add a new option to the keys.dat file of existing
# Bitmessage users? Add it right above this line!
#my new implementation starts here
if shared.config.getint('bitmessagesettings', 'settingsversion') == 6:
shared.config.set(
'bitmessagesettings', 'hours', '0')
shared.config.set(
'bitmessagesettings', 'days', '5')
shared.config.set(
'bitmessagesettings', 'months', '0')
shared.config.set('bitmessagesettings', 'settingsversion', '7')
with open(shared.appdata + 'keys.dat', 'wb') as configfile:
shared.config.write(configfile)
#my new implementation stops here
try:
testpayload = '\x00\x00'
t = ('1234', testpayload, '12345678', 'no')

View File

@ -91,6 +91,13 @@ def loadConfig():
# existing users. To do that, search the class_sqlThread.py file for the
# text: "right above this line!"
shared.config.set(
'bitmessagesettings', 'hours', '0')
shared.config.set(
'bitmessagesettings', 'days', '5')
shared.config.set(
'bitmessagesettings', 'months', '0')
ensureNamecoinOptions()
if storeConfigFilesInSameDirectoryAsProgramByDefault: