fix: 若干改进
This commit is contained in:
@@ -5,7 +5,7 @@ from textual.widgets import Button
|
||||
from .screens.dashboard import DashboardScreen
|
||||
from .screens.nucreator import NucleonCreatorScreen
|
||||
from .screens.precache import PrecachingScreen
|
||||
|
||||
from .screens.about import AboutScreen
|
||||
class HeurAMSApp(App):
|
||||
TITLE = "潜进"
|
||||
#CSS_PATH = str(cxt.rootdir / "interface" / "css" / "main.css")
|
||||
@@ -15,11 +15,13 @@ class HeurAMSApp(App):
|
||||
("1", "app.push_screen('dashboard')", "仪表盘"),
|
||||
("2", "app.push_screen('precache_all')", "缓存管理器"),
|
||||
("3", "app.push_screen('nucleon_creator')", "创建新单元"),
|
||||
("0", "app.push_screen('about')", "版本信息"),
|
||||
]
|
||||
SCREENS = {
|
||||
"dashboard": DashboardScreen,
|
||||
"nucleon_creator": NucleonCreatorScreen,
|
||||
"precache_all": PrecachingScreen,
|
||||
"about": AboutScreen,
|
||||
}
|
||||
|
||||
def on_mount(self) -> None:
|
||||
@@ -38,6 +40,22 @@ def environment_check():
|
||||
else:
|
||||
print(f"找到 {i}")
|
||||
|
||||
def is_subdir(parent, child):
|
||||
try:
|
||||
child.relative_to(parent)
|
||||
return 1
|
||||
except:
|
||||
return 0
|
||||
|
||||
# 开发模式
|
||||
from pathlib import Path
|
||||
from heurams.context import rootdir
|
||||
import os
|
||||
if is_subdir(Path(rootdir),Path(os.getcwd())):
|
||||
os.chdir(Path(rootdir) / ".." / "..")
|
||||
print(f'转入开发数据目录: {Path(rootdir)/".."/".."}')
|
||||
|
||||
environment_check()
|
||||
|
||||
app = HeurAMSApp()
|
||||
app.run()
|
||||
|
||||
Reference in New Issue
Block a user