Archived
0
0
This commit is contained in:
2025-12-17 20:47:29 +08:00
parent 321f287263
commit 8da8354609
13 changed files with 47 additions and 30 deletions

View File

@@ -82,5 +82,6 @@ app = HeurAMSApp()
if __name__ == "__main__":
app.run()
def main():
app.run()

View File

@@ -113,7 +113,7 @@ class DashboardScreen(Screen):
return
selected_label = event.item.query_one(Label)
if "未找到任何 .toml 文件" in str(selected_label.renderable): # type: ignore
if "未找到任何 .toml 文件" in str(selected_label.renderable): # type: ignore
return
selected_filename = pathlib.Path(

View File

@@ -25,7 +25,7 @@ logger = get_logger(__name__)
class MemScreen(Screen):
BINDINGS = [
("q", "pop_screen", "返回"),
# ("p", "prev", "复习上一个"),
# ("p", "prev", "复习上一个"),
("d", "toggle_dark", ""),
("v", "play_voice", "朗读"),
("0,1,2,3", "app.push_screen('about')", ""),

View File

@@ -21,6 +21,7 @@ from heurams.context import config_var
class NucleonCreatorScreen(Screen):
BINDINGS = [("q", "go_back", "返回")]
SUB_TITLE = "单元集创建向导"
def __init__(self) -> None:
super().__init__(name=None, id=None, classes=None)

View File

@@ -28,6 +28,7 @@ class PrecachingScreen(Screen):
nucleons (list): 可选列表, 仅包含 Nucleon 对象
desc (list): 可选字符串, 包含对此次调用的文字描述
"""
SUB_TITLE = "缓存管理器"
BINDINGS = [("q", "go_back", "返回")]

View File

@@ -32,7 +32,7 @@ class PreparationScreen(Screen):
("0,1,2,3", "app.push_screen('about')", ""),
]
scheduled_num = reactive(config_var.get()['scheduled_num'])
scheduled_num = reactive(config_var.get()["scheduled_num"])
def __init__(self, nucleon_file: pathlib.Path, electron_file: pathlib.Path) -> None:
super().__init__(name=None, id=None, classes=None)
@@ -45,8 +45,12 @@ class PreparationScreen(Screen):
yield Header(show_clock=True)
with ScrollableContainer(id="vice_container"):
yield Label(f"准备就绪: [b]{self.nucleon_file.stem}[/b]\n")
yield Label(f"内容源文件: {config_var.get()['paths']['nucleon_dir']}/[b]{self.nucleon_file.name}[/b]")
yield Label(f"元数据文件: {config_var.get()['paths']['electron_dir']}/[b]{self.electron_file.name}[/b]")
yield Label(
f"内容源文件: {config_var.get()['paths']['nucleon_dir']}/[b]{self.nucleon_file.name}[/b]"
)
yield Label(
f"元数据文件: {config_var.get()['paths']['electron_dir']}/[b]{self.electron_file.name}[/b]"
)
yield Label(f"\n单元数量: {len(self.nucleons_with_orbital)}\n")
yield Label(f"单次记忆数量: {self.scheduled_num}", id="schnum_label")
@@ -67,7 +71,7 @@ class PreparationScreen(Screen):
yield Markdown(self._get_full_content().replace("/", ""), classes="full")
yield Footer()
#def watch_scheduled_num(self, old_scheduled_num, new_scheduled_num):
# def watch_scheduled_num(self, old_scheduled_num, new_scheduled_num):
# logger.debug("响应", old_scheduled_num, "->", new_scheduled_num)
# try:
# one = self.query_one("#schnum_label")
@@ -133,6 +137,7 @@ class PreparationScreen(Screen):
atoms_to_provide.append(i)
logger.debug(f"ATP: {atoms_to_provide}")
from .memorizor import MemScreen
memscreen = MemScreen(atoms_to_provide)
self.app.push_screen(memscreen)
elif event.button.id == "precache_button":

View File

@@ -29,4 +29,4 @@ class BasePuzzleWidget(Widget):
return super().compose()
def handler(self, rating) -> None:
pass
pass

View File

@@ -101,9 +101,9 @@ class ClozePuzzle(BasePuzzleWidget):
if not is_correct:
self.inputlist = []
self.update_display()
def handler(self, rating):
if self.atom.lock():
pass
else:
self.atom.minimize(rating)
self.atom.minimize(rating)

View File

@@ -152,10 +152,9 @@ class MCQPuzzle(BasePuzzleWidget):
self.hashmap[button_id] = option
new_button = Button(option, id=button_id)
container.mount(new_button)
def handler(self, rating):
if self.atom.lock():
pass
else:
self.atom.minimize(rating)

View File

@@ -17,6 +17,7 @@ from heurams.services.logger import get_logger
logger = get_logger(__name__)
class RecognitionConfig(TypedDict):
__origin__: str
__hint__: str
@@ -112,4 +113,4 @@ class Recognition(BasePuzzleWidget):
self.atom.lock(1)
self.atom.minimize(5)
else:
pass
pass