Add ability to send folder with launch files

This commit is contained in:
Arthur Golubtsov
2019-10-29 15:54:08 +03:00
parent 585cb61673
commit 82a434b4ca
3 changed files with 9 additions and 7 deletions

View File

@@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1220</width>
<height>750</height>
<height>761</height>
</rect>
</property>
<property name="windowTitle">
@@ -466,7 +466,7 @@
</action>
<action name="action_send_launch_file">
<property name="text">
<string>Send launch file to clever</string>
<string>Send launch files</string>
</property>
</action>
<action name="action_restart_clever">

View File

@@ -419,12 +419,14 @@ class MainWindow(QtWidgets.QMainWindow):
@pyqtSlot()
def send_launch(self):
path = QFileDialog.getOpenFileName(self, "Select launch file for clever", filter="Launch files (*.launch)")[0]
path = str(QFileDialog.getExistingDirectory(self, "Select directory with launch files"))
if path:
filename = os.path.basename(path)
print("Selected file:", path, filename)
print("Selected directory:", path)
files = [file for file in glob.glob(path + '/*.launch')]
for copter in self.model.user_selected():
copter.client.send_file(path, "/home/pi/catkin_ws/src/clever/clever/launch/{}".format(filename))
for file in files:
filename = os.path.basename(file)
copter.client.send_file(file, "/home/pi/catkin_ws/src/clever/clever/launch/{}".format(filename))
# copter.client.send_message("service_restart", {"name": "clever"})
@pyqtSlot()

View File

@@ -383,7 +383,7 @@ class ConnectionManager(object):
logger.error("File {} can not be written due error: {}".format(filepath, error))
else:
logger.info("File {} successfully received ".format(filepath))
os.system("chown -R pi:pi /home/pi/clever-show")
os.system("chown -R pi:pi /home/pi/clever-show/")
def write(self):
with self._send_lock: