From ec654be45eca6ea1194b0145609edfbd3e6d8c97 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 20 May 2005 21:27:03 +0000 Subject: [PATCH] * src/gramps_main.py (read_file): Remove set_resizable() calls. * src/ReadGedcom.py (parse_person_object,parse_family_object): Always add media references/objects, even if the files are not found (keep the warnings); set the note for the media references. svn: r4647 --- gramps2/ChangeLog | 4 +++ gramps2/src/ReadGedcom.py | 58 ++++++++++++++++++++------------------ gramps2/src/gramps_main.py | 2 -- 3 files changed, 34 insertions(+), 30 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index d4ce6c7c9..cc05f2964 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -16,6 +16,10 @@ referred MediaObject. * src/MediaView.py (on_drag_drop): Remove drag_get_data() call as it was calling extraneous 'drag-data-received' signal. + * src/gramps_main.py (read_file): Remove set_resizable() calls. + * src/ReadGedcom.py (parse_person_object,parse_family_object): + Always add media references/objects, even if the files are not found + (keep the warnings); set the note for the media references. 2005-05-19 Don Allingham * src/DisplayModels.py: remove place column diff --git a/gramps2/src/ReadGedcom.py b/gramps2/src/ReadGedcom.py index f503ea984..3c570b67a 100644 --- a/gramps2/src/ReadGedcom.py +++ b/gramps2/src/ReadGedcom.py @@ -1190,21 +1190,22 @@ class GedcomParser: self.warn(_("\tThe following paths were tried:\n\t\t")) self.warn("\n\t\t".join(path)) self.warn('\n') + path = filename.replace('\\','/') + photo_handle = self.media_map.get(path) + if photo_handle == None: + photo = RelLib.MediaObject() + photo.set_path(path) + photo.set_description(title) + photo.set_mime_type(GrampsMime.get_type(os.path.abspath(path))) + self.db.add_object(photo, self.trans) + self.media_map[path] = photo.get_handle() else: - photo_handle = self.media_map.get(path) - if photo_handle == None: - photo = RelLib.MediaObject() - photo.set_path(path) - photo.set_description(title) - photo.set_mime_type(GrampsMime.get_type(os.path.abspath(path))) - self.db.add_object(photo, self.trans) - self.media_map[path] = photo.get_handle() - else: - photo = self.db.get_object_from_handle(photo_handle) - oref = RelLib.MediaRef() - oref.set_reference_handle(photo.get_handle()) - self.person.add_media_reference(oref) - self.db.commit_person(self.person, self.trans) + photo = self.db.get_object_from_handle(photo_handle) + oref = RelLib.MediaRef() + oref.set_reference_handle(photo.get_handle()) + oref.set_note(note) + self.person.add_media_reference(oref) + self.db.commit_person(self.person, self.trans) def parse_family_object(self,level): form = "" @@ -1234,21 +1235,22 @@ class GedcomParser: self.warn(_("\tThe following paths were tried:\n\t\t")) self.warn("\n\t\t".join(path)) self.warn('\n') + path = filename.replace('\\','/') + photo_handle = self.media_map.get(path) + if photo_handle == None: + photo = RelLib.MediaObject() + photo.set_path(path) + photo.set_description(title) + photo.set_mime_type(GrampsMime.get_type(os.path.abspath(path))) + self.db.add_object(photo, self.trans) + self.media_map[path] = photo.get_handle() else: - photo_handle = self.media_map.get(path) - if photo_handle == None: - photo = RelLib.MediaObject() - photo.set_path(path) - photo.set_description(title) - photo.set_mime_type(GrampsMime.get_type(os.path.abspath(path))) - self.db.add_object(photo, self.trans) - self.media_map[path] = photo.get_handle() - else: - photo = self.db.get_object_from_handle(photo_handle) - oref = RelLib.MediaRef() - oref.set_reference_handle(photo.get_handle()) - self.family.add_media_reference(oref) - self.db.commit_family(self.family, self.trans) + photo = self.db.get_object_from_handle(photo_handle) + oref = RelLib.MediaRef() + oref.set_reference_handle(photo.get_handle()) + oref.set_note(note) + self.family.add_media_reference(oref) + self.db.commit_family(self.family, self.trans) def parse_residence(self,address,level): note = "" diff --git a/gramps2/src/gramps_main.py b/gramps2/src/gramps_main.py index f640ac9b0..11e71b99b 100755 --- a/gramps2/src/gramps_main.py +++ b/gramps2/src/gramps_main.py @@ -1257,7 +1257,6 @@ class Gramps(GrampsDBCallback.GrampsDBCallback): self.progress.set_fraction(0) def read_file(self,filename,callback=None): - self.topWindow.set_resizable(False) mode = "w" filename = os.path.normpath(os.path.abspath(filename)) @@ -1300,7 +1299,6 @@ class Gramps(GrampsDBCallback.GrampsDBCallback): _('%s could not be opened.' % filename) + '\n' + msg[1]) return 0 - self.topWindow.set_resizable(True) # Undo/Redo always start with standard labels and insensitive state self.undo_callback(None) self.redo_callback(None)