Skip to content

Commit 3fbbd27

Browse files
author
Bryan Howard
committed
Add Epic 3.4 specification and pin type visibility enhancement documentation
- Add docs/stories/3.4.epic.md with Epic 3.4: Enhanced Data Flow Visualization - Add docs/specifications/pin-type-visibility-enhancement.md with pin type display specification - Documentation for upcoming features and technical specifications Generated with [Claude Code](https://claude.ai/code)
1 parent 071fdd1 commit 3fbbd27

File tree

2 files changed

+470
-0
lines changed

2 files changed

+470
-0
lines changed
Lines changed: 324 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,324 @@
1+
# PyFlowGraph Pin Type Visibility Enhancement Specifications
2+
3+
## Executive Summary
4+
5+
This document provides comprehensive specifications for enhancing pin and connection type visibility in PyFlowGraph through hover tooltips and visual feedback systems. The enhancement addresses a critical UX gap by implementing industry-standard type visibility patterns found in professional visual scripting tools like Grasshopper, Dynamo, and Blender.
6+
7+
## Business Justification
8+
9+
### Problem Statement
10+
Users currently struggle to identify pin data types and connection compatibility in PyFlowGraph, relying solely on color coding which requires memorization and provides limited information. This creates friction for:
11+
- New users learning the type system
12+
- Experienced users working with complex graphs
13+
- Debugging type compatibility issues
14+
- Understanding connection data flow
15+
16+
### Success Metrics
17+
- **Reduced Support Queries**: 50% reduction in type-related user questions
18+
- **Improved Onboarding**: New users understand pin types within first 5 minutes
19+
- **Enhanced Productivity**: Faster connection creation with reduced trial-and-error
20+
- **Industry Alignment**: Match UX expectations from other visual scripting tools
21+
22+
## Design Philosophy
23+
24+
### Core Principles
25+
- **Progressive Disclosure**: Information appears when needed, stays hidden when not
26+
- **Industry Standards Alignment**: Follow established patterns from Grasshopper, Dynamo, n8n
27+
- **Non-Intrusive Enhancement**: Enhance existing color system without replacing it
28+
- **Educational Value**: Help users learn the type system through contextual information
29+
- **Performance First**: Lightweight implementation with minimal performance impact
30+
31+
### Target Users
32+
- **Primary**: Developers familiar with visual scripting tools expecting hover tooltips
33+
- **Secondary**: New users needing guidance on type compatibility
34+
- **Advanced**: Power users requiring detailed type information for complex graphs
35+
36+
## Feature Specifications
37+
38+
### Phase 1: Pin Hover Tooltips (Priority 1)
39+
40+
#### 1.1 Basic Pin Tooltips
41+
42+
**Trigger**: Mouse hover over any pin
43+
**Display Timing**: 500ms delay (standard tooltip timing)
44+
**Content**:
45+
```
46+
Type: <pin_type>
47+
Category: <data|execution>
48+
Direction: <input|output>
49+
```
50+
51+
**Example Output**:
52+
```
53+
Type: str
54+
Category: data
55+
Direction: input
56+
```
57+
58+
#### 1.2 Enhanced Data Pin Tooltips
59+
60+
**For Data Pins with Values**:
61+
```
62+
Type: <pin_type>
63+
Category: data
64+
Direction: <direction>
65+
Current Value: <truncated_value>
66+
```
67+
68+
**Value Truncation Rules**:
69+
- Strings: Max 50 characters, add "..." if longer
70+
- Numbers: Full precision up to 15 digits
71+
- Complex objects: Show type name (e.g., "dict (5 keys)")
72+
- None/null: Show "None"
73+
74+
#### 1.3 Execution Pin Tooltips
75+
76+
**For Execution Pins**:
77+
```
78+
Type: exec
79+
Category: execution
80+
Direction: <input|output>
81+
Status: <ready|waiting|executed>
82+
```
83+
84+
### Phase 2: Connection Hover Enhancement (Priority 2)
85+
86+
#### 2.1 Connection Type Display
87+
88+
**Trigger**: Mouse hover over any connection line
89+
**Content**:
90+
```
91+
<source_node_name>.<source_pin_name> -> <dest_node_name>.<dest_pin_name>
92+
Type: <data_type>
93+
Status: <active|inactive>
94+
```
95+
96+
#### 2.2 Visual Hover Effects
97+
98+
**Pin Hover Effects**:
99+
- Subtle glow effect (2px outer glow using pin color)
100+
- 10% brightness increase on pin color
101+
- Smooth 200ms transition in/out
102+
103+
**Connection Hover Effects**:
104+
- Line width increase from 3px to 4px
105+
- 20% brightness increase on connection color
106+
- Smooth 150ms transition in/out
107+
108+
### Phase 3: Advanced Features (Priority 3)
109+
110+
#### 3.1 Type Compatibility Indicators
111+
112+
**During Connection Creation**:
113+
- Compatible pins: Green glow (success indicator)
114+
- Incompatible pins: Red glow (error indicator)
115+
- Same-type pins: Blue highlight for exact matches
116+
117+
#### 3.2 Compact Type Labels (Optional)
118+
119+
**Show/Hide Conditions**:
120+
- Show when: Zoom level > 75%, critical pins only
121+
- Hide when: Zoom level < 50%, too many pins visible
122+
- Toggle: Right-click context menu option "Show Pin Types"
123+
124+
**Label Format**:
125+
- Position: Small text below pin, 8pt font
126+
- Content: Abbreviated type (str, int, bool, list, dict, any, exec)
127+
- Color: 60% opacity of pin color
128+
129+
## Technical Implementation
130+
131+
### 4.1 Modified Files
132+
133+
**Primary Changes**:
134+
- `src/core/pin.py`: Add hover event handlers and tooltip generation
135+
- `src/core/connection.py`: Add connection hover effects and tooltips
136+
137+
**Supporting Changes**:
138+
- `src/utils/tooltip_utils.py`: New utility for consistent tooltip formatting
139+
- `src/core/node_graph.py`: Integration for connection creation feedback
140+
141+
### 4.2 Pin.py Implementation
142+
143+
```python
144+
def hoverEnterEvent(self, event):
145+
"""Generate and display tooltip on hover."""
146+
tooltip_text = self._generate_tooltip_text()
147+
self.setToolTip(tooltip_text)
148+
self._apply_hover_effect()
149+
super().hoverEnterEvent(event)
150+
151+
def hoverLeaveEvent(self, event):
152+
"""Remove hover effects."""
153+
self._remove_hover_effect()
154+
super().hoverLeaveEvent(event)
155+
156+
def _generate_tooltip_text(self):
157+
"""Create formatted tooltip content."""
158+
lines = [
159+
f"Type: {self.pin_type}",
160+
f"Category: {self.pin_category}",
161+
f"Direction: {self.direction}"
162+
]
163+
164+
if self.pin_category == "data" and self.value is not None:
165+
value_str = self._format_value_for_tooltip(self.value)
166+
lines.append(f"Current Value: {value_str}")
167+
168+
return "\n".join(lines)
169+
```
170+
171+
### 4.3 Connection.py Implementation
172+
173+
```python
174+
def hoverEnterEvent(self, event):
175+
"""Show connection information on hover."""
176+
if self.start_pin and self.end_pin:
177+
tooltip_text = self._generate_connection_tooltip()
178+
self.setToolTip(tooltip_text)
179+
self._apply_connection_hover_effect()
180+
super().hoverEnterEvent(event)
181+
182+
def _generate_connection_tooltip(self):
183+
"""Create connection tooltip content."""
184+
source = f"{self.start_pin.node.name}.{self.start_pin.name}"
185+
dest = f"{self.end_pin.node.name}.{self.end_pin.name}"
186+
return f"{source} -> {dest}\nType: {self.start_pin.pin_type}"
187+
```
188+
189+
## User Stories for Scrum Master
190+
191+
### Epic: Pin Type Visibility Enhancement
192+
193+
**Epic Description**: As a PyFlowGraph user, I want to easily identify pin types and connection compatibility so that I can create valid connections efficiently and understand data flow in complex graphs.
194+
195+
### Story 1: Basic Pin Hover Tooltips
196+
```
197+
As a PyFlowGraph user
198+
I want to see type information when hovering over pins
199+
So that I can understand what data types each pin accepts/outputs
200+
201+
Acceptance Criteria:
202+
- [ ] Hovering over any pin shows tooltip after 500ms delay
203+
- [ ] Tooltip displays: Type, Category, Direction
204+
- [ ] Tooltip disappears when mouse leaves pin area
205+
- [ ] Tooltip text is readable against all backgrounds
206+
- [ ] No performance impact on pin rendering or graph navigation
207+
```
208+
209+
### Story 2: Data Value Display in Tooltips
210+
```
211+
As a PyFlowGraph user
212+
I want to see current pin values in hover tooltips
213+
So that I can debug data flow and verify node execution
214+
215+
Acceptance Criteria:
216+
- [ ] Data pins with values show current value in tooltip
217+
- [ ] Long values are truncated to 50 characters with "..."
218+
- [ ] Complex objects show type information (e.g., "dict (5 keys)")
219+
- [ ] Null/None values display as "None"
220+
- [ ] Values update in real-time as execution progresses
221+
```
222+
223+
### Story 3: Pin Hover Visual Effects
224+
```
225+
As a PyFlowGraph user
226+
I want visual feedback when hovering over pins
227+
So that I can clearly see which pin I'm interacting with
228+
229+
Acceptance Criteria:
230+
- [ ] Hovered pins show subtle glow effect (2px outer glow)
231+
- [ ] Pin color brightness increases by 10% on hover
232+
- [ ] Smooth 200ms transition for hover in/out effects
233+
- [ ] Effects work consistently across all pin types and colors
234+
- [ ] No performance impact on smooth hover interactions
235+
```
236+
237+
### Story 4: Connection Hover Information
238+
```
239+
As a PyFlowGraph user
240+
I want to see connection details when hovering over connection lines
241+
So that I can understand data flow between specific nodes
242+
243+
Acceptance Criteria:
244+
- [ ] Hovering over connections shows source and destination info
245+
- [ ] Tooltip format: "SourceNode.pin_name -> DestNode.pin_name"
246+
- [ ] Connection type is displayed in tooltip
247+
- [ ] Connection visual feedback: width increase + brightness boost
248+
- [ ] Smooth transitions for connection hover effects
249+
```
250+
251+
### Story 5: Type Compatibility Visual Feedback
252+
```
253+
As a PyFlowGraph user
254+
I want visual indicators for pin compatibility when creating connections
255+
So that I can immediately see which pins can connect to each other
256+
257+
Acceptance Criteria:
258+
- [ ] Compatible pins show green glow during connection creation
259+
- [ ] Incompatible pins show red glow when connection attempted
260+
- [ ] Same-type exact matches show blue highlight
261+
- [ ] Visual feedback appears immediately on hover during drag
262+
- [ ] Feedback clears immediately when connection drag ends
263+
```
264+
265+
## Testing Requirements
266+
267+
### Unit Tests
268+
- Tooltip text generation for all pin types
269+
- Hover event handling and cleanup
270+
- Value formatting and truncation logic
271+
- Visual effect application/removal
272+
273+
### Integration Tests
274+
- Tooltip display across different zoom levels
275+
- Performance with large graphs (100+ nodes)
276+
- Interaction with existing color system
277+
- Accessibility with screen readers
278+
279+
### User Acceptance Testing
280+
- New user onboarding with tooltip guidance
281+
- Experienced user productivity improvements
282+
- Type debugging workflow validation
283+
- Cross-browser tooltip rendering consistency
284+
285+
## Success Criteria
286+
287+
### Phase 1 Success Metrics
288+
- ✅ All pins show informative tooltips on hover
289+
- ✅ No measurable performance degradation
290+
- ✅ Tooltips integrate seamlessly with existing UI
291+
- ✅ User feedback confirms improved type understanding
292+
293+
### Phase 2 Success Metrics
294+
- ✅ Connection information readily available via hover
295+
- ✅ Visual feedback enhances interaction clarity
296+
- ✅ Reduced trial-and-error in connection creation
297+
298+
### Phase 3 Success Metrics
299+
- ✅ Advanced users adopt optional type label features
300+
- ✅ Type compatibility system reduces invalid connection attempts
301+
- ✅ Overall user satisfaction with type visibility improvements
302+
303+
## Risk Mitigation
304+
305+
### Performance Risks
306+
- **Risk**: Tooltip generation impacts hover responsiveness
307+
- **Mitigation**: Cache tooltip strings, use lazy generation
308+
309+
### UX Risks
310+
- **Risk**: Tooltip clutter or excessive visual noise
311+
- **Mitigation**: Follow 500ms delay standard, subtle visual effects only
312+
313+
### Compatibility Risks
314+
- **Risk**: Conflicts with existing hover behaviors
315+
- **Mitigation**: Thorough testing with current context menus and selection
316+
317+
## Appendix: Industry Research Summary
318+
319+
**Grasshopper**: "Hover over pins for tooltips with type and default value info"
320+
**Dynamo**: "Hover over a Port to see a tooltip containing the data type expected"
321+
**n8n**: "Color-coded ports make this concept easy and intuitive for end-users"
322+
**Blender**: Users report tooltip absence in node editors as "quite a huge hindrance"
323+
324+
This enhancement brings PyFlowGraph in line with established industry patterns while leveraging the existing robust color-coding system as a foundation for improved user experience.

0 commit comments

Comments
 (0)