modbus_test/gui/palletizing.py

41 lines
1.2 KiB
Python

from PyQt6.QtWidgets import QWidget, QVBoxLayout, QPushButton, QLabel
from PyQt6.QtCore import Qt, QTimer
from logger import logger
class Palletizing(QWidget):
def __init__(self, load_palletizing, start_moving):
super().__init__()
self.load_palletizing = load_palletizing
self.start_moving = start_moving
self.initUI()
def initUI(self):
self.layout = QVBoxLayout()
self.robotsLabel = QLabel("Паллетирование")
self.layout.addWidget(self.robotsLabel)
self.palletButton = QPushButton("Визуализировать")
self.palletButton.clicked.connect(self.startPalletzing)
self.layout.addWidget(self.palletButton)
self.startButton = QPushButton("Конвейер")
self.startButton.clicked.connect(self.startMoving)
self.layout.addWidget(self.startButton)
self.setLayout(self.layout)
def startPalletzing(self):
self.load_palletizing()
def startMoving(self):
self.start_moving()
def paintEvent(self, event):
p = self.palette()
p.setColor(self.backgroundRole(), Qt.GlobalColor.lightGray)
self.setPalette(p)
super().paintEvent(event)