Skip to content

Commit

Permalink
Merge pull request OpenShot#2949 from ferdnyc/import-fail-log
Browse files Browse the repository at this point in the history
Image sequence import improvements
  • Loading branch information
jonoomph authored Nov 17, 2019
2 parents 7dc30f1 + ef34fde commit ec0cd97
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
12 changes: 9 additions & 3 deletions src/windows/views/files_listview.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,15 @@ def add_file(self, filepath):

# Save file
file.save()
# Reset list of ignored paths
self.ignore_image_sequence_paths = []

return True

except:
# Handle exception
except Exception as ex:
# Log exception
log.warning("Failed to import file: {}".format(str(ex)))
# Show message to user
msg = QMessageBox()
msg.setText(_("{} is not a valid video, audio, or image file.".format(filename)))
msg.exec_()
Expand Down Expand Up @@ -237,7 +242,7 @@ def get_image_sequence_details(self, file_path):
is_sequence = False

if is_sequence and dirName not in self.ignore_image_sequence_paths:
log.info('Prompt user to import image sequence')
log.info('Prompt user to import image sequence from {}'.format(dirName))
# Ignore this path (temporarily)
self.ignore_image_sequence_paths.append(dirName)

Expand All @@ -248,6 +253,7 @@ def get_image_sequence_details(self, file_path):
ret = QMessageBox.question(self, _("Import Image Sequence"), _("Would you like to import %s as an image sequence?") % fileName, QMessageBox.No | QMessageBox.Yes)
if ret == QMessageBox.Yes:
# Yes, import image sequence
log.info('Importing {} as image sequence {}'.format(file_path, base_name + '*.' + extension))
parameters = {"file_path":file_path, "folder_path":dirName, "base_name":base_name, "fixlen":fixlen, "digits":digits, "extension":extension}
return parameters
else:
Expand Down
12 changes: 9 additions & 3 deletions src/windows/views/files_treeview.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,10 +191,15 @@ def add_file(self, filepath):

# Save file
file.save()
# Reset list of ignored paths
self.ignore_image_sequence_paths = []

return True

except:
# Handle exception
except Exception as ex:
# Log exception
log.warning("Failed to import file: {}".format(str(ex)))
# Show message to user
msg = QMessageBox()
msg.setText(_("{} is not a valid video, audio, or image file.".format(filename)))
msg.exec_()
Expand Down Expand Up @@ -236,7 +241,7 @@ def get_image_sequence_details(self, file_path):
is_sequence = False

if is_sequence and dirName not in self.ignore_image_sequence_paths:
log.info('Prompt user to import image sequence')
log.info('Prompt user to import image sequence from {}'.format(dirName))
# Ignore this path (temporarily)
self.ignore_image_sequence_paths.append(dirName)

Expand All @@ -247,6 +252,7 @@ def get_image_sequence_details(self, file_path):
ret = QMessageBox.question(self, _("Import Image Sequence"), _("Would you like to import %s as an image sequence?") % fileName, QMessageBox.No | QMessageBox.Yes)
if ret == QMessageBox.Yes:
# Yes, import image sequence
log.info('Importing {} as image sequence {}'.format(file_path, base_name + '*.' + extension))
parameters = {"file_path":file_path, "folder_path":dirName, "base_name":base_name, "fixlen":fixlen, "digits":digits, "extension":extension}
return parameters
else:
Expand Down

0 comments on commit ec0cd97

Please sign in to comment.