mower-ng/extract_scene.py
zhbaor 2aa76570f7
All checks were successful
ci/woodpecker/push/check_format Pipeline was successful
继续补充部分版权声明
2025-01-05 22:24:04 +08:00

36 lines
1.2 KiB
Python

"""
Copyright (c) 2024 zhbaor <zhbaor@zhaozuohong.vip>
This file is part of mower-ng (https://git.zhaozuohong.vip/mower-ng/mower-ng).
Mower-ng is free software: you may copy, redistribute and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation, version 3 or later.
This file is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from mower.data import scene_list
scene_class = "class Scene:"
scene_comment = "SceneComment = {"
for scene, data in scene_list.items():
id = int(scene)
label = data["label"]
comment = data["comment"]
scene_class += f'\n {label} = {id}\n "{comment}"'
scene_comment += f'\n {id}: "{comment}",'
scene_comment += "\n}"
code = scene_class + "\n\n\n" + scene_comment + "\n"
with open("./mower/utils/scene.py", "w", encoding="utf-8") as f:
f.write(code)