conan/uiwidget/widgetvideosettings.py
2021-10-17 12:49:49 +02:00

63 lines
2 KiB
Python

from PyQt5 import QtWidgets, QtCore, QtGui
class WidgetVideoSettings(QtWidgets.QWidget):
signalVisualize = QtCore.pyqtSignal(dict)
signalSelectID = QtCore.pyqtSignal(list)
def __init__(self, parent=None):
super(WidgetVideoSettings, self).__init__(parent)
self.setFixedWidth(200)
layout = QtWidgets.QGridLayout()
iconSize = QtCore.QSize(28, 28)
self.checkBoxes = QtWidgets.QWidget()
self.checkBoxesLayout = QtWidgets.QVBoxLayout()
label = QtWidgets.QLabel('Visualize')
label.setFixedWidth(100)
self.checkBoxes.setLayout(self.checkBoxesLayout)
self.checkBoxesList = dict()
for data in ['Pose', 'Gaze', 'Label', 'Tags']:
box = QtWidgets.QCheckBox(data)
box.setChecked(True)
box.stateChanged.connect(lambda: self.boxstate(box))
self.checkBoxesLayout.addWidget(box)
self.checkBoxesList[data] = box
self.idButtons = QtWidgets.QWidget()
self.buttonsLayout = QtWidgets.QVBoxLayout()
labelID = QtWidgets.QLabel('Showing')
labelID.setFixedWidth(100)
self.idButtons.setLayout(self.buttonsLayout)
self.buttonsList = []
layout.addWidget(label, 0, 0)
layout.addWidget(labelID, 0, 1)
layout.addWidget(self.checkBoxes, 1, 0)
layout.addWidget(self.idButtons, 1, 1)
self.setLayout(layout)
@QtCore.pyqtSlot(list, int)
def setInit(self, colors, numberIDs):
# Emit initial state
self.signalVisualize.emit(self.checkBoxesList)
for id_no in range(numberIDs):
button = QtWidgets.QCheckBox("ID%i" % id_no)
button.setChecked(True)
button.stateChanged.connect(lambda: self.btnstate(button))
self.buttonsLayout.addWidget(button)
self.buttonsList.append(button)
def btnstate(self, b):
self.signalSelectID.emit(self.buttonsList)
def boxstate(self, b):
self.signalVisualize.emit(self.checkBoxesList)