Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 13 additions & 9 deletions docs/Users/EmioLabs/create-your-lab.md
Original file line number Diff line number Diff line change
Expand Up @@ -230,27 +230,31 @@ For example:

There are three types of buttons available :

1. __The SOFA button__ will launch a SOFA simulation with the specified scene file `MY_SCENE.py`. You can pass as many arguments as you want to the scene file:
1. The __runsofa-button__ will launch a SOFA simulation with the specified scene file `MY_SCENE.py`. You can pass as many arguments as you want to the scene file:
```markdown
#runsofa-button("assets/labs/<LAB_NAME>/MY_SCENE.py", "MY_ARGUMENT_1", "MY_ARGUMENT_2")
#runsofa-button(file="assets/labs/<LAB_NAME>/MY_SCENE.py", 
pyargs=["MY_ARGUMENT_1", "MY_ARGUMENT_2"])
```
2. __The Python button__ will run a python script `MY_SCRIPT.py`. You can optionally provide a path to additional python modules that will be added to the `PYTHONPATH` before running the script.
2. The __python-button__ will run a python script `MY_SCRIPT.py`. You can optionally provide a path to additional python modules that will be added to the `PYTHONPATH` before running the script.
```markdown
#python-button("'assets/labs/<LAB_NAME>/MY_SCRIPT.py' arg1 'example/path/as/arg2'", "OPTIONAL_PATH_TO_PYTHON_MODULES")
#python-button(file="assets/labs/<LAB_NAME>/MY_SCRIPT.py",
pyargs=["arg1", "example/path/as/arg2"], 
extrapythonpath=["OPTIONAL_PATH_TO_PYTHON_MODULES"])
```
You can use this button to install extra Python packages with:
You can use this button to install extra Python packages for your lab with:
```markdown
#python-button("-m pip install --target 'assets/labs/<LAB_NAME>/modules/site-packages' -r 'assets/labs/<LAB_NAME>/requirements.txt'")
#python-button(pyargs=["-m", "pip", "install", "--target", "assets/labs/<LAB_NAME>/modules/site-packages", "-r", "assets/labs/<LAB_NAME>/requirements.txt"])
```
3. __The Open button__ will open a file `MY_FILE` with the default application associated with the file type on your system.
3. The __open-button__ will open a file `MY_FILE` with the default application associated with the file type on your system.
```markdown
#open-button("assets/labs/<LAB_NAME>/MY_FILE")
#open-button(file="assets/labs/<LAB_NAME>/MY_FILE")
```

An argument can be a value of a [`select block`](#select-block) or an [`input`](#text-input) field, by using its unique name that you defined. For example:

```markdown
#runsofa-button("MY_SCENE.py", "MY_UNIQUE_SELECT_OR_INPUT_NAME", "MY_ARGUMENT_2")
#runsofa-button(file="MY_SCENE.py",
pyargs=["MY_UNIQUE_SELECT_OR_INPUT_NAME", "MY_ARGUMENT_2"])
```

#### Icons
Expand Down
21 changes: 12 additions & 9 deletions docs/Users/EmioLabs/emio-labs-user-manual.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ To resolve this:

- Main Table of Contents: Navigate between different labs and access resources.
- Lab Environment: Interactive space where you'll follow learning materials and complete exercises and simulations.
- Simulation Application (sofa-robotics): Launch and interact with the numerical twin of Emio.
- Simulation Application (SOFA Robotics): Launch and interact with the numerical twin of Emio.
- To reset the application go to **Edit > Reset App** in the main menu bar. This will reset the quiz, select the default parameters in the labs, etc.

<img className="centered" src={emiolabs_overview} width="50%" alt="emio labs overview"/>
Expand Down Expand Up @@ -234,16 +234,19 @@ In the main dashboard click on the Sandbox link to open the corresponding page:
1. Follow the instructions to help you set up your Emio and the numerical twin.
2. Launch the corresponding simulation by clicking on the SOFA button as usual, and enjoy.

## Install Python packages for Emio Labs
For some labs or if you are creating your own lab, you might need to install Python packages that are not shipped with the embedded Emio Labs Python.
## Installing Python Packages for Emio Labs

To do this:
If you are creating your own lab, you might need to install Python packages that are not shipped with the embedded Emio Labs Python.
To install these packages for your lab, you can add a `python-button` to the markdown file:
```markdown
#python-button(pyargs=["-m", "pip", "install", "--target", "assets/labs/<LAB_NAME>/modules/site-packages", "MYPACKAGENAME"])
```
or if you have a requirement.txt file:
```markdown
#python-button(pyargs=["-m", "pip", "install", "--target", "assets/labs/<LAB_NAME>/modules/site-packages", "-r", "assets/labs/<LAB_NAME>/requirements.txt"])
```

1. Find the Python installation of Emio Labs by going to the installation folder of Emio Labs, for example on Windows that might be `C:\Users\<USERNAME>\AppData\Local\Programs\emio-labs` .
2. There should be a folder `resources\sofa\bin\python`. This is where the Python running with Emio Labs is.
3. Open a terminal in this folder ( e.g. `C:\Users\<USERNAME>\AppData\Local\Programs\emio-labs\resources\sofa\bin\python`).
4. To install the Python package of name `lepackage`, type in `python -m pip install lepackage`
5. If admin rights are necessary, accept or type in the admin password when prompted
Then, on the page of your lab in the Emio Labs application, clicking on the Python button <img className="drop-shadow" src="/img/logo_python.png" alt="python-icon" style={{borderRadius:0,width:20}}/> will install the extra Python packages in the `modules/site-packages` directory of your lab.

:::warning
If you are on MacOS, there is no Python shipped with Emio Labs. Use the Python you installed in the [installation process](#installation)
Expand Down
Binary file modified docs/Users/EmioLabs/img/emio-labs-overview.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added static/img/logo_python.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading