cluster4npu/main.py
Mason 92f9d956af Remove cluster4npu_ui package prefix and remove export/analysis buttons
- Update all imports to use relative imports instead of cluster4npu_ui.* prefix
- Remove export configuration functionality from dashboard menu
- Remove performance analysis action from pipeline menu
- Update dependencies in pyproject.toml to include NodeGraphQt and PyQt5
- Maintain clean import structure across all modules

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 12:17:59 +08:00

82 lines
2.1 KiB
Python

"""
Main application entry point for the Cluster4NPU UI application.
This module initializes the PyQt5 application, applies the theme, and launches
the main dashboard window. It serves as the primary entry point for the
modularized UI application.
Main Components:
- Application initialization and configuration
- Theme application and font setup
- Main window instantiation and display
- Application event loop management
Usage:
python -m cluster4npu_ui.main
# Or directly:
from main import main
main()
"""
import sys
import os
from PyQt5.QtWidgets import QApplication
from PyQt5.QtGui import QFont
from PyQt5.QtCore import Qt
# Add the parent directory to the path for imports
sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
from config.theme import apply_theme
from ui.windows.login import DashboardLogin
def setup_application():
"""Initialize and configure the QApplication."""
# Enable high DPI support BEFORE creating QApplication
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling, True)
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps, True)
# Create QApplication if it doesn't exist
if not QApplication.instance():
app = QApplication(sys.argv)
else:
app = QApplication.instance()
# Set application properties
app.setApplicationName("Cluster4NPU")
app.setApplicationVersion("1.0.0")
app.setOrganizationName("Cluster4NPU Team")
# Set application font
app.setFont(QFont("Arial", 9))
# Apply the harmonious theme
apply_theme(app)
return app
def main():
"""Main application entry point."""
try:
# Setup the application
app = setup_application()
# Create and show the main dashboard login window
dashboard = DashboardLogin()
dashboard.show()
# Start the application event loop
sys.exit(app.exec_())
except Exception as e:
print(f"Error starting application: {e}")
import traceback
traceback.print_exc()
sys.exit(1)
if __name__ == '__main__':
main()