feat: preferences dialog, SQL formatter, and enhanced table context menu
- PreferencesDialog (Tools → Preferences, Ctrl+,): font family/size, word wrap, default page size, query timeout, max history, auto-commit; font changes apply live to all open editors via apply_settings() cascade - CodeEditor and TableViewer now read initial values from settings singleton - SQL formatter (≡ Format button): uses sqlparse to reindent and uppercase keywords; gracefully prompts to install sqlparse if missing - Table viewer context menu: "Filter by this value" (populates WHERE and reloads), "Copy row as SQL INSERT" (ready-to-paste INSERT statements), renamed "Copy row" → "Copy row as TSV" for clarity Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
+16
-1
@@ -30,7 +30,8 @@ from app.ui.explain_view import ExplainPanel
|
||||
from app.ui.user_manager import UserManagerPanel
|
||||
from app.ui.log_viewer import LogViewer
|
||||
from app.ui.connection_dialog import ConnectionDialog
|
||||
from app.ui.shortcuts_dialog import ShortcutsDialog
|
||||
from app.ui.shortcuts_dialog import ShortcutsDialog
|
||||
from app.ui.preferences_dialog import PreferencesDialog
|
||||
from app.config.connections import load_profiles, delete_profile
|
||||
from app.config.recent_files import load_recent, add_recent, clear_recent
|
||||
from app.models.connection_model import ConnectionProfile
|
||||
@@ -184,6 +185,8 @@ class MainWindow(QMainWindow):
|
||||
|
||||
# ── Tools ─────────────────────────────────────────────────────────────
|
||||
tools_menu = mb.addMenu("&Tools")
|
||||
tools_menu.addAction(self._act("Preferences…", self._open_preferences, "Ctrl+,"))
|
||||
tools_menu.addSeparator()
|
||||
tools_menu.addAction(self._act("Process List…", self._open_process_list, "Ctrl+P"))
|
||||
tools_menu.addSeparator()
|
||||
tools_menu.addAction(self._act("Import CSV / JSON…", self._open_import_dialog))
|
||||
@@ -581,6 +584,18 @@ class MainWindow(QMainWindow):
|
||||
"MySQL · PostgreSQL · SQLite · SQL Server<br><br>"
|
||||
"Built with Python + PyQt6.")
|
||||
|
||||
def _open_preferences(self):
|
||||
dlg = PreferencesDialog(parent=self)
|
||||
dlg.settings_applied.connect(self._apply_settings_to_open_tabs)
|
||||
dlg.exec()
|
||||
|
||||
def _apply_settings_to_open_tabs(self):
|
||||
"""Push updated settings to all currently open workspace tabs."""
|
||||
for i in range(self._workspace.count()):
|
||||
widget = self._workspace.widget(i)
|
||||
if hasattr(widget, "apply_settings"):
|
||||
widget.apply_settings()
|
||||
|
||||
def _show_shortcuts(self):
|
||||
dlg = ShortcutsDialog(parent=self)
|
||||
dlg.exec()
|
||||
|
||||
Reference in New Issue
Block a user