feat: add snapshot recording
This commit is contained in:
		| @@ -2,10 +2,10 @@ import socket | ||||
| import struct | ||||
|  | ||||
| from PyQt6 import uic | ||||
| from PyQt6.QtCore import QObject, Qt, QThread, QTimer, pyqtSignal, pyqtSlot | ||||
| from PyQt6.QtCore import QObject, QThread, QTimer, pyqtSignal, pyqtSlot | ||||
| from PyQt6.QtWidgets import QMainWindow | ||||
|  | ||||
| from src.command import CarControl, Command, ControlCommand | ||||
| from src.command import CarControl, Command, ControlCommand, RecordingCommand | ||||
| from src.recorder_ui import Ui_Recorder | ||||
| from src.snapshot import Snapshot | ||||
|  | ||||
| @@ -18,7 +18,8 @@ class RecorderClient(QObject): | ||||
|         super().__init__() | ||||
|         self.host: str = host | ||||
|         self.port: int = port | ||||
|         self.socket: socket.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | ||||
|         self.socket: socket.socket = socket.socket( | ||||
|             socket.AF_INET, socket.SOCK_STREAM) | ||||
|         self.timer: QTimer = QTimer(self) | ||||
|         self.timer.timeout.connect(self.poll_socket) | ||||
|         self.connected: bool = False | ||||
| @@ -29,7 +30,7 @@ class RecorderClient(QObject): | ||||
|         self.socket.setblocking(False) | ||||
|         self.connected = True | ||||
|         self.timer.start(50) | ||||
|         print(f"Connected to server") | ||||
|         print("Connected to server") | ||||
|  | ||||
|     def poll_socket(self): | ||||
|         buffer: bytes = b"" | ||||
| @@ -155,7 +156,10 @@ class RecorderWindow(Ui_Recorder, QMainWindow): | ||||
|         self.send_command(ControlCommand(control, active)) | ||||
|  | ||||
|     def toggle_record(self): | ||||
|         pass | ||||
|         self.recording = not self.recording | ||||
|         self.recordDataButton.setText( | ||||
|             "Recording..." if self.recording else "Record") | ||||
|         self.send_command(RecordingCommand(self.recording)) | ||||
|  | ||||
|     def rollback(self): | ||||
|         pass | ||||
|   | ||||
		Reference in New Issue
	
	Block a user