meccatronis commited on
Commit
578d803
·
verified ·
1 Parent(s): f542a21

Upload main.py with huggingface_hub

Browse files
Files changed (1) hide show
  1. main.py +51 -0
main.py ADDED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ #!/usr/bin/env python3
2
+ """
3
+ Main Application for GPU Floating Monitor
4
+ Integrates GPU data reader with floating UI
5
+ """
6
+
7
+ import sys
8
+ import time
9
+ from PyQt6.QtWidgets import QApplication
10
+ from PyQt6.QtCore import QTimer
11
+ from gpu_reader import GPUReader
12
+ from ui import FloatingWindow
13
+
14
+ class GPUMonitorApp:
15
+ def __init__(self, update_interval=1000):
16
+ self.app = QApplication(sys.argv)
17
+ self.reader = GPUReader()
18
+ self.window = FloatingWindow()
19
+ self.update_interval = update_interval # milliseconds
20
+
21
+ # Set up timer for updates
22
+ self.timer = QTimer()
23
+ self.timer.timeout.connect(self.update_display)
24
+ self.timer.start(self.update_interval)
25
+
26
+ def update_display(self):
27
+ """Update the display with latest GPU data"""
28
+ try:
29
+ data = self.reader.get_all_data()
30
+ self.window.update_data(data)
31
+ except Exception as e:
32
+ print(f"Error updating display: {e}")
33
+
34
+ def run(self):
35
+ """Run the application"""
36
+ # Show the window
37
+ self.window.show()
38
+
39
+ # Initial update
40
+ self.update_display()
41
+
42
+ # Start the event loop
43
+ return self.app.exec()
44
+
45
+ def main():
46
+ # Create and run the application
47
+ app = GPUMonitorApp()
48
+ sys.exit(app.run())
49
+
50
+ if __name__ == "__main__":
51
+ main()