feat: update robot setup to use ruamel.yaml for preserving YAML comments and formatting
feat: enhance run command with Docker volume for Webots asset caching and GPU detection feat: improve setup command to sequentially run sub-commands for documentation, environment, and robot parameters fix: update update command to provide clearer logging during git operations and installation refactor: enhance TUI components with better threading and logging for long-running tasks chore: improve install script with better error handling, logging, and interactive setup wizard
This commit is contained in:
+14
-4
@@ -3,6 +3,8 @@ from typing import List, Optional
|
||||
|
||||
from textual.app import App
|
||||
|
||||
# Import each sub-command's run() so we can call them in sequence.
|
||||
# Импортируем run() каждой подкоманды, чтобы вызывать их по порядку.
|
||||
from cobot.commands.doc_setup import run as _doc_setup
|
||||
from cobot.commands.docker_setup import run as _docker_setup
|
||||
from cobot.commands.local_setup import run as _local_setup
|
||||
@@ -10,8 +12,11 @@ from cobot.commands.robot_setup import run as _robot_setup
|
||||
from cobot.tui import SCREEN_CSS, PickScreen
|
||||
|
||||
|
||||
# A minimal Textual app that asks a single question and exits with the chosen value.
|
||||
# We need this because Textual screens cannot run outside of an App context.
|
||||
# Минимальное Textual-приложение, которое задаёт один вопрос и выходит с выбранным значением.
|
||||
# Нам это нужно, потому что экраны Textual не могут работать вне контекста приложения.
|
||||
class _Ask(App[Optional[str]]):
|
||||
"""Single-question picker that exits immediately with the chosen value."""
|
||||
CSS = SCREEN_CSS
|
||||
|
||||
def __init__(self, step: str, question: str, options: List[str], default: str):
|
||||
@@ -29,6 +34,8 @@ class _Ask(App[Optional[str]]):
|
||||
|
||||
|
||||
def _ask(step: str, question: str, options: List[str], default: str) -> Optional[str]:
|
||||
# Returns None if the user pressed Escape to cancel the whole wizard.
|
||||
# Возвращает None если пользователь нажал Escape для отмены всего мастера.
|
||||
return _Ask(step, question, options, default).run()
|
||||
|
||||
|
||||
@@ -38,14 +45,16 @@ def register(subparsers):
|
||||
|
||||
|
||||
def run(args: argparse.Namespace) -> None:
|
||||
# Step 1 — documentation
|
||||
# Step 1 - documentation server.
|
||||
# Шаг 1 - сервер документации.
|
||||
v = _ask("Step 1 of 3", "Set up the documentation server?", ["Yes", "No"], "Yes")
|
||||
if v is None:
|
||||
return
|
||||
if v == "Yes":
|
||||
_doc_setup(args)
|
||||
|
||||
# Step 2 — build environment
|
||||
# Step 2 - build environment: local ROS2 or Docker.
|
||||
# Шаг 2 - среда сборки: локальный ROS2 или Docker.
|
||||
v = _ask(
|
||||
"Step 2 of 3",
|
||||
"How do you want to set up the build environment?",
|
||||
@@ -62,7 +71,8 @@ def run(args: argparse.Namespace) -> None:
|
||||
else:
|
||||
_docker_setup(args)
|
||||
|
||||
# Step 3 — robot parameters
|
||||
# Step 3 - robot parameters in cobot-setting.yaml.
|
||||
# Шаг 3 - параметры робота в cobot-setting.yaml.
|
||||
v = _ask(
|
||||
"Step 3 of 3",
|
||||
"Configure robot parameters (cobot-setting.yaml)?",
|
||||
|
||||
Reference in New Issue
Block a user