Skip to content

Commit

Permalink
Handle non-existing file path for the sound in project.
Browse files Browse the repository at this point in the history
  • Loading branch information
Stefan Murawski committed Sep 15, 2020
1 parent b7256a9 commit 3e85c86
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 2 additions & 0 deletions LipsyncDoc.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,8 @@ def open(self, path):
self.current_voice = self.voices[0]

def open_audio(self, path):
if not os.path.exists(path):
return
if self.sound is not None:
del self.sound
self.sound = None
Expand Down
8 changes: 3 additions & 5 deletions LipsyncFrameQT.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,15 +352,13 @@ def open(self, path):
dlg.setWindowTitle(app_title)
dlg.setIcon(QtWidgets.QMessageBox.Warning)
dlg.exec_() # This should open it as a modal blocking window
dlg.destroy() # Untested, might not need it
print(self.config.value("WorkingDir", get_main_dir()))
file_path, _ = QtWidgets.QFileDialog(self.main_window,
file_path = QtWidgets.QFileDialog.getOpenFileName(self.main_window,
"Open Audio",
self.config.value("WorkingDir", get_main_dir()),
open_wildcard)
audio_extensions)[0]
if file_path:
self.config.setValue("WorkingDir", os.path.dirname(file_path))
self.doc.open(file_path)
self.doc.open_audio(file_path)
else:
# open an audio file
self.doc.fps = int(self.config.value("LastFPS", 24))
Expand Down

0 comments on commit 3e85c86

Please sign in to comment.