GithubHelp home page GithubHelp logo

jwindgassen / trame-remote-control Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 8 KB

A trame extension to allow outside programs to send instructions to a trame app

License: MIT License

Python 100.00%

trame-remote-control's Introduction

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

trame-remote-control's People

Contributors

jwindgassen avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.