import sys import os # Add the stockmind package root to sys.path so imports resolve correctly _HERE = os.path.dirname(os.path.abspath(__file__)) if _HERE not in sys.path: sys.path.insert(0, _HERE) from PyQt6.QtWidgets import QApplication from PyQt6.QtCore import Qt from PyQt6.QtGui import QFont from db.database import init_db from utils.config import Config from ui.main_window import MainWindow def main(): os.environ.setdefault("QT_AUTO_SCREEN_SCALE_FACTOR", "1") app = QApplication(sys.argv) app.setApplicationName("StockMind") app.setApplicationVersion("1.0.0") app.setOrganizationName("StockMind") app.setFont(QFont("Segoe UI", 10)) init_db() config = Config() theme = config.get_setting("theme", "dark") qss_path = os.path.join(_HERE, "assets", "styles", f"{theme}.qss") if os.path.exists(qss_path): with open(qss_path, "r") as f: app.setStyleSheet(f.read()) window = MainWindow(config) window.show() sys.exit(app.exec()) if __name__ == "__main__": main()