From eda2fe00da3a59455787b745add4306545a1ce6d Mon Sep 17 00:00:00 2001 From: "weiye.wang" Date: Wed, 5 Apr 2023 23:14:40 +0800 Subject: [PATCH] 20230405 night --- 工具/局部相似题目检测.py | 4 ++-- 工具/工具面板.py | 21 +++++++++++++++++---- 工具/批量收录题目.py | 2 +- 题库0.3/Problems.json | 16 ++++++++++++---- 4 files changed, 32 insertions(+), 11 deletions(-) diff --git a/工具/局部相似题目检测.py b/工具/局部相似题目检测.py index 430fa151..8ed35a58 100644 --- a/工具/局部相似题目检测.py +++ b/工具/局部相似题目检测.py @@ -1,8 +1,8 @@ import os,re,difflib,Levenshtein,time,json # 重要!!! 新旧题目的范围(有重复默认为新题) -id_new_problems = "40000:41000" -id_old_problems = "30000:31000" +id_new_problems = "30000:39999" +id_old_problems = "1:50000" threshold = 0.99 #生成数码列表, 逗号分隔每个区块, 区块内部用:表示整数闭区间 diff --git a/工具/工具面板.py b/工具/工具面板.py index 7d73029e..43dc2b52 100644 --- a/工具/工具面板.py +++ b/工具/工具面板.py @@ -11,9 +11,19 @@ root.title('题库v2.0工具面板') def temp(): pass -def SetButton(str,numbuttons,openfilelist): - commandname.set(str) - LabelTool.config(text = str) +def generate_info(string): + outputstring = "暂无信息" + if string == "寻找空闲题号": + outputstring = '功能: 在题库中列出所有空闲题号.\n1. 按"运行STEP1"按钮后等若干秒, 在终端查看结果.' + elif string == "批量收录题目": + outputstring = '功能: 在一个.tex文件中找到\\item开头的题目并收录到题库.\n'+'0. 选中菜单项后会打开一个编辑窗口, 在编辑窗口中设置\n\t(1) 初始编号;\n\t(2) 题目来源(文件中的%开头的注释行的内容会依次作为此后题目来源的后缀);\n\t(3) .tex文件名(完整路径);\n\t(4) 收录日期及编辑者;\n\t(5) 是否对题目进行编号.\n'+'1. 编辑完成后按"运行STEP1"按钮后等若干秒, 在终端查看结果.' + return outputstring + + +def SetButton(string,numbuttons,openfilelist): + commandname.set(string) + LabelTool.config(text = string) + LabelInfo.config(text = generate_info(string)) button1.place(x = 10, y = 10) button1.configure(bg = "green") if numbuttons == 1: @@ -103,8 +113,10 @@ def run_command2(): commandname = StringVar() commandname.set("none") -LabelTool = Label(root, text = "请在菜单栏选择工具", height = 1, width = 40, anchor=W) +LabelTool = Label(root, text = "请在菜单栏选择工具", height = 1, width = 40, anchor=NW) LabelTool.place(x=10,y=100) +LabelInfo = Label(root, text = "工具提示信息", height = 20, width = 100, anchor = NW, justify = "left") +LabelInfo.place(x=10,y=140) button1 = Button(root, text = "运行STEP1", command = run_command1) button2 = Button(root, text = "运行STEP2", command = run_command2) @@ -186,5 +198,6 @@ menubar.add_command(label = "退出", command = root.destroy) root.config(menu = menubar) +root.attributes("-topmost",1) root.mainloop() \ No newline at end of file diff --git a/工具/批量收录题目.py b/工具/批量收录题目.py index 304b5300..72de4691 100644 --- a/工具/批量收录题目.py +++ b/工具/批量收录题目.py @@ -103,4 +103,4 @@ if not duplicate_flag: with open(r"../题库0.3/Problems.json","w",encoding = "utf8") as f: f.write(new_database) else: - print("题号有重复, 请检查.\n"*5) \ No newline at end of file + print("题号有重复, 请检查.\n"*5+'\n'+"未录入新题目\n"*5) \ No newline at end of file diff --git a/题库0.3/Problems.json b/题库0.3/Problems.json index 39534e72..7742792b 100644 --- a/题库0.3/Problems.json +++ b/题库0.3/Problems.json @@ -314464,7 +314464,9 @@ "edit": [ "20221215\t王伟叶" ], - "same": [], + "same": [ + "040565" + ], "related": [], "remark": "", "space": "" @@ -441580,7 +441582,9 @@ "edit": [ "20230108\t王伟叶" ], - "same": [], + "same": [ + "040017" + ], "related": [], "remark": "", "space": "12ex" @@ -448825,7 +448829,9 @@ "edit": [ "20230218\t王伟叶" ], - "same": [], + "same": [ + "031130" + ], "related": [], "remark": "", "space": "12ex" @@ -459387,7 +459393,9 @@ "edit": [ "20230405\t王伟叶" ], - "same": [], + "same": [ + "012643" + ], "related": [], "remark": "", "space": ""