Commit d3f7a980 authored by Karol Actun's avatar Karol Actun
Browse files

small video export and file saving bugfix for linux (video exporting not tested on macOS)

parent aa02e01a
......@@ -518,7 +518,15 @@ class Visualization:
path = QFileDialog().getSaveFileName(options=(QFileDialog.Options()),
filter="*.mp4;;*.avi;;*.mkv",
directory=directory)
writer = cv2.VideoWriter(path[0], cv2.VideoWriter_fourcc(*codec), rps, (width, height))
if path[0] == '':
return
if path[0].endswith("mp4") or path[0].endswith(".avi") or path[0].endswith(".mkv"):
fullpath = path[0]
else:
fullpath = path[0]+path[1].replace('*', '')
writer = cv2.VideoWriter(fullpath, cv2.VideoWriter_fourcc(*codec), rps, (width, height))
self._viewer.setDisabled(True)
# creating and opening loading window
lw = LoadingWindow("", "Exporting Video...")
......@@ -564,7 +572,13 @@ class Visualization:
path = QFileDialog().getSaveFileName(options=(QFileDialog.Options()),
filter="*.svg",
directory=directory)
create_svg(self._world, path[0])
if path[0] == '':
return
if path[0].endswith(".svg"):
create_svg(self._world, path[0]+".svg")
else:
create_svg(self._world, path[0])
else:
show_msg("Not implemented yet.\nWorks only with Triangular Grid for now!\nSorry!", 2)
......
......@@ -514,7 +514,15 @@ class OGLWidget(QtOpenGL.QGLWidget):
path = QFileDialog().getSaveFileName(options=(QFileDialog.Options()),
filter="*.jpg;;*.png;;*.bmp",
directory=directory)
i.save(path[0])
if path[0] == '':
return
if path[0].endswith(".jpg") or path[0].endswith(".jpeg") or \
path[0].endswith(".png") or path[0].endswith(".bmp"):
i.save(path[0])
else:
i.save(path[0]+path[1].replace('*', ''))
def set_background_color(self, color):
self.background = color
......
......@@ -172,7 +172,15 @@ class World:
path = QFileDialog().getSaveFileName(options=QFileDialog.Options(),
filter="*.py",
directory=directory)
save_scenario(path[0])
if path[0] == '':
return
if path[0].endswith(".py"):
save_scenario(path[0])
else:
save_scenario(path[0]+".py")
def csv_aggregator(self):
self.csv_round.aggregate_metrics()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment