-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
55 lines (40 loc) · 1.47 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import sys
from PySide6.QtWidgets import QApplication, QWidget
from PySide6.QtCore import Qt
from managers import cam_manager, config_manager, keymap_manager, guide_manager
class MainWindow(QWidget):
def __init__(self):
super().__init__()
self.setWindowFlags(Qt.FramelessWindowHint | Qt.WindowStaysOnTopHint)
self.setStyleSheet("background-color: rgba(0, 0, 0, 0);")
self.setFixedSize(1000, 1000)
cam_manager.load_cam(self)
guide_manager.load_guide(self)
self.load_config()
self.show()
def save_config(self):
config_manager.save_config(self)
def load_config(self):
try:
config_manager.load_config(self)
except FileNotFoundError:
config_manager.create_config(self)
def save_config_as(self, spot):
config_manager.save_config_as(self, spot)
def load_config_as(self, spot):
config_manager.load_config_as(self, spot)
def mousePressEvent(self, event):
self.drag_pos = event.globalPos()
def mouseMoveEvent(self, event):
self.move(self.pos() + event.globalPos() - self.drag_pos)
self.drag_pos = event.globalPos()
event.accept()
def mouseReleaseEvent(self, event):
self.save_config()
event.accept()
def keyPressEvent(self, event):
keymap_manager.load_keymap(self, event)
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
sys.exit(app.exec())