fix: 若干改进

This commit is contained in:
2025-12-11 17:42:08 +08:00
parent ca190721ff
commit 5c7b74a0d6
4 changed files with 20 additions and 9 deletions

View File

@@ -20,12 +20,23 @@ class NucleonCreatorScreen(Screen):
def __init__(self) -> None:
super().__init__(name=None, id=None, classes=None)
def search_templates():
from heurams.context import
def search_templates(self):
with open('r','/template/t.timl'):
pass
from pathlib import Path
from heurams.context import config_var
template_dir = Path(config_var.get()['paths']['template_dir'])
templates = list()
for i in template_dir.iterdir():
if i.name.endswith('.toml'):
try:
import toml
with open('r', i) as f:
dic = toml.load(f)
desc = dic['__metadata__']['attribution']['desc']
templates.append(desc + ' (' + i.name + ')')
except:
templates.append(f'无描述模板 ({i.name})')
print(templates)
return templates
def compose(self) -> ComposeResult:
yield Header(show_clock=True)