From fe8d5bb9cde780bacaab2619e3d3d289b69f93d8 Mon Sep 17 00:00:00 2001 From: Josip Date: Sat, 8 Mar 2014 17:32:19 +0100 Subject: [PATCH] 7435: Media Editor error if Path value was changed to a non existing file --- gramps/gui/editors/editmedia.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gramps/gui/editors/editmedia.py b/gramps/gui/editors/editmedia.py index df66ecdb1..6c71cbe23 100644 --- a/gramps/gui/editors/editmedia.py +++ b/gramps/gui/editors/editmedia.py @@ -290,7 +290,17 @@ class EditMedia(EditPrimary): return path = self.file_path.get_text() - self.determine_mime() + if os.path.isfile(path): + self.determine_mime() + else: + msg1 = _("There is no media matching the current path value!") + msg2 = _("You have attempted to use the path with " + "value '%(path)s'. This path does not exist!" + " Please enter a different path") % { + 'path' : path } + ErrorDialog(msg1, msg2) + self.ok_button.set_sensitive(True) + return self.obj.set_path(get_unicode_path_from_file_chooser(path))