Skip to main content

Graphical User Interface engine based upon Schema

Project description

OpenTEA

logo

OpenTEA is a graphical user interface engine. It convert a set of degrees of freedom, expressed in SCHEMA, into graphical forms.

example

The documentation is currently available in ReadtheDocs

Installation

Opentea is OpenSource (Cecill-B) available on PiPY.

>pip install opentea

then test your installation with

>opentea3 test-gui trivial

Basic Usage

OpenTEA is a GUI engine, based on the json-SCHEMA description. For example, assume a nested information conforming to the following SCHEMA :

---
title: "Trivial form..."
type: object
properties:
  first_tab:
    type: object
    title: Only tab.
    process: custom_callback.py
    properties:
      first_block:
        type: object
        title: Custom Block
        properties:
          number_1:
            title: "Number 1"
            type: number
            default: 32.
          operand:
            title: "Operation"
            type: string
            default: "+"
            enum: ["+", "-", "*", "/"]
          number_2:
            title: "Number 2"
            type: number
            default: 10.
          result:
            title: "result"
            state: disabled
            type: string
            default: "-"

The openTEA GUI will show as :

Trivial GUI

In this form, a callback can be added to each tab. The corresponding custom_callback.py script is :

"""Module for the first tab."""

from opentea.process_utils import process_tab

def custom_fun(nob):
    """Update the result."""

    operation = nob["first_tab"]["first_block"]["operand"]
    nb1 = nob["first_tab"]["first_block"]["number_1"]
    nb2 = nob["first_tab"]["first_block"]["number_2"]

    res = None
    if operation == "+":
        res = nb1 + nb2
    elif operation == "-":
        res = nb1 - nb2
    elif operation == "*":
        res = nb1 * nb2
    elif operation == "/":
        res = nb1 / nb2
    else:
        res = None

    nob["first_tab"]["first_block"]["result"] = res
    return nob

if __name__ == "__main__":
    process_tab(custom_fun)

Note that OpenTEA meomory is a classical nested object named here nob. The memory I/O can be done the usual Python way : nob["first_tab"]["first_block"]["result"] = res. We however encourage the use our nested object helper , available on PyPI, which gives a faster -an still pythonic- access to the nested object. The name of the package is, unsurprisigly nob.

Finally, the data recorded by the GUI is available as a YAML file, conforming to the SCHEMA Validation:

first_tab:
  first_block:
    number_1: 32.0
    number_2: 10.0
    operand: +
    result: 42.0

Command line

A small CLI makes available small tools for developpers. Only two tools are present now. Call the CLI using opentea3:

Usage: opentea3 [OPTIONS] COMMAND [ARGS]...

  ---------------    O P E N T E A  III  --------------------

  You are now using the Command line interface of Opentea 3, a Python3
  Tkinter GUI engine based on SCHEMA specifications, created at CERFACS
  (https://cerfacs.fr).

  This is a python package currently installed in your python environement.
  See the full documentation at : https://opentea.readthedocs.io/en/latest/.

Options:
  --help  Show this message and exit.

Commands:
  test-gui     Examples of OpenTEA GUIs
  test-schema  Test if a yaml SCHEMA_FILE is valid for an opentea GUI.

Acknowledgments

This work was funded, among many sources, by the CoE Excellerat and the National project ICARUS. Many thanks to the people from SAFRAN group for their feedback.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

OpenTEA-3.6.0.tar.gz (448.7 kB view details)

Uploaded Source

Built Distribution

OpenTEA-3.6.0-py3-none-any.whl (472.6 kB view details)

Uploaded Python 3

File details

Details for the file OpenTEA-3.6.0.tar.gz.

File metadata

  • Download URL: OpenTEA-3.6.0.tar.gz
  • Upload date:
  • Size: 448.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for OpenTEA-3.6.0.tar.gz
Algorithm Hash digest
SHA256 0fda7dd75b015ef809a72d38c7a333acb7a98a7b8a8eedeb9eb50bd679187942
MD5 31248e20b8c1b36b97e079636be4b97b
BLAKE2b-256 e3d9a4d6f6d9dc3cbe2e3db953ff22b8ca92e53636d292bdce391bd7b88df954

See more details on using hashes here.

File details

Details for the file OpenTEA-3.6.0-py3-none-any.whl.

File metadata

  • Download URL: OpenTEA-3.6.0-py3-none-any.whl
  • Upload date:
  • Size: 472.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.4

File hashes

Hashes for OpenTEA-3.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b1e74794477b71d196973b50464646d8f25be3ebf22ed51b5b2ac095640ae8a
MD5 08d0d06e58092e72b6e666320cc19c28
BLAKE2b-256 3efaa8b3c728cffb5cae400eb991074cb785462cb1d4f33f1f6393f2eefe8bf6

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page