You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.4 KiB
85 lines
2.4 KiB
# main.py
|
|
|
|
import sys
|
|
from PyQt5.QtWidgets import QApplication, QMainWindow, QPushButton, QWidget, QVBoxLayout
|
|
from PyQt5.QtCore import Qt
|
|
from dmx import DMXRecorder
|
|
|
|
class MainWindow(QMainWindow):
|
|
def __init__(self):
|
|
super().__init__()
|
|
self.initUI()
|
|
self.isRecording = False
|
|
self.recorder = None
|
|
|
|
def initUI(self):
|
|
self.setWindowTitle("DMX Recorder")
|
|
self.resize(300, 200)
|
|
|
|
# Use dark theme
|
|
self.setStyleSheet('''
|
|
QWidget {
|
|
background-color: #222222;
|
|
color: #FFFFFF;
|
|
}
|
|
QSlider::groove:horizontal {
|
|
border: 1px solid #444444;
|
|
height: 8px;
|
|
background: #555555;
|
|
}
|
|
QSlider::handle:horizontal {
|
|
background: #888888;
|
|
border: 1px solid #444444;
|
|
width: 18px;
|
|
margin: -8px 0;
|
|
}
|
|
QLineEdit {
|
|
background-color: #333333;
|
|
border: 1px solid #555555;
|
|
color: #FFFFFF;
|
|
padding: 4px;
|
|
}
|
|
QPushButton {
|
|
background-color: #444444;
|
|
border: 1px solid #666666;
|
|
padding: 6px;
|
|
}
|
|
QPushButton:hover {
|
|
background-color: #555555;
|
|
}
|
|
QLabel {
|
|
color: #FFFFFF;
|
|
}
|
|
''')
|
|
|
|
self.central_widget = QWidget()
|
|
self.setCentralWidget(self.central_widget)
|
|
|
|
self.layout = QVBoxLayout()
|
|
self.central_widget.setLayout(self.layout)
|
|
|
|
self.record_button = QPushButton("Record")
|
|
self.record_button.clicked.connect(self.toggle_recording)
|
|
|
|
self.layout.addWidget(self.record_button)
|
|
|
|
def toggle_recording(self):
|
|
if not self.isRecording:
|
|
# Start recording
|
|
self.recorder = DMXRecorder()
|
|
self.recorder.start_recording()
|
|
self.record_button.setText("Stop")
|
|
self.isRecording = True
|
|
else:
|
|
# Stop recording
|
|
if self.recorder:
|
|
self.recorder.stop_recording()
|
|
self.recorder = None
|
|
self.record_button.setText("Record")
|
|
self.isRecording = False
|
|
|
|
if __name__ == '__main__':
|
|
app = QApplication(sys.argv)
|
|
window = MainWindow()
|
|
window.show()
|
|
sys.exit(app.exec_())
|