mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-06-08 04:54:31 +00:00
server: add ability to restart clever service after file uploading
This commit is contained in:
@@ -340,10 +340,10 @@ class Client:
|
||||
return self._request_queue.pop(requested_value)
|
||||
|
||||
@requires_connect
|
||||
def send_file(self, filepath, dest_filename):
|
||||
def send_file(self, filepath, dest_filename, clever_restart = False):
|
||||
print("Sending file ", dest_filename)
|
||||
chunk_count = math.ceil(os.path.getsize(filepath) / Server.BUFFER_SIZE)
|
||||
self.send(Client.form_message("writefile", {"filesize": chunk_count, "filename": dest_filename}))
|
||||
self.send(Client.form_message("writefile", {"filesize": chunk_count, "filename": dest_filename, "clever_restart": clever_restart}))
|
||||
with open(filepath, 'rb') as file:
|
||||
chunk = file.read(Server.BUFFER_SIZE)
|
||||
while chunk:
|
||||
|
||||
@@ -166,7 +166,7 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||
item = model.item(row_num, 0)
|
||||
if item.isCheckable() and item.checkState() == Qt.Checked:
|
||||
copter = Client.get_by_id(item.text())
|
||||
copter.send_file(path, "/home/pi/catkin_ws/src/clever/aruco_pose/map/animation_map.txt")
|
||||
copter.send_file(path, "/home/pi/catkin_ws/src/clever/aruco_pose/map/animation_map.txt", clever_restart=True)
|
||||
|
||||
|
||||
model = QStandardItemModel()
|
||||
|
||||
Reference in New Issue
Block a user