A set of tools to run create Javascript Apps, using Teleporthq UIDL schema
Project description
Nanohub - UIDL
A set of tools to create Javascript apps to consume nanohub WS
Installation
pip install nanohub-uidl
Usage
from nanohub.uidl.teleport import TeleportProject, TeleportElement
from nanohub.uidl.material import MaterialContent
from nanohub.uidl.auth import AUTH
Project = TeleportProject("My App")
Component = Project.root
Component.addStateVariable("myvariable", {"type":"boolean", "defaultValue": True})
STATE_LOADER_STATUS = "loader_status"
STATE_LOADER_OPEN = "loader_open"
STATE_ERROR_STATUS = "error_status"
STATE_ERROR_OPEN = "error_open"
Login, CLogin = Auth.Login(
Project,
Component,
client_id = "MYAPPID",
client_secret = "MYAPPSECRET",
url = "https://nanohub.org/api/developer/oauth/token",
open_state = STATE_LOGIN_OPEN
)
Login.content.events["onError"]=[
{ "type": "stateChange", "modifies": STATE_ERROR_OPEN, "newState": True},
{ "type": "stateChange", "modifies": STATE_ERROR_STATUS, "newState": '$e'},
]
Login.content.events["onAuth"] = [
{ "type": "stateChange", "modifies": STATE_ERROR_OPEN, "newState": False},
{ "type": "stateChange", "modifies": STATE_LOADER_OPEN, "newState": False},
]
Grid = t.TeleportElement(MaterialContent(elementType="Grid"))
Button= MaterialBuilder.Button(
title = "Reset Setting",
variant = "text",
onClickButton=[{ "type": "stateChange", "modifies": "parameters","newState": resetSettings}]
)
Grid.addContent(Button)
Component.addNode(Grid)
Project.buildReact("Myapp.html");
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
nanohub-uidl-0.0.1.tar.gz
(44.4 kB
view hashes)
Built Distribution
Close
Hashes for nanohub_uidl-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07fb1272e79a5aa167770bc34f8e33e3ad99f38ab4de14131fc8133cabd008ba |
|
MD5 | f5b32a4038a56bc49a05f8b191d0f1a8 |
|
BLAKE2b-256 | 65a8e68d2ee09f4bf4959de9b42bd8b58fe26dbef50b1389f05352b5bc002931 |