def OnClose(self, evt): """ 关闭函数,关闭时候将现在的self.n_list, self.r_list, self.s_list写入recordstack_xxx.txt 关闭时当前显示的卡片被弹出(pop)但是却没有给出评价,需要让其回到原来的list 没有背完的卡片应该写回recordstack_xxx.txt中 写入数据库 刷新界面 :param evt: :return: """ file.reset_nsr(self.fn) if self.nrs_list[0] == 'N': self.n_list.append(self.nrs_list) elif self.nrs_list[0] == 'S': self.s_list.append(self.nrs_list) elif self.nrs_list[0] == 'R': self.r_list.append(self.nrs_list) file.write_nsr(self.fn, self.n_list, 'N') file.write_nsr(self.fn, self.s_list, 'S') file.write_nsr(self.fn, self.r_list, 'R') self.write_db() ListCtrlRight.on_refresh() self.Destroy() pass
def NextCard(self): """ 抽取下一张单词卡片(调用fetch()函数),跟新剩余卡片数量(调用SetCardsLeft()) 当抽取完之后将记忆的结果写入到recordstack_xxx.txt,并写入到数据库。 :return: """ self.nrs_list = self.fetch() if self.nrs_list: self.ques.SetLabel(self.nrs_list[2].decode('utf-8')) self.SetAnswer(''.decode('utf-8')) self.show_ans.Enable() self.again.Disable() self.hard.Disable() self.good.Disable() self.easy.Disable() self.SetCardsLeft() else: # 任务完成 # 写入数据库 self.write_db() # reset recordstack_xxx.txt file.reset_nsr(self.fn) # 显示任务完成页面 prepare_dlg = Prepare(self.i, self.lib) prepare_dlg.ShowModal() prepare_dlg.Destroy() self.Destroy() # 刷新卡片记录界面 ListCtrlRight.on_refresh() pass
def OnClose(self, evt): # 将现在的self.n_list, self.r_list, self.s_list写入recordstack_xxx.txt file.reset_nsr(self.fn) # 关闭时当前显示的卡片被弹出(pop)但是却没有给出评价,需要让其回到原来的list if self.nrs_list[0] == 'N': self.n_list.append(self.nrs_list) elif self.nrs_list[0] == 'S': self.s_list.append(self.nrs_list) elif self.nrs_list[0] == 'R': self.r_list.append(self.nrs_list) # 没有背完的卡片应该写回recordstack_xxx.txt中 file.write_nsr(self.fn, self.n_list, 'N') file.write_nsr(self.fn, self.s_list, 'S') file.write_nsr(self.fn, self.r_list, 'R') # 写入数据库 self.write_db() # 刷新界面 ListCtrlRight.on_refresh() # 关闭窗口 self.Destroy() pass
def NextCard(self): self.nrs_list = self.fetch() if self.nrs_list: self.ques.SetLabel(self.nrs_list[2].encode('utf-8')) self.SetAnswer('') self.show_ans.Enable() self.again.Disable() self.hard.Disable() self.good.Disable() self.easy.Disable() self.SetCardsLeft() else: # 任务完成 # 写入数据库 self.write_db() # reset recordstack_xxx.txt file.reset_nsr(self.fn) # 显示任务完成页面 self.Destroy() prepare_dlg = Prepare(self.i, self.lib) # 刷新卡片记录界面 ListCtrlRight.on_refresh() pass