diff --git a/ui/connectors_panel.py b/ui/connectors_panel.py index 3f2c47e..6916abc 100644 --- a/ui/connectors_panel.py +++ b/ui/connectors_panel.py @@ -129,15 +129,14 @@ class JiraConnectDialog(QDialog): color: white; } """) - # Click-based popover: build help content once, show on click + # Click-based inline help: toggle a QLabel below the input self._help_text = ( "" + tr("connectors.jira_kb_project_id_title") + "
" + tr("connectors.jira_kb_project_id_help") + "

" + tr("connectors.jira_kb_jira_key_title") + "
" + tr("connectors.jira_kb_jira_key_help") ) - self._help_popup = None - self.help_icon.clicked.connect(self._toggle_help_popup) + self.help_icon.clicked.connect(self._toggle_inline_help) label_row = QHBoxLayout() label_row.setSpacing(4) label_row.addWidget(mapping_label) @@ -147,6 +146,18 @@ class JiraConnectDialog(QDialog): label_widget.setLayout(label_row) mapping_form.addRow(label_widget, self.project_mapping) + # Inline help panel (hidden by default, toggled by ? button) + self._inline_help = QLabel(self._help_text) + self._inline_help.setObjectName("hint") + self._inline_help.setWordWrap(True) + self._inline_help.setTextFormat(Qt.RichText) + self._inline_help.setStyleSheet( + "background: #1E2A3A; border: 1px solid #5B9BD5; border-radius: 6px;" + " padding: 8px 10px; color: #E0E0E0; font-size: 12px;" + ) + self._inline_help.hide() + mapping_form.addRow("", self._inline_help) + # Validation hint for common mistakes (e.g., entering ABC-123 instead of ABC) self.mapping_validation = QLabel() self.mapping_validation.setObjectName("hint") @@ -188,62 +199,12 @@ class JiraConnectDialog(QDialog): self.kb_enabled.toggled.connect(self._update_sync_state) self._update_sync_state(self.kb_enabled.isChecked()) - def _toggle_help_popup(self) -> None: - """Show/hide a floating help popup when the ? button is clicked.""" - if self._help_popup is not None and self._help_popup.isVisible(): - self._help_popup.close() - self._help_popup = None - return - - # Use a small QDialog (not QFrame+Qt.Popup) — more reliable on macOS - popup = QDialog(self) - popup.setWindowFlags(Qt.Tool | Qt.FramelessWindowHint) - popup.setAttribute(Qt.WA_TranslucentBackground, False) - popup.setStyleSheet(""" - QDialog { - background: #2D2D2D; - border: 1px solid #5B9BD5; - border-radius: 8px; - } - """) - popup_layout = QVBoxLayout(popup) - popup_layout.setContentsMargins(14, 12, 14, 12) - - content = QLabel(self._help_text) - content.setWordWrap(True) - content.setMaximumWidth(380) - content.setStyleSheet( - "color: #E0E0E0; font-size: 12px; background: transparent; border: none;" - ) - content.setTextFormat(Qt.RichText) - content.setOpenExternalLinks(True) - popup_layout.addWidget(content) - - # Close button row - close_row = QHBoxLayout() - close_row.addStretch(1) - close_btn = QPushButton("✕") - close_btn.setFixedSize(24, 24) - close_btn.setStyleSheet(""" - QPushButton { - border: none; background: transparent; color: #999; - font-size: 14px; font-weight: bold; - } - QPushButton:hover { color: #fff; } - """) - close_btn.clicked.connect(popup.close) - close_row.addWidget(close_btn) - popup_layout.addLayout(close_row) - - # Position below the help button - btn_global = self.help_icon.mapToGlobal( - QPoint(0, self.help_icon.height() + 4) - ) - popup.move(btn_global) - popup.show() - popup.raise_() - popup.activateWindow() - self._help_popup = popup + def _toggle_inline_help(self) -> None: + """Toggle the inline help panel below the mapping input.""" + if self._inline_help.isHidden(): + self._inline_help.show() + else: + self._inline_help.hide() def _on_paste(self, text: str) -> None: """Auto-fill Base URL from a pasted Jira link."""