diff --git a/README.md b/README.md index 710bc03..7f86e65 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,7 @@ shown in the image above of this README). To open the graphical editor, run: ```bash -pysimblocks examples/quick_start/gui +pysimblocks gui examples/quick_start/gui ``` The quick-start GUI project is stored in a single @@ -129,7 +129,7 @@ A collection of basic and advanced examples is available in the [examples](./examples) directory, including: - Control system demonstrations -- SOFA-based simulations +- SOFA-based simulations (tested with SOFA v24.06 and later.) - Hardware and real-time use cases - Comparisons with external tools diff --git a/docs/User_Guide/tutorial_2_gui.md b/docs/User_Guide/tutorial_2_gui.md index de229e1..13d0dcd 100644 --- a/docs/User_Guide/tutorial_2_gui.md +++ b/docs/User_Guide/tutorial_2_gui.md @@ -32,7 +32,7 @@ Create a new project folder and start the GUI: ```bash $ mkdir tutorial-gui $ cd tutorial-gui -$ pysimblocks +$ pysimblocks gui ``` The main window opens, with the `Toolbar` at the top, the `Blocks List` on the left, and the `Diagram View` on the right. ![Gui](./images/tutorial_2-gui_main.png) diff --git a/docs/User_Guide/tutorial_3_sofa.md b/docs/User_Guide/tutorial_3_sofa.md index a25bc86..27bc4fc 100644 --- a/docs/User_Guide/tutorial_3_sofa.md +++ b/docs/User_Guide/tutorial_3_sofa.md @@ -2,8 +2,9 @@ ## 1. Overview -This tutorial builds on the closed-loop system introduced in [Tutorial 1](./tutorial_1_python.md) and [Tutorial 2](./tutorial_2_gui.md). We demonstrate how **pySimBlocks can be coupled with SOFA** -to control and interact with a physics-based simulation. +This tutorial builds on the closed-loop system introduced in [Tutorial 1](./tutorial_1_python.md) +and [Tutorial 2](./tutorial_2_gui.md). We demonstrate how **pySimBlocks can be +coupled with SOFA** to control and interact with a physics-based simulation. ### 1.1 Goals @@ -40,6 +41,7 @@ your environment so that: ### 2.1 Install SOFA +> **Compatibility:** pySimBlocks has been tested with SOFA v24.06 and later. Install SOFA from the [website](https://www.sofa-framework.org/download/) either using the precompiled binaries (recommended) or building from source (advanced diff --git a/pySimBlocks/cli.py b/pySimBlocks/cli.py index 9de687a..db53844 100644 --- a/pySimBlocks/cli.py +++ b/pySimBlocks/cli.py @@ -24,7 +24,12 @@ def _run_gui(project_dir: str | None) -> None: - from pySimBlocks.gui.editor import run_app + try: + from pySimBlocks.gui.editor import run_app + except ImportError as e: + print(f"Error importing GUI modules: {e}") + print("Make sure PySide6 is installed to use the GUI editor.") + sys.exit(1) path = Path(project_dir).resolve() if project_dir else Path.cwd().resolve() run_app(path) @@ -36,9 +41,13 @@ def _run_export(args: argparse.Namespace) -> None: output = Path(args.out) if args.out else None if args.sofa_controller: - from pySimBlocks.project.generate_sofa_controller import generate_sofa_controller - - generate_sofa_controller(project_dir=project_dir, project_yaml=project_yaml) + try: + from pySimBlocks.project.generate_sofa_controller import generate_sofa_controller + generate_sofa_controller(project_dir=project_dir, project_yaml=project_yaml) + except Exception as e: + print(f"Error generating SOFA controller: {e}") + print("See SOFA integration documentation for troubleshooting.") + sys.exit(1) else: from pySimBlocks.project import generate_run_script @@ -57,8 +66,7 @@ def _build_parser() -> argparse.ArgumentParser: parser = argparse.ArgumentParser( prog="pysimblocks", description=( - "pySimBlocks command line interface.\n" - "Default behavior with no subcommand: launch the GUI editor." + "pySimBlocks command line interface." ), ) @@ -104,17 +112,6 @@ def _build_parser() -> argparse.ArgumentParser: def main(argv: list[str] | None = None) -> None: args_list = list(sys.argv[1:] if argv is None else argv) parser = _build_parser() - - if not args_list: - _run_gui(project_dir=None) - return - - if args_list[0] not in {"gui", "export", "update", "-h", "--help"}: - if len(args_list) > 1: - parser.error(f"unrecognized arguments: {' '.join(args_list[1:])}") - _run_gui(project_dir=args_list[0]) - return - args = parser.parse_args(args_list) if args.command == "gui": _run_gui(project_dir=args.project_dir) diff --git a/pyproject.toml b/pyproject.toml index 5d77ef2..ef53c80 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,7 +10,21 @@ authors = [ {name = "Antoine Alessandrini", email = "antoine.alessandrini@univ-lille.fr"} ] readme = "README.md" +license = {file = "LICENSE.md"} requires-python = ">=3.10" +keywords = ["simulation", "block-diagram", "control", "discrete-time", "pyside6"] +classifiers = [ + "Development Status :: 3 - Alpha", + "Intended Audience :: Science/Research", + "Intended Audience :: Education", + "License :: OSI Approved :: GNU Lesser General Public License v3 or later (LGPLv3+)", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Scientific/Engineering", + "Topic :: Scientific/Engineering :: Visualization", +] dependencies = [ "numpy", "matplotlib", @@ -19,6 +33,11 @@ dependencies = [ "typing_extensions; python_version < '3.11'" ] +[project.urls] +Homepage = "https://github.com/AlessandriniAntoine/pySimBlocks" +Repository = "https://github.com/AlessandriniAntoine/pySimBlocks" +Issues = "https://github.com/AlessandriniAntoine/pySimBlocks/issues" + [project.scripts] pysimblocks = "pySimBlocks.cli:main"