You've already forked HeurAMS-legacy
style: 代码格式化
This commit is contained in:
@@ -12,10 +12,12 @@ import heurams.kernel.particles as pt
|
||||
import heurams.kernel.puzzles as pz
|
||||
from .. import shim
|
||||
|
||||
|
||||
class AtomState(Enum):
|
||||
FAILED = auto()
|
||||
NORMAL = auto()
|
||||
|
||||
|
||||
class MemScreen(Screen):
|
||||
BINDINGS = [
|
||||
("q", "pop_screen", "返回"),
|
||||
@@ -27,15 +29,21 @@ class MemScreen(Screen):
|
||||
if config_var.get()["quick_pass"]:
|
||||
BINDINGS.append(("k", "quick_pass", "跳过"))
|
||||
rating = reactive(-1)
|
||||
def __init__(self, atoms: list, name: str | None = None, id: str | None = None, classes: str | None = None) -> None:
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
atoms: list,
|
||||
name: str | None = None,
|
||||
id: str | None = None,
|
||||
classes: str | None = None,
|
||||
) -> None:
|
||||
super().__init__(name, id, classes)
|
||||
self.atoms = atoms
|
||||
self.phaser = Phaser(atoms)
|
||||
#print(self.phaser.state)
|
||||
self.procession: Procession = self.phaser.current_procession() # type: ignore
|
||||
#print(self.phaser.state)
|
||||
#self.procession.forward(1)
|
||||
|
||||
# print(self.phaser.state)
|
||||
self.procession: Procession = self.phaser.current_procession() # type: ignore
|
||||
# print(self.phaser.state)
|
||||
# self.procession.forward(1)
|
||||
|
||||
def on_mount(self):
|
||||
self.load_puzzle()
|
||||
@@ -45,22 +53,26 @@ class MemScreen(Screen):
|
||||
try:
|
||||
print(self.phaser.state)
|
||||
self.fission = Fission(self.procession.current_atom, self.phaser.state)
|
||||
#print(1)
|
||||
# print(1)
|
||||
puzzle_info = next(self.fission.generate())
|
||||
print(puzzle_info)
|
||||
return shim.puzzle2widget[puzzle_info["puzzle"]](atom = self.procession.current_atom, alia = puzzle_info["alia"])
|
||||
return shim.puzzle2widget[puzzle_info["puzzle"]](
|
||||
atom=self.procession.current_atom, alia=puzzle_info["alia"]
|
||||
)
|
||||
except (KeyError, StopIteration, AttributeError) as e:
|
||||
print(f"调度展开出错: {e}")
|
||||
return Static("无法生成谜题")
|
||||
#print(shim.puzzle2widget[puzzle_info["puzzle"]])
|
||||
# print(shim.puzzle2widget[puzzle_info["puzzle"]])
|
||||
|
||||
def compose(self) -> ComposeResult:
|
||||
yield Header(show_clock=True)
|
||||
with Center():
|
||||
yield Static(f"当前进度: {self.procession.process()}/{self.procession.total_length()}")
|
||||
#self.mount(self.current_widget()) # type: ignore
|
||||
yield Static(
|
||||
f"当前进度: {self.procession.process()}/{self.procession.total_length()}"
|
||||
)
|
||||
# self.mount(self.current_widget()) # type: ignore
|
||||
yield Container(id="puzzle-container")
|
||||
#yield Button("重新学习此单元", id="re-recognize", variant="warning")
|
||||
# yield Button("重新学习此单元", id="re-recognize", variant="warning")
|
||||
yield Footer()
|
||||
|
||||
def load_puzzle(self):
|
||||
|
||||
Reference in New Issue
Block a user