def on_filter(e, ob, f, r): filter_key = 0 # 获取到筛选LIST的序号 for i, album in enumerate(f): # filter_dic[i] = album if album == ob.GetValue(): filter_key = i if filter_key == 0: r = FrameFun.find_all(-1) pass elif filter_key == 1: r = FrameFun.find_expired(-1) pass elif filter_key == 2: r = FrameFun.find_remembered() pass elif filter_key == 3: new_list = FrameFun.find_new(-1)[:50] review_list = FrameFun.find_expired(-1)[:50] r = new_list + review_list pass elif filter_key == 4: r = FrameFun.find_learned() pass elif filter_key == 5: r = FrameFun.find_hard() pass elif filter_key == 6: r = FrameFun.find_today() pass RECORDS = r window = wx.FindWindowByName('ListControlOnRight', parent=None) window.load_data_right(RECORDS)
def on_filter(e, ob, f, r): """ 根据选择的filter序号,调用对应的函数(这个函数指FrameFun.xxx())对当前的RECORDS进行筛选 FrameFun.find_all(), 返回record表中所有的单词卡片 FrameFun.find_expired(),返回过期单词卡片 FrameFun.find_remembered(),返回已经记住的单词卡片 FrameFun.find_new(),返回暂未学习过的单词卡片 FrameFun.find_learned(),返回已经学习过的单词卡片 FrameFun.find_hard(),返回困难的单词卡片 FrameFun.find_today(),返回今天添加的单词卡片 最后将获取到的单词卡片列表作为参数,调用load_data_right。实现刷新右侧的单词卡片列表 :param e: :param ob: wx.ComboBox对象 :param f: filter_list列表 :param r: RECORDS :return: """ filter_key = 0 # 获取到筛选LIST的序号 for i, album in enumerate(f): # filter_dic[i] = album if album == ob.GetValue(): filter_key = i if filter_key == 0: r = FrameFun.find_all(-1) pass elif filter_key == 1: r = FrameFun.find_expired(-1) pass elif filter_key == 2: r = FrameFun.find_remembered() pass elif filter_key == 3: new_list = FrameFun.find_new(-1)[:50] review_list = FrameFun.find_expired(-1)[:50] r = new_list + review_list pass elif filter_key == 4: r = FrameFun.find_learned() pass elif filter_key == 5: r = FrameFun.find_hard() pass elif filter_key == 6: r = FrameFun.find_today() pass RECORDS = r window = wx.FindWindowByName('ListControlOnRight', parent=None) window.load_data_right(RECORDS)