3 Commits
Author SHA1 Message Date
nngoandClaude Sonnet 4.6 06b951daf7 feat: dark/light theme toggle (Catppuccin Frappé ↔ Latte)
- app/config/theme.py: palette definitions for both themes + apply_qss()
  helper used by both main.py (startup) and MainWindow (live toggle)
- resources/style_light.qss: complete Catppuccin Latte QSS
- View menu: ☀️/🌙 Switch Theme action (Ctrl+Shift+T) toggles live
- Preferences → Appearance: Color theme dropdown persists choice
- SQLHighlighter: _build_rules() reads get_palette(); update_theme()
  rebuilds rules and rehighlights all open editors on switch
- SqlCompleter: popup stylesheet reads get_palette() via
  _apply_popup_style(); update_theme() called on switch
- EditableTableModel: dirty/delete cell colors read get_palette() live
- ResultTableModel: NULL_COLOR property reads get_palette() live
- TableViewer: apply_settings() refreshes frozen-view border + repaints

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-22 09:11:05 -04:00
nngoandClaude Sonnet 4.6 b003976d39 theme: upgrade palette from Catppuccin Mocha to Frappé
Replaces all dark-Mocha colours (#1e1e2e base, #313244 surface0, etc.)
with the noticeably brighter Frappé variants (#303446 base, #414559
surface0, etc.) across the QSS and every hardcoded colour in Python
source files (syntax highlighter, completer popup, log viewer, explain
view, table viewer, schema browser, icons, etc.).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 16:51:37 -04:00
nngoandClaude Sonnet 4.6 f680bfe3a3 Add schema-aware SQL auto-complete to the SQL editor
New file app/ui/sql_completer.py:
- SqlCompleter (QObject) owns a _CompletionPopup (QListWidget) that
  floats above the editor as a ToolTip-style frameless window styled
  to match the Catppuccin Mocha theme.
- SQL keyword pool sourced directly from syntax_highlighter._KEYWORDS,
  _TYPES, _FUNCTIONS so the two features stay in sync.
- Schema data (tables, views, columns) loaded asynchronously via
  SchemaWorker; a generation counter discards stale results when the
  database changes rapidly.
- Column loading is lazy: fires only when the user types "table."
  (dot-qualified prefix), avoiding upfront cost for wide schemas.
- _extract_prefix() uses a regex to detect both bare words and
  "table.col" dot notation; guards against completing inside string
  literals by counting unescaped quotes to the left of the cursor.
- _accept_completion() replaces only the typed prefix, preserving any
  qualifier already in the document (e.g. "orders.cu" → "orders.customer_id").

Changes to app/ui/sql_editor.py:
- CodeEditor.set_completer() attaches the completer and stores it.
- keyPressEvent priority order:
    1. Popup visible → Esc hides, Enter/Tab accepts, Up/Down navigates.
    2. Ctrl+Space → force-show completions (1-char minimum).
    3. Tab (no popup) → existing 4-space insert behaviour preserved.
    4. Ctrl+/ → existing comment-toggle preserved.
    5. All other keys → super() then auto-trigger (2-char minimum).
- focusOutEvent hides the popup when the editor loses focus.
- EditorTab._build_ui() creates SqlCompleter, attaches it, and calls
  set_context() if a driver is already present.
- EditorTab.set_context() updates driver/database and reloads schema.
- _maybe_invalidate_schema() re-fetches schema after CREATE/DROP/ALTER
  so newly created tables appear in completions immediately.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-21 16:28:58 -04:00