Skip to content

Commit

Permalink
Add ability to send folder with launch files
Browse files Browse the repository at this point in the history
  • Loading branch information
goldarte committed Oct 29, 2019
1 parent 585cb61 commit 82a434b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions Server/server_gui.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1220</width>
<height>750</height>
<height>761</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -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">
Expand Down
10 changes: 6 additions & 4 deletions Server/server_qt.py
Original file line number Diff line number Diff line change
Expand Up @@ -419,12 +419,14 @@ def send_aruco(self):

@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()
Expand Down
2 changes: 1 addition & 1 deletion messaging_lib.py
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ def _process_filetransfer(self, message): # TODO path?
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:
Expand Down

0 comments on commit 82a434b

Please sign in to comment.