feat: 用户界面实现算法共存与切换
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
_services_desc = '服务模块(services)设置'
|
_services_desc = '服务模块设置'
|
||||||
_providers_desc = '驱动模块(providers)设置'
|
_providers_desc = '驱动模块设置'
|
||||||
_repo_desc = '单元集独立设置'
|
_repo_desc = '单元集独立设置'
|
||||||
_interface_desc = '基本用户界面设置'
|
_interface_desc = '基本用户界面设置'
|
||||||
_default_desc = '默认设置'
|
|
||||||
_global_desc = '底层设置'
|
_global_desc = '底层设置'
|
||||||
|
|||||||
@@ -11,7 +11,8 @@ print(repo.ident_index)
|
|||||||
for i in repo.ident_index:
|
for i in repo.ident_index:
|
||||||
n = pt.Nucleon.from_data(nucleonic_data=repo.nucleonic_data_lict.get_itemic_unit(i))
|
n = pt.Nucleon.from_data(nucleonic_data=repo.nucleonic_data_lict.get_itemic_unit(i))
|
||||||
e = pt.Electron.from_data(
|
e = pt.Electron.from_data(
|
||||||
electronic_data=repo.electronic_data_lict.get_itemic_unit(i)
|
electronic_data=repo.electronic_data_lict.get_itemic_unit(i),
|
||||||
|
algo_name=repo.config['algorithm']
|
||||||
)
|
)
|
||||||
print(n)
|
print(n)
|
||||||
input()
|
input()
|
||||||
|
|||||||
@@ -70,6 +70,7 @@ API 版本代号: `{version.codename.capitalize()}`
|
|||||||
# 运行环境信息
|
# 运行环境信息
|
||||||
|
|
||||||
Python 解释器版本: {python_version}
|
Python 解释器版本: {python_version}
|
||||||
|
Python 解释器路径: {sys.executable}
|
||||||
Textual 框架版本: {textual_version}
|
Textual 框架版本: {textual_version}
|
||||||
终端模拟器: {terminal_info}
|
终端模拟器: {terminal_info}
|
||||||
操作系统版本: {os_version}
|
操作系统版本: {os_version}
|
||||||
|
|||||||
@@ -108,15 +108,14 @@ class DashboardScreen(Screen):
|
|||||||
}
|
}
|
||||||
initial_time = float("inf")
|
initial_time = float("inf")
|
||||||
for i in range(repo.data_length):
|
for i in range(repo.data_length):
|
||||||
e = pt.Electron.from_data(repo.electronic_data_lict[i])
|
e = pt.Electron.from_data(electronic_data=repo.electronic_data_lict[i], algo_name=repo.config['algorithm'])
|
||||||
n = pt.Nucleon.from_data(repo.nucleonic_data_lict[i])
|
n = pt.Nucleon.from_data(repo.nucleonic_data_lict[i])
|
||||||
if e.is_activated():
|
if e.is_activated():
|
||||||
repo.algotype = e.algoname
|
|
||||||
repo.progress["touched"] += 1
|
repo.progress["touched"] += 1
|
||||||
repo.nearest_review_time = min(repo.nearest_review_time, e.nextdate())
|
repo.nearest_review_time = min(repo.nearest_review_time, e.nextdate())
|
||||||
# initial_time = min(initial_time, e.)
|
# initial_time = min(initial_time, e.)
|
||||||
repo.need_review = timer.get_daystamp() >= repo.nearest_review_time
|
repo.need_review = timer.get_daystamp() >= repo.nearest_review_time
|
||||||
repo.prompt = f"""{repo.manifest['title']} ({repo.algotype})
|
repo.prompt = f"""{repo.manifest['title']} ({repo.config['algorithm']})
|
||||||
进度: {repo.progress['touched']}/{repo.progress['total']} ({round(repo.progress['touched']/repo.progress['total']*100, 1)}%)
|
进度: {repo.progress['touched']}/{repo.progress['total']} ({round(repo.progress['touched']/repo.progress['total']*100, 1)}%)
|
||||||
{'需要学习' if repo.need_review else "无需操作"}
|
{'需要学习' if repo.need_review else "无需操作"}
|
||||||
"""
|
"""
|
||||||
|
|||||||
@@ -92,7 +92,8 @@ class PreparationScreen(Screen):
|
|||||||
nucleonic_data=self.repo.nucleonic_data_lict.get_itemic_unit(i)
|
nucleonic_data=self.repo.nucleonic_data_lict.get_itemic_unit(i)
|
||||||
)
|
)
|
||||||
e = pt.Electron.from_data(
|
e = pt.Electron.from_data(
|
||||||
electronic_data=self.repo.electronic_data_lict.get_itemic_unit(i)
|
electronic_data=self.repo.electronic_data_lict.get_itemic_unit(i),
|
||||||
|
algo_name=self.repo.config['algorithm']
|
||||||
)
|
)
|
||||||
statstr = ""
|
statstr = ""
|
||||||
|
|
||||||
@@ -146,7 +147,8 @@ def launch(repo, app, scheduled_num):
|
|||||||
nucleonic_data=repo.nucleonic_data_lict.get_itemic_unit(i)
|
nucleonic_data=repo.nucleonic_data_lict.get_itemic_unit(i)
|
||||||
)
|
)
|
||||||
e = pt.Electron.from_data(
|
e = pt.Electron.from_data(
|
||||||
electronic_data=repo.electronic_data_lict.get_itemic_unit(i)
|
electronic_data=repo.electronic_data_lict.get_itemic_unit(i),
|
||||||
|
algo_name=repo.config['algorithm']
|
||||||
)
|
)
|
||||||
a = pt.Atom(n, e, repo.orbitic_data)
|
a = pt.Atom(n, e, repo.orbitic_data)
|
||||||
atoms.append(a)
|
atoms.append(a)
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import toml
|
|||||||
|
|
||||||
import heurams.kernel.particles as pt
|
import heurams.kernel.particles as pt
|
||||||
|
|
||||||
|
from heurams.context import config_var
|
||||||
from heurams.kernel.auxiliary.lict import Lict
|
from heurams.kernel.auxiliary.lict import Lict
|
||||||
|
|
||||||
|
|
||||||
@@ -62,6 +63,14 @@ class Repo:
|
|||||||
"algodata": self.algodata,
|
"algodata": self.algodata,
|
||||||
"source": self.source,
|
"source": self.source,
|
||||||
}
|
}
|
||||||
|
self.config = {
|
||||||
|
"algorithm": config_var.get()['interface']['global']['algorithm'],
|
||||||
|
"scheduled_num": config_var.get()['interface']['global']['scheduled_num'],
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
self.config.update(dict(config_var.get()['repo'][self.manifest['package']]))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
self._generate_particles_data()
|
self._generate_particles_data()
|
||||||
|
|
||||||
def _generate_particles_data(self):
|
def _generate_particles_data(self):
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class DebugClient:
|
|||||||
self.socket.connect(f"tcp://localhost:{port}")
|
self.socket.connect(f"tcp://localhost:{port}")
|
||||||
print(f"已连接到调试服务器 (端口 {port})")
|
print(f"已连接到调试服务器 (端口 {port})")
|
||||||
print("输入Python代码并按回车执行, 输入 'exit' 退出")
|
print("输入Python代码并按回车执行, 输入 'exit' 退出")
|
||||||
print("可用变量: app, logger")
|
print("可用变量: app, logger, config_var")
|
||||||
print("-" * 50)
|
print("-" * 50)
|
||||||
|
|
||||||
def execute(self, code):
|
def execute(self, code):
|
||||||
|
|||||||
Reference in New Issue
Block a user