style: 代码格式化
This commit is contained in:
@@ -14,6 +14,7 @@ from textual.screen import Screen
|
||||
|
||||
from heurams.services.version import ver
|
||||
|
||||
|
||||
class NucleonCreatorScreen(Screen):
|
||||
BINDINGS = [("q", "go_back", "返回")]
|
||||
|
||||
@@ -23,18 +24,20 @@ class NucleonCreatorScreen(Screen):
|
||||
def search_templates(self):
|
||||
from pathlib import Path
|
||||
from heurams.context import config_var
|
||||
template_dir = Path(config_var.get()['paths']['template_dir'])
|
||||
|
||||
template_dir = Path(config_var.get()["paths"]["template_dir"])
|
||||
templates = list()
|
||||
for i in template_dir.iterdir():
|
||||
if i.name.endswith('.toml'):
|
||||
if i.name.endswith(".toml"):
|
||||
try:
|
||||
import toml
|
||||
with open(i, 'r') as f:
|
||||
|
||||
with open(i, "r") as f:
|
||||
dic = toml.load(f)
|
||||
desc = dic['__metadata__.attribution']['desc']
|
||||
templates.append(desc + ' (' + i.name + ')')
|
||||
desc = dic["__metadata__.attribution"]["desc"]
|
||||
templates.append(desc + " (" + i.name + ")")
|
||||
except Exception as e:
|
||||
templates.append(f'无描述模板 ({i.name})')
|
||||
templates.append(f"无描述模板 ({i.name})")
|
||||
print(e)
|
||||
print(templates)
|
||||
return templates
|
||||
@@ -43,10 +46,14 @@ class NucleonCreatorScreen(Screen):
|
||||
yield Header(show_clock=True)
|
||||
with Container(id="vice_container"):
|
||||
yield Label(f"[b]空白单元集创建向导\n")
|
||||
yield Markdown("> 提示: 你可能注意到当选中文本框时底栏和操作按键绑定将被覆盖 \n只需选中(使用鼠标或 Tab)选择框即可恢复底栏功能")
|
||||
yield Markdown(
|
||||
"> 提示: 你可能注意到当选中文本框时底栏和操作按键绑定将被覆盖 \n只需选中(使用鼠标或 Tab)选择框即可恢复底栏功能"
|
||||
)
|
||||
yield Markdown("1. 键入单元集名称")
|
||||
yield Input(placeholder="单元集名称")
|
||||
yield Markdown("> 单元集名称不应与现有单元集重复. \n> 新的单元集文件将创建在 ./nucleon/你输入的名称.toml")
|
||||
yield Markdown(
|
||||
"> 单元集名称不应与现有单元集重复. \n> 新的单元集文件将创建在 ./nucleon/你输入的名称.toml"
|
||||
)
|
||||
yield Label(f"\n")
|
||||
yield Markdown("2. 选择单元集模板")
|
||||
LINES = self.search_templates()
|
||||
@@ -79,5 +86,5 @@ class NucleonCreatorScreen(Screen):
|
||||
|
||||
def on_button_pressed(self, event) -> None:
|
||||
event.stop()
|
||||
if event.button.id == 'submit_button':
|
||||
if event.button.id == "submit_button":
|
||||
pass
|
||||
|
||||
Reference in New Issue
Block a user