A trame extension to allow outside programs to send instructions to a trame app
Project description
trame-remote-control
A trame extension to allow outside programs to send instructions to a trame app.
trame-remote-control attaches a REST-API endpoint, which can be used by outside programs to send instrctions, called actions to the program. This can, e.g., be used to initialite a Connection between a trame app and a ParaView Server.
Supported Actions
The API endpoint will by default initialized on the /api path, which can be changed be setting the REMOTE_CONTROL_ENDPOINT
environment variable to a different location.
To trigger an action, send a POST request to the API path. The body must contain a JSON, which specifies the action to trigger and might contain the parameters for that action. See the list below for the supported actions and their required parameters:
{
"action": "connect",
"url": "localhost",
"port": 11111
}
| Action Name | Parameters | Description |
|---|---|---|
connect |
url: string, port: optional int = 11111 | Connect a trame-vtk app to a ParaView Serverrunning on <url>:<port> |
diconnect |
Disconnect from a previously connected ParaView Server | |
open_catalyst |
Open a Catalyst connection |
Installing
To install this extension, execute pip install trame-remote-control
For a Development install, clone the repository and execute pip install -e .
Usage
After you installed the extension, import the module via trame.
To initialize the API endpoint, execute the initialize method.
If you, optionally, want to create the UI Elements to trigger action from within the application, you can execute create_panel:
from trame.app import get_server
from trame.ui.vuetify import SinglePageLayout
from trame.widgets import vuetify, remote_control
def main():
server = get_server()
... # Other initialization
remote_control.initialize(server)
# Create UI
with SinglePageLayout(server):
...
with vuetify.VCol():
remote_control.create_panel(server)
ToDos
- Allow developers to specify which Actions are initialized
- Add ping route to retrieve if application has finished loading and which Actions are available
- Create more Actions
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file trame_remote_control-0.1.1.tar.gz.
File metadata
- Download URL: trame_remote_control-0.1.1.tar.gz
- Upload date:
- Size: 8.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1834789ec15ab7964badaa3a13f8dd29c1e96a7f66f5569538d72a30237d96d2
|
|
| MD5 |
d84c5b7ff707d3e4a518ffcdfbeec189
|
|
| BLAKE2b-256 |
3a800b4b904c4cfdf631ccf47a16da44b4800d0eeac52276307cf0805cc03bd9
|
File details
Details for the file trame_remote_control-0.1.1-py3-none-any.whl.
File metadata
- Download URL: trame_remote_control-0.1.1-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b7083a290fcc50aa2d4fdc7de73dcd574e976d6c72f185b199da628339bf209b
|
|
| MD5 |
4f1194c74eafafdfb7d475c2af2ae347
|
|
| BLAKE2b-256 |
b3895e4a5e9c5f34581edcd766184dd71f024113047e61ecb5a24670ca794a2a
|