#!/usr/bin/env python3 """ Main Application for GPU Floating Monitor Integrates GPU data reader with floating UI """ import sys import time from PyQt6.QtWidgets import QApplication from PyQt6.QtCore import QTimer from gpu_reader import GPUReader from ui import FloatingWindow class GPUMonitorApp: def __init__(self, update_interval=1000): self.app = QApplication(sys.argv) self.reader = GPUReader() self.window = FloatingWindow() self.update_interval = update_interval # milliseconds # Set up timer for updates self.timer = QTimer() self.timer.timeout.connect(self.update_display) self.timer.start(self.update_interval) def update_display(self): """Update the display with latest GPU data""" try: data = self.reader.get_all_data() self.window.update_data(data) except Exception as e: print(f"Error updating display: {e}") def run(self): """Run the application""" # Show the window self.window.show() # Initial update self.update_display() # Start the event loop return self.app.exec() def main(): # Create and run the application app = GPUMonitorApp() sys.exit(app.run()) if __name__ == "__main__": main()