Fix help banner visibility

- Show banner on showEvent (when flow view becomes visible)
- Show banner on mouse enter event
- Raise banner to front to ensure visibility
- Recalculate size before positioning

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
rob 2026-01-15 22:41:03 -04:00
parent fb879d09ea
commit 827f0f9eef
1 changed files with 17 additions and 4 deletions

View File

@ -317,28 +317,41 @@ class FlowGraphWidget(QWidget):
else:
super().keyPressEvent(event)
def showEvent(self, event):
"""Handle widget becoming visible."""
super().showEvent(event)
# Show help banner when flow view becomes visible
QTimer.singleShot(100, self._show_help_banner)
def eventFilter(self, obj, event):
"""Filter events from the graph widget to catch F key and focus."""
if event.type() == QEvent.KeyPress and event.key() == Qt.Key_F:
self.fit_all_nodes()
return True # Event handled
elif event.type() == QEvent.FocusIn:
elif event.type() == QEvent.Enter:
# Show banner when mouse enters the graph area
self._show_help_banner()
return super().eventFilter(obj, event)
def _show_help_banner(self):
"""Show the help banner with fade effect."""
if not self._help_banner:
if not self._help_banner or not self._graph:
return
# Make sure size is calculated
self._help_banner.adjustSize()
# Position at top center of the graph widget
parent_width = self._graph.widget.width()
banner_width = self._help_banner.width()
x = (parent_width - banner_width) // 2
x = max(10, (parent_width - banner_width) // 2)
self._help_banner.move(x, 10)
# Show and start auto-hide timer
# Raise to front and show
self._help_banner.raise_()
self._help_banner.show()
# Start auto-hide timer
self._hide_timer.start(3000) # Hide after 3 seconds
def _fade_out_banner(self):