- 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>
56 lines
1.3 KiB
Python
56 lines
1.3 KiB
Python
"""
|
|
DBClient — entry point.
|
|
"""
|
|
import sys
|
|
import os
|
|
from PyQt6.QtWidgets import QApplication
|
|
from PyQt6.QtCore import Qt
|
|
from PyQt6.QtGui import QFont
|
|
|
|
from app.utils.logger import setup_logging, install_qt_message_handler, get_logger
|
|
from app.main_window import MainWindow
|
|
from app.config.theme import apply_qss
|
|
|
|
log = get_logger(__name__)
|
|
|
|
|
|
def load_stylesheet(app: QApplication) -> None:
|
|
apply_qss(app) # reads theme from settings, falls back to dark
|
|
|
|
|
|
def main():
|
|
# ── Logging must be set up before anything else ───────────────────────────
|
|
setup_logging()
|
|
|
|
# High DPI
|
|
os.environ.setdefault("QT_ENABLE_HIGHDPI_SCALING", "1")
|
|
|
|
app = QApplication(sys.argv)
|
|
app.setApplicationName("DBClient")
|
|
app.setApplicationDisplayName("DBClient")
|
|
app.setApplicationVersion("1.0.0")
|
|
app.setOrganizationName("DBClient")
|
|
|
|
# Route Qt's own warning/critical messages into the Python log
|
|
install_qt_message_handler()
|
|
|
|
# Default font
|
|
font = QFont("Segoe UI", 10)
|
|
app.setFont(font)
|
|
|
|
load_stylesheet(app)
|
|
|
|
log.info("Starting MainWindow")
|
|
window = MainWindow()
|
|
window.show()
|
|
|
|
log.info("Entering event loop")
|
|
exit_code = app.exec()
|
|
log.info("Application exited with code %d", exit_code)
|
|
sys.exit(exit_code)
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|
|
|