A powerful Python + PyQt5 GUI application for visually designing workflows using draggable nodes and connections.
- ✨ Visual Workflow Design: Drag-and-drop interface for creating workflow diagrams
- 🔗 Smart Connections: Create connections between nodes with automatic cycle detection
- ✅ Validation: Built-in validation to ensure workflow integrity
- ⚙️ Node Configuration: Configure node parameters through the properties panel
- 📊 Execution Order: Automatic topological sorting for workflow execution
- 💾 Save/Load: Save and load workflows to/from JSON files
- 🔍 Zoom & Pan: Zoomable canvas with mouse wheel zoom and middle-button pan
- 🎨 Clean Qt UX: Modern, intuitive user interface with Qt5
- 🔌 Extensible: Easy to add custom node types through the node registry
- Entry point for the workflow
- Cannot have inputs
- Must have at least one output
- Color: Green
- Performs data transformations
- Requires at least one input and one output
- Configurable parameters: operation, value
- Color: Blue
- Conditional branching
- Requires one input and multiple outputs (for true/false branches)
- Configurable parameter: condition
- Color: Orange
- Shape: Diamond
- Terminal point for the workflow
- Must have at least one input
- Cannot have outputs
- Color: Red
- Python 3.6 or higher
- PyQt5 5.15.0 or higher
pip install -r requirements.txtOr install PyQt5 directly:
pip install PyQt5>=5.15.0python main.pyOr if you made it executable:
./main.py-
Add Nodes:
- Use the toolbar buttons to add nodes
- Right-click on the canvas and select "Add Node"
- Nodes appear at the center of the current view or at the clicked position
-
Connect Nodes:
- Select a node and drag to another node (currently requires manual connection implementation)
- Or implement connection by selecting source and target nodes
-
Configure Nodes:
- Click on a node to select it
- Edit properties in the right-side Properties panel
- Change the node title
- Set parameters specific to the node type
-
Move Nodes:
- Click and drag nodes to reposition them
- Connections automatically update when nodes move
-
Delete Nodes/Connections:
- Select items and press Delete or Backspace
- Or right-click and select "Delete Selected"
- Zoom In: Mouse wheel up, Ctrl+Plus, or View menu
- Zoom Out: Mouse wheel down, Ctrl+Minus, or View menu
- Reset Zoom: Ctrl+0 or View menu
- Pan: Middle mouse button + drag
- Select: Left click on nodes or connections
- Multi-select: Shift+Click or drag selection box
Checks the workflow for:
- Required start and end nodes
- Proper node connections
- No cycles in the graph
- Disconnected nodes
- Node-specific validation rules
- Validates the workflow
- Determines execution order using topological sort
- Executes nodes in order
- Displays results in the output panel
- New Workflow: File → New (Ctrl+N)
- Open Workflow: File → Open (Ctrl+O) - Load from JSON
- Save Workflow: File → Save (Ctrl+S) - Save to current file
- Save As: File → Save As (Ctrl+Shift+S) - Save to new file
- Exit: File → Exit (Ctrl+Q)
The application follows a clean separation between UI and logic:
-
node.py: Base node classes and node typesNode: Base class for all nodesStartNode,ProcessNode,DecisionNode,EndNode: Specific node typesNodeRegistry: Registry for extensible node systemNodeParameter: Parameter definition system
-
workflow_graph.py: Workflow graph managementWorkflowGraph: Manages nodes and connections- Validation logic (cycle detection, connection rules)
- Execution order determination (topological sort)
- JSON serialization/deserialization
-
graphics_items.py: Visual node representationsGraphicsNode: Visual representation of nodesGraphicsConnection: Visual representation of connections
-
workflow_canvas.py: Canvas with zoom/panWorkflowScene: Graphics scene for the workflowWorkflowView: View with zoom and pan support
-
main_window.py: Main application windowMainWindow: Application window with menus and toolbarsPropertiesPanel: Node configuration panel
-
main.py: Application entry point
- Define a new
NodeTypeinnode.py:
class NodeType(Enum):
# ... existing types ...
CUSTOM = "custom"- Create a custom node class:
class CustomNode(Node):
def __init__(self, node_id=None, x=0, y=0):
super().__init__(node_id, NodeType.CUSTOM, "Custom", x, y)
def get_parameter_definitions(self):
return [
NodeParameter("param1", str, "default", "Description")
]
def validate(self):
# Custom validation logic
return True, ""
def execute(self, input_data):
# Custom execution logic
return input_data- Register the node type:
NodeRegistry.register_node_type(NodeType.CUSTOM, CustomNode)- Add a color in
graphics_items.py:
NODE_COLORS = {
# ... existing colors ...
NodeType.CUSTOM: QColor(150, 100, 200)
}Workflows are saved in JSON format:
{
"nodes": [
{
"id": "uuid-string",
"type": "start",
"title": "Start",
"x": 100.0,
"y": 100.0,
"parameters": {},
"inputs": [],
"outputs": ["uuid-of-connected-node"]
}
],
"connections": [
["from-node-id", "to-node-id"]
]
}qt-workflow-designer/
├── main.py # Application entry point
├── main_window.py # Main window and UI
├── workflow_canvas.py # Scene and view with zoom/pan
├── graphics_items.py # Visual node representations
├── workflow_graph.py # Workflow logic and execution
├── node.py # Node classes and types
├── requirements.txt # Python dependencies
├── .gitignore # Git ignore rules
├── README.md # This file
└── LICENSE # License file
- Separation of Concerns: UI code is separate from business logic
- Extensibility: Node system designed for easy extension
- Validation: Multiple validation layers for data integrity
- Clean Architecture: Each module has a single, well-defined responsibility
See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
If you have trouble installing PyQt5:
On Ubuntu/Debian:
sudo apt-get install python3-pyqt5On macOS with Homebrew:
brew install pyqt5Using conda:
conda install pyqtMake sure you have Python 3.6+ and PyQt5 installed:
python --version
python -c "from PyQt5 import QtWidgets; print('PyQt5 OK')"- Undo/Redo functionality
- Copy/Paste nodes
- Node grouping
- Subworkflows
- Export to image
- Dark theme support
- Interactive connection creation with visual feedback
- Grid snap for node positioning
- Workflow templates
- Plugin system for custom nodes
