Skip to main content

Qt frontend for ryvencore; Library for building Visual Node Editors

Project description

drawing

rvencore-qt is a wrapper around ryvencore and provides a Qt frontend for it. It comes from the Ryven project and will be the foundation for future Ryven versions. So, ryvencore-qt can be used to build cross-platform standalone visual node editors based on Python. Projects made with ryvencore-qt can be natively deployed directly on the backend, ryvencore. The development of ryvencore-qt is currently closely tied to Ryven.

Installation

pip install ryvencore-qt

or build from sources

git clone https://github.com/leon-thomm/ryvencore-qt
cd ryvencore-qt
pip install .

Dependencies

ryvencore-qt runs on PySide2 (Python bindings for Qt) using QtPy as a wrapper to (eventually, once supported) enable seamless switching between PySide2 and PySide6. Notice that ryvencore-qt does not work with PyQt, due to crucial inheritance restrictions in PyQt.

quick start

The below code demonstrates how to set up an editor with custom defined nodes. You can also find the code in the examples folder.

main.py

# Qt
import sys
import os
os.environ['QT_API'] = 'pyside2'  # tells QtPy to use PySide2
from qtpy.QtWidgets import QMainWindow, QApplication

# ryvencore-qt
import ryvencore_qt as rc
from nodes import export_nodes


if __name__ == "__main__":

    # first, we create the Qt application and a window
    app = QApplication()
    mw = QMainWindow()

    # now we initialize a new ryvencore-qt session
    session = rc.Session()
    session.design.set_flow_theme(name='pure light')  # setting the design theme

    # and register our nodes
    session.register_nodes(export_nodes)

    # to get a flow where we can place nodes, we need to crate a new script
    script = session.create_script('hello world', flow_view_size=[800, 500])

    # getting the flow widget of the newly created script
    flow_view = session.flow_views[script]
    mw.setCentralWidget(flow_view)  # and show it in the main window

    # finally, show the window and run the application
    mw.show()
    sys.exit(app.exec_())

nodes.py

import ryvencore_qt as rc
from random import random


# let's define some nodes
# to easily see something in action, we create one node generating random numbers, and one that prints them

class PrintNode(rc.Node):
    """Prints your data"""

    title = 'Print'
    init_inputs = [
        rc.NodeInputBP(),
    ]
    init_outputs = []
    color = '#A9D5EF'

    # we could also skip the constructor here
    def __init__(self, params):
        super().__init__(params)

    def update_event(self, inp=-1):
        print(
            self.input(0)  # get data from the first input
        )


class RandNode(rc.Node):
    """Generates scaled random float values"""

    title = 'Rand'
    init_inputs = [
        rc.NodeInputBP(dtype=rc.dtypes.Data(default=1)),
    ]
    init_outputs = [
        rc.NodeOutputBP(),
    ]
    color = '#fcba03'

    def update_event(self, inp=-1):
        # random float between 0 and value at input
        val = random() * self.input(0)

        # setting the value of the first output
        self.set_output_val(0, val)


export_nodes = [
    PrintNode,
    RandNode,
]

For a more detailed overview, including a precise definition of flows, see the Features Page and ryvencore.

Development

The code is not 100% PEP 8 conform, and some parts which are under development might seem messy. I'm doing my best :) feel free to improve. The individual subpackages have their own READMEs giving a quick overview which should be quite helpful to gain understanding about implementations.

Cheers.

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

ryvencore-qt-0.3.1.3.tar.gz (7.0 MB view details)

Uploaded Source

Built Distribution

ryvencore_qt-0.3.1.3-py3-none-any.whl (5.6 MB view details)

Uploaded Python 3

File details

Details for the file ryvencore-qt-0.3.1.3.tar.gz.

File metadata

  • Download URL: ryvencore-qt-0.3.1.3.tar.gz
  • Upload date:
  • Size: 7.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for ryvencore-qt-0.3.1.3.tar.gz
Algorithm Hash digest
SHA256 33dd4cb5b11284b34714288f8ac414140f29b86438fed950a764a24bdddbafca
MD5 3ccbd6859bc32c2158e20d03967ab952
BLAKE2b-256 f068a4dd253de3efca0e94e725c2cba64b2589835aac96eebc8a8d3d4621f835

See more details on using hashes here.

File details

Details for the file ryvencore_qt-0.3.1.3-py3-none-any.whl.

File metadata

  • Download URL: ryvencore_qt-0.3.1.3-py3-none-any.whl
  • Upload date:
  • Size: 5.6 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for ryvencore_qt-0.3.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 125d2e783660fdb3cfec614b6c1f0414fdc20de98c15167b7d4cb5c6ef8c05d4
MD5 b2dccc4e66b20678470821884447b28c
BLAKE2b-256 1c6cf077704f0a6119ac5cf387975099b516b96a09c37fc1ce076fbfcaf606ab

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