优化退出保存逻辑

master-class
MrB 1 year ago
parent 6d53be0ad2
commit 033735580a

@ -172,9 +172,6 @@ class Form(Form1):
# self.lll.append(key)
# print(self.lll)
def update_time(self):
self.total_seconds += 1
@ -187,6 +184,7 @@ class Form(Form1):
def B_save_fun(self):
global sudo, cnt, del_cnt
try:
# 保存已填处,第一位用于记录cnt,第二位记录delcnt第三位记录time
answer_list = [cnt, del_cnt, self.total_seconds]
@ -200,13 +198,13 @@ class Form(Form1):
pickle.dump(sudo, f)
QMessageBox.information(self, '提示', '保存成功')
self.change_flag = 0
except Exception as e:
QMessageBox.information(self, '提示', f'保存发生错误:{e}')
def B_read_fun(self):
global sudo, cnt, subject_with_answer, del_cnt
self.change_flag = 1
self.change_flag = 0
self.B_save.setDisabled(False)
answer_list = None
with open('as.pickle', 'rb') as f:
@ -231,7 +229,6 @@ class Form(Form1):
i = 1
self.translate(subject_with_answer, 1)
def B_back(self):
global stack, cnt, subject_with_answer
self.change_flag = 1
@ -281,6 +278,7 @@ class Form(Form1):
# print("yes")
if del_cnt == cnt:
QMessageBox.information(self, '提示', '成功')
self.change_flag = 0
self.timer.stop()
else:
# print("no")
@ -300,10 +298,6 @@ class Form(Form1):
else:
self.move(self.x() - 7, self.y())
def put_num(self):
global cnt, del_cnt, subject_with_answer, stack
@ -350,6 +344,7 @@ class Form(Form1):
self.check_sudo()
else:
self.check_sudo(1)
self.change_flag = 1
def B_S_fun(self):
global cnt, del_cnt, stack, sudo, subject_with_answer

Loading…
Cancel
Save