From beeb2fd318d0dec111b992ff071911571ad541e9 Mon Sep 17 00:00:00 2001 From: david-ajax Date: Thu, 28 Aug 2025 13:08:37 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E8=BF=9B=20=F0=9F=8D=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- assets/heurams.svg | 42 +++++++++++ auxiliary.py | 3 + compositions.py | 2 +- config.toml | 14 ---- electron/E-朝天子·咏喇叭.toml | 0 electron/E-贺新郎·国脉微如缕.toml | 0 main.py | 4 +- nucleon/E-朝天子·咏喇叭.toml | 42 +++++++++++ nucleon/E-苏幕遮·燎沉香.toml | 47 ++++++++++++ nucleon/E-贺新郎·国脉微如缕.toml | 72 +++++++++++++++++++ nucleon/E-青玉案·元夕.toml | 42 +++++++++++ {nucleon => nucleon_hide}/劝学.toml | 0 {nucleon => nucleon_hide}/师说.toml | 0 {nucleon => nucleon_hide}/归去来兮辞.toml | 0 {nucleon => nucleon_hide}/梦游天姥吟留别.toml | 0 {nucleon => nucleon_hide}/赤壁赋.toml | 0 {nucleon => nucleon_hide}/陈情表.toml | 0 {nucleon => nucleon_todo}/谏太宗十思疏.toml | 0 {nucleon => nucleon_todo}/过秦论.toml | 0 particles.py | 6 +- reactor.py | 3 +- 21 files changed, 258 insertions(+), 19 deletions(-) create mode 100644 assets/heurams.svg create mode 100644 electron/E-朝天子·咏喇叭.toml create mode 100644 electron/E-贺新郎·国脉微如缕.toml create mode 100644 nucleon/E-朝天子·咏喇叭.toml create mode 100644 nucleon/E-苏幕遮·燎沉香.toml create mode 100644 nucleon/E-贺新郎·国脉微如缕.toml create mode 100644 nucleon/E-青玉案·元夕.toml rename {nucleon => nucleon_hide}/劝学.toml (100%) rename {nucleon => nucleon_hide}/师说.toml (100%) rename {nucleon => nucleon_hide}/归去来兮辞.toml (100%) rename {nucleon => nucleon_hide}/梦游天姥吟留别.toml (100%) rename {nucleon => nucleon_hide}/赤壁赋.toml (100%) rename {nucleon => nucleon_hide}/陈情表.toml (100%) rename {nucleon => nucleon_todo}/谏太宗十思疏.toml (100%) rename {nucleon => nucleon_todo}/过秦论.toml (100%) diff --git a/assets/heurams.svg b/assets/heurams.svg new file mode 100644 index 0000000..4ae0d4b --- /dev/null +++ b/assets/heurams.svg @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/auxiliary.py b/auxiliary.py index 997931e..6fcd90a 100644 --- a/auxiliary.py +++ b/auxiliary.py @@ -38,6 +38,9 @@ class ConfigFile: return self.data.get(key, default) def action_play_voice(content): + config = ConfigFile("config.toml") + if config.get("auto_voice", False): + return def play(): communicate = tts.Communicate( content, diff --git a/compositions.py b/compositions.py index 3a132ba..0b39ace 100644 --- a/compositions.py +++ b/compositions.py @@ -174,7 +174,7 @@ class FillBlank(Composition): self._work() def _work(self): - self.puzzle = pz.BlankPuzzle(self.atom[1]["content"], 4) + self.puzzle = pz.BlankPuzzle(self.atom[1]["content"], 2) self.puzzle.refresh() self.ans = copy.copy(self.puzzle.answer) random.shuffle(self.ans) diff --git a/config.toml b/config.toml index 76c3393..e69de29 100644 --- a/config.toml +++ b/config.toml @@ -1,14 +0,0 @@ -# [调试] 将更改保存到文件 -save = 1 - -# [调试] 覆写时间 -time_override = -1 - -# [调试] 一键通过 -quick_pass = 0 - -# 对于每个项目的新记忆核子数量 -tasked_number = 8 - -# 竖屏适配 (未完成) -mobile_mode = 1 \ No newline at end of file diff --git a/electron/E-朝天子·咏喇叭.toml b/electron/E-朝天子·咏喇叭.toml new file mode 100644 index 0000000..e69de29 diff --git a/electron/E-贺新郎·国脉微如缕.toml b/electron/E-贺新郎·国脉微如缕.toml new file mode 100644 index 0000000..e69de29 diff --git a/main.py b/main.py index 3955128..670805c 100644 --- a/main.py +++ b/main.py @@ -22,7 +22,7 @@ import auxiliary as aux import compositions as compo import builtins -ver = "0.3.1" +ver = "0.3.2" config = aux.ConfigFile("config.toml") @@ -183,7 +183,7 @@ class PreparationScreen(Screen): def on_button_pressed(self, event: Button.Pressed) -> None: if event.button.id == "start_memorizing_button": newscr = MemScreen( - self.nucleon_file, self.electron_file, config.get("tasked_number", 8) + self.nucleon_file, self.electron_file, config.get("tasked_number", 6) ) self.app.push_screen(newscr) diff --git a/nucleon/E-朝天子·咏喇叭.toml b/nucleon/E-朝天子·咏喇叭.toml new file mode 100644 index 0000000..b3f54ca --- /dev/null +++ b/nucleon/E-朝天子·咏喇叭.toml @@ -0,0 +1,42 @@ +# 散列表的键翻译 +["keydata"] +note = "笔记" +keyword_note = "关键词翻译" +translation = "语句翻译" + +# 测试项目元数据 +["testdata"] +# 记忆时显示的额外信息 +additional_inf = ["translation","keyword_note", "note"] +# 填空测试, content 指代键名 +fill_blank_test = {"from"=["content"], "hint"=["translation"]} + +["喇叭/, 唢呐/, 曲儿/小/腔儿/大/"] +note = ["用喇叭唢呐比喻宦官,表面写乐器,实则讽刺宦官本事小却官腔十足"] +translation = "喇叭和唢呐,吹的曲子虽短,声音却很响亮" +keyword_note = {"喇叭" = "铜制管乐器,比喻宦官", "唢呐" = "管乐器,同'锁呐'", "曲儿小" = "曲子很短", "腔儿大" = "声音很响,暗指官腔十足"} + +["官船/来往/乱如麻/, 全仗/你/抬/声价/"] +note = ["揭露宦官倚仗皇帝权势作威作福的丑态"] +translation = "官船来往频繁乱如麻,全凭借你抬高名誉地位" +keyword_note = {"官船" = "官府衙门的船只", "乱如麻" = "形容来往频繁", "仗" = "倚仗,凭借", "声价" = "名誉地位,同'身价'"} + +["军/听了/军愁/, 民/听了/民怕/"] +note = ["表现宦官监军扰民,令军民都感到恐惧和忧愁"] +translation = "军队听了军队发愁,百姓听了百姓害怕" +keyword_note = {"军愁" = "军队因受宦官监军搅扰而发愁", "民怕" = "百姓害怕宦官的欺压"} + +["哪里/去辨/甚么/真共假/?/"] +note = ["讽刺世人无法分辨宦官传达的旨意真假,暗指宦官常常假传圣旨"] +translation = "哪里会去辨别什么真和假?" +keyword_note = {"辨" = "分辨、分别", "甚么" = "同'什么'", "真共假" = "真和假"} + +["眼见/的/吹翻了/这家/, 吹伤了/那家/, "] +note = ["具体描写宦官欺压百姓造成的严重后果"] +translation = "眼看着使有的人家倾家荡产,有的人家元气大伤" +keyword_note = {"吹翻了" = "使倾家荡产", "吹伤了" = "使元气大伤"} + +["只吹/的/水尽/鹅飞/罢/!/"] +note = ["用比喻手法表现宦官欺压导致民穷财尽、家破人亡的悲惨结局"] +translation = "直吹得江水枯竭鹅飞跑,家破人亡啊!" +keyword_note = {"水尽鹅飞" = "比喻民穷财尽,家破人亡", "罢" = "语气词,表示完结"} \ No newline at end of file diff --git a/nucleon/E-苏幕遮·燎沉香.toml b/nucleon/E-苏幕遮·燎沉香.toml new file mode 100644 index 0000000..d75dcb5 --- /dev/null +++ b/nucleon/E-苏幕遮·燎沉香.toml @@ -0,0 +1,47 @@ +# 散列表的键翻译 +["keydata"] +note = "笔记" +keyword_note = "关键词翻译" +translation = "语句翻译" + +# 测试项目元数据 +["testdata"] +# 记忆时显示的额外信息 +additional_inf = ["translation","keyword_note", "note"] +# 填空测试, content 指代键名 +fill_blank_test = {"from"=["content"], "hint"=["translation"]} + +["燎/沉香/, 消/溽暑/"] +note = ["描写夏日焚香消暑的雅致生活场景"] +translation = "焚烧沉香,来消除夏日潮湿的暑气" +keyword_note = {"燎" = "烧", "沉香" = "一种名贵香料,置水中则下沉", "溽暑" = "潮湿的暑气"} + +["鸟雀/呼晴/, 侵晓/窥檐/语/"] +note = ["通过鸟雀欢鸣表现雨后初晴的喜悦气氛"] +translation = "快天亮的时候,鸟雀都在屋檐下叫个不停,欢呼天已放晴" +keyword_note = {"呼晴" = "唤晴,鸟鸣可占晴雨", "侵晓" = "快天亮的时候", "窥檐语" = "在屋檐下窥视鸣叫"} + +["叶上/初阳/干/宿雨/, 水面/清圆/, 一一/风荷/举/"] +note = ["描绘晨光中荷叶挺立的生动画面,'举'字用得极妙"] +translation = "初出的阳光晒干了荷叶上昨夜的雨滴,水面上的荷叶清润圆正,迎着晨风,每一片都挺出水面" +keyword_note = {"初阳" = "初出的阳光", "宿雨" = "昨夜下的雨", "清圆" = "清润圆正", "风荷举" = "荷叶迎着晨风挺出水面"} + +["故乡/遥/, 何日/去/?/"] +note = ["由景生情,转入思乡之情的抒发"] +translation = "想到那遥远的故乡,什么时候才能回去啊?" +keyword_note = {"故乡遥" = "故乡遥远", "何日去" = "何时能够回去"} + +["家住/吴门/, 久作/长安/旅/"] +note = ["点明作者江南人的身份和长期客居京城的境遇"] +translation = "我家本在江南一带,却长久地客居汴京" +keyword_note = {"吴门" = "泛指江南一带,今江苏苏州", "长安" = "借指北宋都城汴京", "旅" = "客居"} + +["五月/渔郎/相忆/否/?/"] +note = ["用反问句式表达对故乡亲友的深切思念"] +translation = "又到五月,不知家乡的朋友是否也在思念我?" +keyword_note = {"渔郎" = "指故乡的钓鱼朋友", "相忆" = "相互思念"} + +["小楫/轻舟/, 梦入/芙蓉/浦/"] +note = ["以梦境作结,表现归乡不得只能在梦中重返故地的惆怅"] +translation = "在梦中,我划着一叶小舟,又闯入那西湖的荷花塘中" +keyword_note = {"小楫" = "短桨,指划船用具", "轻舟" = "轻快的小船", "芙蓉浦" = "有荷花的水边,指杭州西湖"} \ No newline at end of file diff --git a/nucleon/E-贺新郎·国脉微如缕.toml b/nucleon/E-贺新郎·国脉微如缕.toml new file mode 100644 index 0000000..95bba71 --- /dev/null +++ b/nucleon/E-贺新郎·国脉微如缕.toml @@ -0,0 +1,72 @@ +# 散列表的键翻译 +["keydata"] +note = "笔记" +keyword_note = "关键词翻译" +translation = "语句翻译" + +# 测试项目元数据 +["testdata"] +# 记忆时显示的额外信息 +additional_inf = ["translation","keyword_note", "note"] +# 填空测试, content 指代键名 +fill_blank_test = {"from"=["content"], "hint"=["translation"]} + +["国脉/微/如缕/"] +note = ["词人以'如缕'比喻国家命脉衰微脆弱,形势危急"] +translation = "国家的命脉已经衰微得像一根细丝" +keyword_note = {"国脉" = "国家的命脉", "微" = "衰微", "如缕" = "像丝线一样,形容脆弱"} + +["问/长缨/何时/入手/, 缚将/戎主/?/"] +note = ["表达作者渴望投身军旅、为国擒敌的迫切心情"] +translation = "试问,捆敌的长绳何时才能到我手中,将敌酋捆绑擒来?" +keyword_note = {"长缨" = "长带子,喻指擒敌的武器", "缚将" = "捆绑", "戎主" = "敌人的首领"} + +["未必/人间/无/好汉/, 谁与/宽些/尺度/?/"] +note = ["批判当时用人制度僵化,呼吁不拘一格降人才"] +translation = "人世间未必没有英雄好汉,只是谁能放宽用人的标准呢?" +keyword_note = {"好汉" = "英雄豪杰", "尺度" = "标准,这里指用人标准"} + +["试看取/当年/韩五/"] +note = ["韩世忠虽出身行伍却成为抗金名将,说明人才不一定需要名师传授"] +translation = "试看当年的韩世忠将军" +keyword_note = {"韩五" = "南宋抗金名将韩世忠,排行第五"} + +["岂有/谷城公/付授/, 也不干/曾遇/骊山母/"] +note = ["用典说明韩世忠的成功并非依靠神仙指点或名师传授"] +translation = "他既没有得到谷城公的传授,也不曾遇见骊山老母" +keyword_note = {"谷城公" = "即黄石公,传说曾向张良传授兵书", "骊山母" = "道教女仙,传说曾向李筌讲解《阴符》"} + +["谈笑起/, 两河路/"] +note = ["形容韩世忠指挥若定,在河北地区大败金兵"] +translation = "却在谈笑间指挥大军,收复河北失地" +keyword_note = {"两河路" = "指宋代河北东路和河北西路,即今河北、山西、河南部分地区"} + +["少时/棋柝/曾/联句/"] +note = ["回忆作者年轻时在军中的生活经历"] +translation = "年轻时曾在军营中一边下棋一边联句作诗" +keyword_note = {"棋柝" = "下棋和打更", "联句" = "多人合作写诗,每人一句或几句"} + +["叹/而今/登楼/揽镜/, 事机/频误/"] +note = ["抒发作者年老力衰、壮志未酬的感慨"] +translation = "可叹如今登楼远望、揽镜自照,已力不从心,多次错过了报国机会" +keyword_note = {"登楼揽镜" = "上楼照镜,慨叹功业未建人已衰老", "事机" = "机会,指从军报国的机会"} + +["闻说/北风/吹面/急/, 边上/冲梯/屡舞/"] +note = ["描绘边境危急,蒙古军攻势凶猛"] +translation = "听说北风凛冽(暗示蒙古军南侵),边境上敌军攻城的冲车云梯不断飞舞" +keyword_note = {"北风" = "暗指北来的蒙古兵", "冲梯" = "冲车和云梯,古代攻城器具"} + +["君/莫道/投鞭/虚语/"] +note = ["警告不要轻视敌军实力,用苻坚投鞭断流的典故"] +translation = "你不要认为'投鞭断流'只是空话(喻敌军强大)" +keyword_note = {"投鞭" = "前秦苻坚曾说投鞭长江可断流,形容兵多将广"} + +["自古/一贤/能/制难/, 有/金汤/便可/无/张许/?/"] +note = ["反问强调贤才比坚固城池更重要"] +translation = "自古以来,一位贤才就能解除危难,难道有了坚固城池就可以没有张巡、许远这样的良将吗?" +keyword_note = {"制难" = "解除危难", "金汤" = "金城汤池,比喻坚固的防御工事", "张许" = "张巡和许远,唐代安史之乱中死守睢阳的名将"} + +["快/投笔/, 莫/题柱/"] +note = ["呼吁文人弃文从武,为国效力"] +translation = "赶快像班超那样投笔从戎,不要像司马相如那样只追求功名利禄" +keyword_note = {"投笔" = "投笔从戎,用汉代班超典故", "题柱" = "用司马相如题桥柱追求功名的典故"} \ No newline at end of file diff --git a/nucleon/E-青玉案·元夕.toml b/nucleon/E-青玉案·元夕.toml new file mode 100644 index 0000000..e3b5a3a --- /dev/null +++ b/nucleon/E-青玉案·元夕.toml @@ -0,0 +1,42 @@ +# 散列表的键翻译 +["keydata"] +note = "笔记" +keyword_note = "关键词翻译" +translation = "语句翻译" + +# 测试项目元数据 +["testdata"] +# 记忆时显示的额外信息 +additional_inf = ["translation","keyword_note", "note"] +# 填空测试, content 指代键名 +fill_blank_test = {"from"=["content"], "hint"=["translation"]} + +["东风/夜放/花千树/, 更/吹落/、/星/如雨/"] +note = ["描写元宵夜灯火辉煌的景象,用夸张手法表现花灯之多如千树花开"] +translation = "东风吹开了元宵夜的火树银花,花灯灿烂,就像千树花开" +keyword_note = {"花千树" = "花灯之多如千树开花", "星如雨" = "焰火纷纷,乱落如雨"} + +["宝马/雕车/香/满路/"] +note = ["描绘元宵节繁华街道上豪华马车往来不绝的盛况"] +translation = "豪华的马车在飘香的街道行过" +keyword_note = {"宝马雕车" = "豪华的马车", "香满路" = "香气弥漫整条街道"} + +["凤箫/声动/, 玉壶/光转/, 一夜/鱼龙/舞/"] +note = ["描写元宵夜音乐悠扬、月光流转、灯舞不停的欢乐场景"] +translation = "悠扬的凤箫声四处回荡,玉壶般的明月渐渐转向西边,一夜舞动鱼灯、龙灯不停歇" +keyword_note = {"凤箫" = "箫的美称", "玉壶" = "比喻明月,亦可指灯", "鱼龙舞" = "舞动鱼形、龙形的彩灯"} + +["蛾儿/雪柳/黄金缕/, 笑语/盈盈/暗香/去/"] +note = ["描写元宵节妇女们盛装出游、笑语盈盈的热闹场面"] +translation = "美人头上都戴着华丽的饰物,笑语盈盈地随人群走过,只有衣香犹在暗中飘散" +keyword_note = {"蛾儿" = "古代妇女元宵节的头饰", "雪柳" = "古代妇女元宵节的饰物", "黄金缕" = "头饰上的金丝绦", "盈盈" = "仪态娇美的样子", "暗香" = "女性身上散发出来的香气"} + +["众里/寻他/千百度/"] +note = ["表达在人群中反复寻找意中人的执着心情"] +translation = "我在人群中寻找她千百回" +keyword_note = {"千百度" = "千百遍,形容次数极多"} + +["蓦然/回首/, 那人/却在/, 灯火/阑珊/处/"] +note = ["最后发现意中人却在冷清之处,意境深远,成为千古名句"] +translation = "猛然回头,不经意间却在灯火将尽未尽之处发现了她" +keyword_note = {"蓦然" = "突然,猛然", "阑珊" = "暗淡、零落,指灯火稀疏的地方"} \ No newline at end of file diff --git a/nucleon/劝学.toml b/nucleon_hide/劝学.toml similarity index 100% rename from nucleon/劝学.toml rename to nucleon_hide/劝学.toml diff --git a/nucleon/师说.toml b/nucleon_hide/师说.toml similarity index 100% rename from nucleon/师说.toml rename to nucleon_hide/师说.toml diff --git a/nucleon/归去来兮辞.toml b/nucleon_hide/归去来兮辞.toml similarity index 100% rename from nucleon/归去来兮辞.toml rename to nucleon_hide/归去来兮辞.toml diff --git a/nucleon/梦游天姥吟留别.toml b/nucleon_hide/梦游天姥吟留别.toml similarity index 100% rename from nucleon/梦游天姥吟留别.toml rename to nucleon_hide/梦游天姥吟留别.toml diff --git a/nucleon/赤壁赋.toml b/nucleon_hide/赤壁赋.toml similarity index 100% rename from nucleon/赤壁赋.toml rename to nucleon_hide/赤壁赋.toml diff --git a/nucleon/陈情表.toml b/nucleon_hide/陈情表.toml similarity index 100% rename from nucleon/陈情表.toml rename to nucleon_hide/陈情表.toml diff --git a/nucleon/谏太宗十思疏.toml b/nucleon_todo/谏太宗十思疏.toml similarity index 100% rename from nucleon/谏太宗十思疏.toml rename to nucleon_todo/谏太宗十思疏.toml diff --git a/nucleon/过秦论.toml b/nucleon_todo/过秦论.toml similarity index 100% rename from nucleon/过秦论.toml rename to nucleon_todo/过秦论.toml diff --git a/particles.py b/particles.py index b22cdd7..7afc84c 100644 --- a/particles.py +++ b/particles.py @@ -205,7 +205,9 @@ class ElectronUnion: all = toml.load(f) lst = list() for i in all.keys(): - lst.append(Electron(i, all[i])) + if i != "total": + lst.append(Electron(i, all[i])) + self.total = all.get("total", {"last_date": 0}) self.electrons = lst self.electrons_dict = {i.content: i for i in lst} @@ -215,8 +217,10 @@ class ElectronUnion: def save(self): # print(1) + self.total["last_date"] = aux.get_daystamp() with open(self.path, 'w') as f: tmp = {i.content: i.metadata for i in self.electrons} + tmp["total"] = self.total # print(tmp) toml.dump(tmp, f) diff --git a/reactor.py b/reactor.py index 4e6daba..3d59ce6 100644 --- a/reactor.py +++ b/reactor.py @@ -129,7 +129,8 @@ class Reactor(): self._deploy_report() print("Progress saved") # self.nucleon_file.save() - self.electron_file.save() + if self.electron_file.total["last_date"] < aux.get_daystamp(): + self.electron_file.save() def _deploy_report(self): "部署所有 _report"