mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-06-07 12:34:31 +00:00
Add ability to send folder with launch files
This commit is contained in:
@@ -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">
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user