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: ...@@ -518,7 +518,15 @@ class Visualization:
path = QFileDialog().getSaveFileName(options=(QFileDialog.Options()), path = QFileDialog().getSaveFileName(options=(QFileDialog.Options()),
filter="*.mp4;;*.avi;;*.mkv", filter="*.mp4;;*.avi;;*.mkv",
directory=directory) 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) self._viewer.setDisabled(True)
# creating and opening loading window # creating and opening loading window
lw = LoadingWindow("", "Exporting Video...") lw = LoadingWindow("", "Exporting Video...")
...@@ -564,7 +572,13 @@ class Visualization: ...@@ -564,7 +572,13 @@ class Visualization:
path = QFileDialog().getSaveFileName(options=(QFileDialog.Options()), path = QFileDialog().getSaveFileName(options=(QFileDialog.Options()),
filter="*.svg", filter="*.svg",
directory=directory) 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: else:
show_msg("Not implemented yet.\nWorks only with Triangular Grid for now!\nSorry!", 2) show_msg("Not implemented yet.\nWorks only with Triangular Grid for now!\nSorry!", 2)
......
...@@ -514,7 +514,15 @@ class OGLWidget(QtOpenGL.QGLWidget): ...@@ -514,7 +514,15 @@ class OGLWidget(QtOpenGL.QGLWidget):
path = QFileDialog().getSaveFileName(options=(QFileDialog.Options()), path = QFileDialog().getSaveFileName(options=(QFileDialog.Options()),
filter="*.jpg;;*.png;;*.bmp", filter="*.jpg;;*.png;;*.bmp",
directory=directory) 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): def set_background_color(self, color):
self.background = color self.background = color
......
...@@ -172,7 +172,15 @@ class World: ...@@ -172,7 +172,15 @@ class World:
path = QFileDialog().getSaveFileName(options=QFileDialog.Options(), path = QFileDialog().getSaveFileName(options=QFileDialog.Options(),
filter="*.py", filter="*.py",
directory=directory) 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): def csv_aggregator(self):
self.csv_round.aggregate_metrics() self.csv_round.aggregate_metrics()
......
Supports Markdown
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