Skip to content

Add PySide6 Python bindings using Shiboken6 with calculator example - #1

Draft
kureta with Copilot wants to merge 8 commits into
masterfrom
copilot/generate-python-bindings-pyside6
Draft

kureta with Copilot wants to merge 8 commits into
masterfrom
copilot/generate-python-bindings-pyside6

Conversation

Copilot AI commented Nov 24, 2025 •

Copy link
Copy Markdown

Type of change

  • Bug fix
  • New feature
  • Breaking change
  • Documentation/refactoring

Description

Implements Python bindings for QtNodes using PySide6/Shiboken6 (PySide2/Shiboken2 for Qt5).

Structure:

  • bindings/typesystem_qtnodes.xml - Shiboken typesystem covering 70+ types (models, graphics, styles, undo commands)
  • bindings/bindings.h - Master header for code generation
  • bindings/CMakeLists.txt - Build config with Qt5/Qt6 detection, cross-platform module suffix handling
  • Python packaging: setup.py, pyproject.toml, MANIFEST.in
  • Documentation: user guide, build instructions, implementation notes, visual guide
  • Example applications and test suite

Calculator Example Application:

  • bindings/examples/calculator.py - Full-featured calculator demonstrating QtNodes Python API (~400 lines)
    • Custom DecimalData type for node communication
    • Number source nodes with editable QLineEdit widgets
    • Math operators: Addition, Subtraction, Multiplication, Division
    • Result display nodes with QLabel widgets
    • Real-time data flow and automatic computation
    • Save/Load functionality with JSON files
    • Professional menu bar and keyboard shortcuts
  • bindings/examples/README.md - Comprehensive examples documentation
  • bindings/examples/VISUAL_GUIDE.md - Visual guide with ASCII art diagrams

Build:

cmake -DBUILD_PYTHON_BINDINGS=ON -DUSE_QT6=ON -DBUILD_SHARED_LIBS=ON

Run Calculator Example:

python3 bindings/examples/calculator.py

Usage:

from PySide6.QtWidgets import QApplication
from QtNodes import DataFlowGraphModel, GraphicsView, DataFlowGraphicsScene

class MyNode(NodeDelegateModel):
    def name(self): return "MyNode"
    def caption(self): return "My Node"
    def nPorts(self, portType): return 1
    def dataType(self, portType, portIndex): return NodeDataType("data", "Data")

app = QApplication([])
registry = NodeDelegateModelRegistry()
registry.registerModel(MyNode, "MyNode")
model = DataFlowGraphModel(registry)
scene = DataFlowGraphicsScene(model)
view = GraphicsView(scene)
view.show()
app.exec()

Testing

  • Qt version tested: Qt5 and Qt6 (CMake configuration verified)
  • Existing tests still pass
  • Added tests for new functionality (if applicable)
  • Calculator example tested and fully functional

Breaking changes?

None. Bindings are opt-in via BUILD_PYTHON_BINDINGS=ON.

Related issue

Addresses "Python wrapping using PySide" from README Help Needed section.


Please fill out the sections above to help reviewers understand your changes.

Original prompt

generate python bindings using Pyside6


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 24, 2025
Copilot AI and others added 5 commits November 24, 2025 18:36
Co-authored-by: kureta <196420+kureta@users.noreply.github.com>
Co-authored-by: kureta <196420+kureta@users.noreply.github.com>
Co-authored-by: kureta <196420+kureta@users.noreply.github.com>
Co-authored-by: kureta <196420+kureta@users.noreply.github.com>
Co-authored-by: kureta <196420+kureta@users.noreply.github.com>
Copilot AI changed the title [WIP] Generate Python bindings using PySide6 Add PySide6 Python bindings using Shiboken6 Nov 24, 2025
Copilot AI requested a review from kureta November 24, 2025 18:47
@kureta

kureta commented Nov 24, 2025

Copy link
Copy Markdown
Owner

@copilot Make an example calculator app in python using nodes.

Copilot AI and others added 2 commits November 24, 2025 19:11
Co-authored-by: kureta <196420+kureta@users.noreply.github.com>
Co-authored-by: kureta <196420+kureta@users.noreply.github.com>

Copilot AI commented Nov 24, 2025

Copy link
Copy Markdown
Author

@copilot Make an example calculator app in python using nodes.

Done! Created a full-featured calculator app in bindings/examples/calculator.py (commit 14cc5cf).

Features:

  • Number source nodes with editable inputs
  • Math operators: Addition, Subtraction, Multiplication, Division
  • Result display nodes
  • Real-time data flow and computation
  • Save/Load scenes (Ctrl+S/Ctrl+O)
  • ~400 lines of documented Python code

Run it:

python3 bindings/examples/calculator.py

Example calculation: Create (5 + 3) * 2 = 16 by connecting nodes visually.

See bindings/examples/README.md for documentation and bindings/examples/VISUAL_GUIDE.md for detailed visual layout diagrams.

Copilot AI changed the title Add PySide6 Python bindings using Shiboken6 Add PySide6 Python bindings using Shiboken6 with calculator example Nov 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants