-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
56 lines (42 loc) · 1.75 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
56
import sys
from PySide6.QtGui import QAction, Qt
from PySide6.QtWidgets import (QApplication, QGraphicsScene,
QMainWindow, QMenu, QVBoxLayout,
QWidget)
from Utils.CartesianGrid import CartesianGrid
from Rectangle.DrawRectangle import DrawRectangle
from Rectangle.RectangleList import RectangleList
from Rectangle.RectangleSignalEmitter import RectangleSignalEmitter
from Utils.TransformationHandler import TransformationHandler
class MainWindow(QMainWindow):
def __init__(self):
super().__init__()
self.resize(1200, 1000)
self.rectangleSignalEmitter = RectangleSignalEmitter()
self.rectangleCount = 0
menubar = self.menuBar()
fileMenu = QMenu("File", self)
exitAction = QAction("Exit", self)
exitAction.triggered.connect(self.close)
fileMenu.addAction(exitAction)
menubar.addMenu(fileMenu)
self.dock = RectangleList()
self.addDockWidget(Qt.LeftDockWidgetArea, self.dock)
self.scene = QGraphicsScene()
grid = CartesianGrid(1200, 1000, 10)
self.scene.addItem(grid)
self.rectangleSignalEmitter.connectSignalCreated(self.dock.createCheckbox)
self.rectangleSignalEmitter.connectSignalDeleted(self.dock.deleteCheckbox)
self.view = DrawRectangle(self.scene)
transformationHandler = TransformationHandler(self.dock)
layout = QVBoxLayout()
layout.addWidget(self.view)
layout.addLayout(transformationHandler)
container = QWidget()
container.setLayout(layout)
self.setCentralWidget(container)
self.show()
if __name__ == "__main__":
app = QApplication(sys.argv)
window = MainWindow()
sys.exit(app.exec())