diff --git a/工具v4/批量收录新题.py b/工具v4/批量收录新题.py index d249b8e0..ddeb21b6 100644 --- a/工具v4/批量收录新题.py +++ b/工具v4/批量收录新题.py @@ -51,33 +51,24 @@ class MyWindow_bdsl(QWidget,Ui_Form): problems_raw = re.findall(r"\\begin\{enumerate\}([\s\S]*?)\\end\{enumerate\}",data_raw) data = "\n".join([item.strip() for item in problems_raw]) problems = [(d.strip()) for d in data.split("\\item") if not d.strip() == ""] - output = "使用说明:\\\\\n rep??????表示使用已有题号??????,\\\\\n s??????表示和??????相同,\\\\\n r??????表示和??????相关\n\n\\begin{enumerate}\n\n" + output = "使用说明:\\\\\n ??????(rep)表示使用已有题号??????,\\\\\n ??????(s)表示和??????相同,\\\\\n ??????(r)表示和??????相关\n\n\\begin{enumerate}\n\n" for p in problems: p_treated = pre_treating(p) t = stringmaxsim(p_treated,treated_dict,5) - psrstring = "" - for id,simrate in t: - if simrate == 1: - psrstring = "rep"+id+"," - elif simrate > 0.5: - psrstring += id + "," - if psrstring[-1] == ",": - psrstring = psrstring[:-1] - if len(psrstring) > 0: - output += f"\\item [{psrstring}] {p}\n\n" - else: - output += f"\\item {p}\n\n" + output += f"\\item {p}\n\n" count = 0 for id,simrate in t: if simrate > 0.5: colors = get_color(simrate*2-1) output += "\n\\definecolor{mycolor}{rgb}"+colors - output += "\n\\begin{tcolorbox}"+f"[colback = mycolor, opacityback = 0.25, colframe = orange!10!white, breakable]\n" - output += f"{simrate:.3f} \\ {id}\n\n" + output += "\n\\begin{tcolorbox}"+f"[colback = mycolor, opacityback = 0.25, colframe = orange!10!white, breakable]\n\n" + output += "\\begin{flushright}\\begin{Large}\n" + output += f"{simrate:.3f} \\ {id}()\n" + output += "\\end{Large}\\end{flushright}" content = pro_dict[id] - output += f"{content}\n" + output += f"\n{content}\n" output += "\\end{tcolorbox}\n" count += 1 output += "\n\n" @@ -130,6 +121,8 @@ class MyWindow_bdsl(QWidget,Ui_Form): self.db.commit() self.db.close() print("已提交至数据库") + self.pushButton_commit.setDisabled(True) + self.problemstoimport = []