From 5eacb7c353eb08c5bbd1fa4efe2d9102aa13b61d Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Thu, 3 Jun 2004 05:35:30 +0000 Subject: [PATCH] * src/MediaView.py: Pass parent to GlobalMediaProperties; typos. * src/SelectObject.py: Typos. * src/ImageSelect.py (LocalMediaProperties.__init__, GlobalMediaProperties.__init__): Handle source tab. * src/EventEdit.py: Handle gallery tab. * src/WriteXML.py (dump_my_event): Write object references; * src/gramps.glade: Add gallery tab to Event Editor; add source tab to media property editor. * src/RelLib.py (Event): Add media_list and related methods; (ObjectRef): Inherit from SourceNote, remove unnecessary functions; (GrampsDB.get_media_attribute_types): Add method. * src/ReadXML.py (start_sourceref): Check for attribute before the object. Objects may have attributes; (start_objref): Parse media object references for Event records. svn: r3199 --- ChangeLog | 17 ++ src/EventEdit.py | 22 +- src/ImageSelect.py | 129 +++++++++--- src/MediaView.py | 21 +- src/ReadXML.py | 12 +- src/RelLib.py | 69 +++---- src/SelectObject.py | 6 +- src/WriteXML.py | 7 +- src/gramps.glade | 478 ++++++++++++++++++++++++++++++++++++++++++++ 9 files changed, 681 insertions(+), 80 deletions(-) diff --git a/ChangeLog b/ChangeLog index dba8b43b5..e7d8931d0 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,20 @@ +2004-06-02 Alex Roitman + * src/MediaView.py: Pass parent to GlobalMediaProperties; typos. + * src/SelectObject.py: Typos. + * src/ImageSelect.py (LocalMediaProperties.__init__, + GlobalMediaProperties.__init__): Handle source tab. + * src/EventEdit.py: Handle gallery tab. + * src/WriteXML.py (dump_my_event): Write object references; + (write_photo_list): Write source references. + * src/gramps.glade: Add gallery tab to Event Editor; add source + tab to media property editor. + * src/RelLib.py (Event): Add media_list and related methods; + (ObjectRef): Inherit from SourceNote, remove unnecessary functions; + (GrampsDB.get_media_attribute_types): Add method. + * src/ReadXML.py (start_sourceref): Check for attribute before + the object. Objects may have attributes; (start_objref): Parse media + object references for Event records. + 2004-06-02 Don Allingham * src/DisplayModels.py: support for Spouse column * src/MediaView.py: fix try_to_find_object_from_id diff --git a/src/EventEdit.py b/src/EventEdit.py index f8f1c77c7..abc0af5e8 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -45,6 +45,7 @@ import AutoComp import Calendar import RelLib import Date +import ImageSelect from DateEdit import DateEdit from gettext import gettext as _ @@ -73,6 +74,7 @@ class EventEditor: self.child_windows = {} self.trans = trans self.callback = cb + self.path = self.db.get_save_path() self.plist = [] self.pmap = {} @@ -137,6 +139,7 @@ class EventEditor: self.notes_label = self.top.get_widget("notesEvent") self.flowed = self.top.get_widget("eventflowed") self.preform = self.top.get_widget("eventpreform") + self.gallery_label = self.top.get_widget("galleryEvent") self.witnesses_label = self.top.get_widget("witnessesEvent") if GrampsCfg.calendar: @@ -188,6 +191,8 @@ class EventEditor: self.preform.set_active(1) else: self.flowed.set_active(1) + if event.get_media_list(): + Utils.bold_label(self.gallery_label) else: if def_event: self.name_field.set_text(def_event) @@ -195,12 +200,23 @@ class EventEditor: self.place_field.set_text(def_placename) self.date_check = DateEdit(self.date_field,self.top.get_widget("date_stat")) + if not event: + event = RelLib.Event() + self.icon_list = self.top.get_widget("iconlist") + self.gallery = ImageSelect.Gallery(event, self.db.commit_event, self.path, self.icon_list, + self.db,self,self.window) + self.top.signal_autoconnect({ "on_switch_page" : self.on_switch_page, "on_help_event_clicked" : self.on_help_clicked, "on_ok_event_clicked" : self.on_event_edit_ok_clicked, "on_cancel_event_clicked" : self.close, "on_event_edit_delete_event" : self.on_delete_event, + "on_addphoto_clicked" : self.gallery.on_add_media_clicked, + "on_selectphoto_clicked" : self.gallery.on_select_media_clicked, + "on_deletephoto_clicked" : self.gallery.on_delete_media_clicked, + "on_edit_properties_clicked": self.gallery.popup_change_description, + "on_editphoto_clicked" : self.gallery.on_edit_media_clicked, }) menu = gtk.Menu() @@ -222,10 +238,12 @@ class EventEditor: self.window.show() def on_delete_event(self,obj,b): + self.gallery.close(0) self.close_child_windows() self.remove_itself_from_menu() - def close(self,obj): + def close(self,obj,ok=0): + self.gallery.close(ok) self.close_child_windows() self.remove_itself_from_menu() self.window.destroy() @@ -318,7 +336,7 @@ class EventEditor: self.db.add_transaction(trans,_("Edit Event")) self.parent.redraw_event_list() self.callback(self.event) - self.close(obj) + self.close(obj,1) def update_event(self,name,date,place,desc,note,format,priv,cause,trans): if place: diff --git a/src/ImageSelect.py b/src/ImageSelect.py index 026db3cf0..ca02d2748 100644 --- a/src/ImageSelect.py +++ b/src/ImageSelect.py @@ -53,6 +53,7 @@ import RelImage import ListModel import SelectObject import GrampsMime +import Sources from QuestionDialog import ErrorDialog from gettext import gettext as _ @@ -167,9 +168,9 @@ class ImageSelect: already_imported = None - trans = self.db.start_transactions() + trans = self.db.start_transaction() for o_id in self.db.get_object_keys(): - o = self.db.try_to_find_object_from_id(o_id,trans) + o = self.db.try_to_find_object_from_id(o_id) if o.get_path() == filename: already_imported = o break @@ -276,7 +277,7 @@ class Gallery(ImageSelect): def on_drag_begin(self,obj,context): if const.dnd_images: id = self.sel_obj.get_reference_id() - obj = self.db.try_to_find_object_from_id(id,None) + obj = self.db.try_to_find_object_from_id(id) mtype = obj.get_mime_type() name = Utils.thumb_path(self.db.get_save_path(),obj) pix = gtk.gdk.pixbuf_new_from_file(name) @@ -362,7 +363,7 @@ class Gallery(ImageSelect): def savephoto(self, photo): """Save the photo in the dataobj object. (Required function)""" - self.db.add_object(photo) + self.db.add_object(photo,None) oref = RelLib.MediaRef() oref.set_reference_id(photo.get_id()) self.dataobj.add_media_reference(oref) @@ -370,7 +371,7 @@ class Gallery(ImageSelect): def add_thumbnail(self, photo): """Scale the image and add it to the IconList.""" oid = photo.get_reference_id() - object = self.db.try_to_find_object_from_id(oid,None) + object = self.db.try_to_find_object_from_id(oid) if self.canvas_list.has_key(oid): (grp,item,text,x,y) = self.canvas_list[oid] if x != self.cx or y != self.cy: @@ -465,7 +466,7 @@ class Gallery(ImageSelect): return min(index,len(self.dataobj.get_media_list())) def on_photolist_drag_data_received(self,w, context, x, y, data, info, time): - if data and data.format == 8: + if data and data.format == 8: icon_index = self.get_index(w,x,y) d = string.strip(string.replace(data.data,'\0',' ')) protocol,site,file, j,k,l = urlparse.urlparse(d) @@ -484,7 +485,8 @@ class Gallery(ImageSelect): photo.set_path(name) self.parent.lists_changed = 1 if GrampsCfg.globalprop: - GlobalMediaProperties(self.db,photo,None) + GlobalMediaProperties(self.db,photo,None, + self,self.parent_window) elif protocol != "": import urllib u = urllib.URLopener() @@ -499,7 +501,7 @@ class Gallery(ImageSelect): photo.set_mime_type(mime) photo.set_description(d) photo.set_path(tfile) - self.db.add_object(photo) + self.db.add_object(photo,None) oref = RelLib.MediaRef() oref.set_reference_id(photo.get_id()) self.dataobj.add_media_reference(oref) @@ -513,7 +515,8 @@ class Gallery(ImageSelect): self.add_thumbnail(oref) self.parent.lists_changed = 1 if GrampsCfg.globalprop: - GlobalMediaProperties(self.db,photo,None) + GlobalMediaProperties(self.db,photo,None, + self,self.parent_window) else: if self.db.has_object_id(data.data): icon_index = self.get_index(w,x,y) @@ -603,7 +606,7 @@ class Gallery(ImageSelect): menu = gtk.Menu() menu.set_title(_("Media Object")) - object = self.db.try_to_find_object_from_id(photo.get_reference_id(),None) + object = self.db.try_to_find_object_from_id(photo.get_reference_id()) mtype = object.get_mime_type() progname = GrampsMime.get_application(mtype) @@ -620,21 +623,20 @@ class Gallery(ImageSelect): def popup_view_photo(self, obj): """Open this picture in a picture viewer""" photo = obj.get_data('o') - Utils.view_photo(self.db.try_to_find_object_from_id(photo.get_reference_id(), - None)) + Utils.view_photo(self.db.try_to_find_object_from_id(photo.get_reference_id())) def popup_edit_photo(self, obj): """Open this picture in a picture editor""" photo = obj.get_data('o') if os.fork() == 0: - obj = self.db.try_to_find_object_from_id(photo.get_reference_id(),None) + obj = self.db.try_to_find_object_from_id(photo.get_reference_id()) os.execvp(const.editor,[const.editor, obj.get_path()]) def popup_convert_to_private(self, obj): """Copy this picture into gramps private database instead of leaving it as an external data object.""" photo = obj.get_data('o') - object = self.db.try_to_find_object_from_id(photo.get_reference_id(),None) + object = self.db.try_to_find_object_from_id(photo.get_reference_id()) name = RelImage.import_media_object(object.get_path(),self.path, object.get_id()) object.set_path(name) @@ -665,8 +667,7 @@ class LocalMediaProperties: self.child_windows = {} self.photo = photo self.db = parent.db - self.object = self.db.try_to_find_object_from_id(photo.get_reference_id(), - None) + self.object = self.db.try_to_find_object_from_id(photo.get_reference_id()) self.alist = photo.get_attribute_list()[:] self.lists_changed = 0 @@ -674,7 +675,8 @@ class LocalMediaProperties: self.change_dialog = gtk.glade.XML(const.imageselFile,"change_description","gramps") title = _('Media Reference Editor') - Utils.set_titles(self.change_dialog.get_widget('change_description'), + self.window = self.change_dialog.get_widget('change_description') + Utils.set_titles(self.window, self.change_dialog.get_widget('title'), title) descr_window = self.change_dialog.get_widget("description") @@ -695,6 +697,20 @@ class LocalMediaProperties: self.on_attr_list_select_row, self.on_update_attr_clicked) + self.slist = self.change_dialog.get_widget("src_slist") + self.sources_label = self.change_dialog.get_widget("source_label") + if self.object: + self.srcreflist = self.photo.get_source_references() + else: + self.srcreflist = [] + + self.sourcetab = Sources.SourceTab(self.srcreflist,self, + self.change_dialog, + self.window, self.slist, + self.change_dialog.get_widget('add_src'), + self.change_dialog.get_widget('edit_src'), + self.change_dialog.get_widget('del_src')) + descr_window.set_text(self.object.get_description()) mtype = self.object.get_mime_type() @@ -730,7 +746,6 @@ class LocalMediaProperties: "on_local_delete_event" : self.on_delete_event, }) self.redraw_attr_list() - self.window = self.change_dialog.get_widget('change_description') if parent_window: self.window.set_transient_for(parent_window) self.add_itself_to_menu() @@ -864,7 +879,17 @@ class LocalMediaProperties: #------------------------------------------------------------------------- class GlobalMediaProperties: - def __init__(self,db,object,update): + def __init__(self,db,object,update,parent,parent_window=None): + self.parent = parent + if object: + if self.parent.parent.child_windows.has_key(object.get_id()): + self.parent.parent.child_windows[object.get_id()].present(None) + return + else: + self.win_key = object.get_id() + else: + self.win_key = self + self.child_windows = {} self.object = object self.alist = self.object.get_attribute_list()[:] self.lists_changed = 0 @@ -875,9 +900,10 @@ class GlobalMediaProperties: self.path = self.db.get_save_path() self.change_dialog = gtk.glade.XML(const.imageselFile,"change_global","gramps") - title = _('Change global media object properties') + title = _('Media Properties Editor') - Utils.set_titles(self.change_dialog.get_widget('change_global'), + self.window = self.change_dialog.get_widget('change_global') + Utils.set_titles(self.window, self.change_dialog.get_widget('title'),title) self.descr_window = self.change_dialog.get_widget("description") @@ -901,6 +927,20 @@ class GlobalMediaProperties: self.on_attr_list_select_row, self.on_update_attr_clicked) + self.slist = self.change_dialog.get_widget("src_list") + self.sources_label = self.change_dialog.get_widget("sourcesGlobal") + if self.object: + self.srcreflist = self.object.get_source_references() + else: + self.srcreflist = [] + + self.sourcetab = Sources.SourceTab(self.srcreflist,self, + self.change_dialog, + self.window, self.slist, + self.change_dialog.get_widget('gl_add_src'), + self.change_dialog.get_widget('gl_edit_src'), + self.change_dialog.get_widget('gl_del_src')) + self.descr_window.set_text(self.object.get_description()) mtype = self.object.get_mime_type() pb = gtk.gdk.pixbuf_new_from_file(Utils.thumb_path(self.path,self.object)) @@ -921,7 +961,7 @@ class GlobalMediaProperties: self.flowed.set_active(1) self.change_dialog.signal_autoconnect({ - "on_cancel_clicked" : Utils.destroy_passed_object, + "on_cancel_clicked" : self.close, "on_up_clicked" : self.on_up_clicked, "on_down_clicked" : self.on_down_clicked, "on_ok_clicked" : self.on_ok_clicked, @@ -930,11 +970,52 @@ class GlobalMediaProperties: "on_notebook_switch_page": self.on_notebook_switch_page, "on_delete_attr_clicked" : self.on_delete_attr_clicked, "on_update_attr_clicked" : self.on_update_attr_clicked, - "on_help_clicked" : self.on_help_clicked, + "on_help_clicked" : self.on_help_clicked, + "on_global_delete_event" : self.on_delete_event, }) self.redraw_attr_list() self.display_refs() + if parent_window: + self.window.set_transient_for(parent_window) + self.add_itself_to_menu() + self.window.show() + + def on_delete_event(self,obj,b): + self.close_child_windows() + self.remove_itself_from_menu() + + def close(self,obj): + self.close_child_windows() + self.remove_itself_from_menu() + self.window.destroy() + + def close_child_windows(self): + for child_window in self.child_windows.values(): + child_window.close(None) + self.child_windows = {} + + def add_itself_to_menu(self): + self.parent.parent.child_windows[self.win_key] = self + label = _('Media Object') + self.parent_menu_item = gtk.MenuItem(label) + self.parent_menu_item.set_submenu(gtk.Menu()) + self.parent_menu_item.show() + self.parent.parent.winsmenu.append(self.parent_menu_item) + self.winsmenu = self.parent_menu_item.get_submenu() + self.menu_item = gtk.MenuItem(_('Properties Editor')) + self.menu_item.connect("activate",self.present) + self.menu_item.show() + self.winsmenu.append(self.menu_item) + + def remove_itself_from_menu(self): + del self.parent.parent.child_windows[self.win_key] + self.menu_item.destroy() + self.winsmenu.destroy() + self.parent_menu_item.destroy() + + def present(self,obj): + self.window.present() def on_up_clicked(self,obj): store,iter = self.atree.get_selected() @@ -1119,7 +1200,7 @@ class DeleteMediaQuery: self.db.commit_family(p,trans) for key in self.db.get_source_keys(): - sid = self.db.try_to_find_source_from_id(key,trans) + sid = self.db.try_to_find_source_from_id(key) nl = [] change = 0 for photo in p.get_media_list(): diff --git a/src/MediaView.py b/src/MediaView.py index df203fce9..e9d6d97a7 100644 --- a/src/MediaView.py +++ b/src/MediaView.py @@ -84,6 +84,7 @@ class MediaView: self.mpath = glade.get_widget("mpath") self.mdetails = glade.get_widget("mdetails") self.preview = glade.get_widget("preview") + self.topWindow = glade.get_widget("gramps") self.renderer = gtk.CellRendererText() if const.nosort_tree: @@ -225,7 +226,7 @@ class MediaView: store,iter = self.selection.get_selected() if iter: id = store.get_value(iter,1) - object = self.db.try_to_find_object_from_id(id,None) + object = self.db.try_to_find_object_from_id(id) self.obj = object mime_type = object.get_mime_type() @@ -273,7 +274,8 @@ class MediaView: self.load_media() def popup_change_description(self, obj): - ImageSelect.GlobalMediaProperties(self.db,self.obj,self.load_media) + ImageSelect.GlobalMediaProperties(self.db,self.obj,self.load_media, + self,self.topWindow) def load_media(self): pass @@ -290,8 +292,9 @@ class MediaView: list_store, iter = self.selection.get_selected() if iter: id = list_store.get_value(iter,1) - object = self.db.try_to_find_object_from_id(id,None) - ImageSelect.GlobalMediaProperties(self.db,object,self.load_media) + object = self.db.try_to_find_object_from_id(id) + ImageSelect.GlobalMediaProperties(self.db,object,self.load_media, + self,self.topWindow) def on_delete_clicked(self,obj): store,iter = self.selection.get_selected() @@ -299,7 +302,7 @@ class MediaView: return id = store.get_value(iter,1) - mobj = self.db.try_to_find_object_from_id(id,None) + mobj = self.db.try_to_find_object_from_id(id) if self.is_object_used(mobj): ans = ImageSelect.DeleteMediaQuery(mobj,self.db,self.build_tree) QuestionDialog(_('Delete Media Object?'), @@ -343,7 +346,7 @@ class MediaView: if not iter: return if (const.dnd_images): - object = self.db.try_to_find_object_from_id(store.get_value(iter,1),None) + object = self.db.try_to_find_object_from_id(store.get_value(iter,1)) mtype = object.get_mime_type() name = Utils.thumb_path(self.db.get_save_path(),object) pix = gtk.gdk.pixbuf_new_from_file(name) @@ -387,7 +390,8 @@ class MediaView: self.db.add_transaction(trans,_("Add Media Object")) if GrampsCfg.globalprop: - ImageSelect.GlobalMediaProperties(self.db,photo,self.load_media) + ImageSelect.GlobalMediaProperties(self.db,photo,self.load_media, + self,self.topWindow) elif protocol != "": import urllib u = urllib.URLopener() @@ -419,6 +423,7 @@ class MediaView: self.db.add_transaction(trans,_("Add Media Object")) if GrampsCfg.globalprop: - ImageSelect.GlobalMediaProperties(self.db,photo,None) + ImageSelect.GlobalMediaProperties(self.db,photo,None, + self,self.topWindow) diff --git a/src/ReadXML.py b/src/ReadXML.py index dc1ec5613..be7b038e2 100644 --- a/src/ReadXML.py +++ b/src/ReadXML.py @@ -641,20 +641,24 @@ class GrampsParser: self.photo.add_source_reference(self.source_ref) elif self.ord: self.ord.add_source_reference(self.source_ref) + elif self.attribute: + self.attribute.add_source_reference(self.source_ref) elif self.object: self.object.add_source_reference(self.source_ref) + elif self.objref: + self.objref.add_source_reference(self.source_ref) elif self.event: self.event.add_source_reference(self.source_ref) elif self.address: self.address.add_source_reference(self.source_ref) elif self.name: self.name.add_source_reference(self.source_ref) - elif self.attribute: - self.attribute.add_source_reference(self.source_ref) elif self.placeobj: self.placeobj.add_source_reference(self.source_ref) elif self.family: self.family.add_source_reference(self.source_ref) + elif self.person: + self.person.add_source_reference(self.source_ref) def start_source(self,attrs): self.source = self.db.find_source_no_conflicts(attrs["id"], @@ -667,7 +671,9 @@ class GrampsParser: self.objref.set_reference_id(id) if attrs.has_key('priv'): self.objref.set_privacy(int(attrs['priv'])) - if self.family: + if self.event: + self.event.add_media_reference(self.objref) + elif self.family: self.family.add_media_reference(self.objref) elif self.source: self.source.add_media_reference(self.objref) diff --git a/src/RelLib.py b/src/RelLib.py index 00c9e782e..b907bdb29 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -716,9 +716,12 @@ class MediaObject(SourceNote): # MediaRef # #------------------------------------------------------------------------- -class MediaRef: - """Object reference class""" +class MediaRef(SourceNote): + """Media reference class""" def __init__(self,source=None): + + SourceNote.__init__(self,source) + self.attrlist = [] if source: self.private = source.private @@ -745,43 +748,6 @@ class MediaRef: def get_reference_id(self): return self.ref - def set_note(self,text): - """Set the note to the given text""" - if self.note == None: - self.note = Note() - self.note.set(text) - - def get_note(self): - """Return the current note""" - if self.note == None: - return "" - else: - return self.note.get() - - def set_note_format(self,val): - """Set the note's format to the given value""" - if self.note: - self.note.set_format(val) - - def get_note_format(self): - """Return the current note's format""" - if self.note == None: - return 0 - else: - return self.note.get_format() - - def set_note_object(self,obj): - """Change the note object instance to obj""" - self.note = obj - - def get_note_object(self): - """Return in note instance, not just the text""" - return self.note - - def unique_note(self): - """Creates a unique instance of the current note""" - self.note = Note(self.note.get()) - def add_attribute(self,attr): """Adds a propery to the MediaObject object. This is not used by gramps, but provides a means for XML users to attach other properties to @@ -1684,6 +1650,7 @@ class Event(DataObj): self.name = source.name self.cause = source.cause self.id = source.id + self.media_list = [MediaRef(media_id) for media_id in source.media_list] try: if source.witness: self.witness = source.witness[:] @@ -1699,6 +1666,7 @@ class Event(DataObj): self.cause = "" self.witness = None self.id = None + self.media_list = [] def clone(self,source): self.place = source.place @@ -1710,6 +1678,7 @@ class Event(DataObj): self.private = source.private self.source_list = source.source_list[:] self.note = source.note + self.media_list = [MediaRef(media_id) for media_id in source.media_list] try: if source.witness: self.witness = source.witness[:] @@ -1728,6 +1697,18 @@ class Event(DataObj): self.place, self.cause, self.private, self.source_list, self.note, self.witness) = data + def add_media_reference(self,media_id): + """Adds a Photo object to the Event object's image list""" + self.media_list.append(media_id) + + def get_media_list(self): + """Returns the list of Photo objects""" + return self.media_list + + def set_media_list(self,mlist): + """Sets the list of Photo objects""" + self.media_list = mlist + def set_id(self,gid): """Sets the gramps ID for the place object""" self.id = gid @@ -2883,6 +2864,16 @@ class GrampsDB: # map[event.get_name()] = 1 return map.keys() + def get_media_attribute_types(self): + """returns a list of all Attribute types assocated with Media + instances in the database""" + map = {} +# for media_id in self.media_map.keys(): +# mobject = self.find_object_from_id(media_id) +# for attr in mobject.get_attribute_list(): +# map[attr.get_type()] = 1 + return map.keys() + def get_place_ids(self): """returns a list of Place instances""" return self.place_map.keys() diff --git a/src/SelectObject.py b/src/SelectObject.py index 07ce20bde..da1ba48fd 100644 --- a/src/SelectObject.py +++ b/src/SelectObject.py @@ -100,7 +100,7 @@ class SelectObject: self.object_model.new_model() for key in self.db.get_object_keys(): - object = self.db.try_to_find_object_from_id(key,None) + object = self.db.try_to_find_object_from_id(key) title = object.get_description() the_id = object.get_id() the_type = Utils.get_mime_description(object.get_mime_type()) @@ -117,7 +117,7 @@ class SelectObject: return data = self.object_model.get_data(iter,range(self.ncols)) the_id = data[4] - object = self.db.try_to_find_object_from_id(the_id,None) + object = self.db.try_to_find_object_from_id(the_id) the_type = Utils.get_mime_description(object.get_mime_type()) path = object.get_path() @@ -150,7 +150,7 @@ class SelectObject: if iter: data = self.object_model.get_data(iter,range(self.ncols)) the_id = data[4] - return_value = self.db.try_to_find_object_from_id(the_id,None) + return_value = self.db.try_to_find_object_from_id(the_id) else: return_value = None self.top.destroy() diff --git a/src/WriteXML.py b/src/WriteXML.py index 56386776a..d5687159f 100644 --- a/src/WriteXML.py +++ b/src/WriteXML.py @@ -467,6 +467,7 @@ class XmlWriter: for s in event.get_source_references(): self.dump_source_ref(s,index+1) + self.write_media_list(event.get_media_list(),index+1) self.g.write("%s\n" % sp) def dump_ordinance(self,name,ord,index=1): @@ -689,11 +690,15 @@ class XmlWriter: if photo.get_privacy(): self.g.write(' priv="1"') proplist = photo.get_attribute_list() - if len(proplist) == 0 and photo.get_note() == "": + refslist = photo.get_source_references() + if len(proplist) == 0 and len(refslist) == 0 \ + and photo.get_note() == "": self.g.write("/>\n") else: self.g.write(">\n") self.write_attribute_list(proplist,indent+1) + for ref in refslist: + self.dump_source_ref(ref,indent+1) self.write_note("note",photo.get_note_object(),indent+1) self.g.write('%s\n' % sp) diff --git a/src/gramps.glade b/src/gramps.glade index d3f126edb..0dfc17c5c 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -24523,6 +24523,157 @@ tab + + + + True + False + 0 + + + + 6 + True + False + 6 + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + True + True + + + + + + True + False + 6 + + + + True + True + True + _Add... + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + True + True + _Edit... + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + True + True + True + _Delete + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + + + + 0 + False + True + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_SPREAD + 30 + + + 0 + False + True + + + + + False + True + + + + + + True + Sources + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + 10 @@ -24558,6 +24709,7 @@ GDK_WINDOW_TYPE_HINT_DIALOG GDK_GRAVITY_NORTH_WEST False + @@ -25453,6 +25605,157 @@ tab + + + + True + False + 0 + + + + 6 + True + False + 6 + + + + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + + + + + 0 + True + True + + + + + + True + False + 6 + + + + True + True + True + _Add... + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + True + True + _Edit... + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + True + True + True + _Delete + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + + + + 0 + False + True + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_SPREAD + 30 + + + 0 + False + True + + + + + False + True + + + + + + True + Sources + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + 0 @@ -27631,6 +27934,181 @@ tab + + + + True + False + 0 + + + + 6 + True + False + 6 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + False + 0 + 0 + 100 + 100 + 1 + + + + + 0 + True + True + + + + + + True + False + 6 + + + + True + Add a new media object to the database and place it in this gallery + True + True + _Add from file... + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + True + Select an existing media object from the database and place it in this gallery + True + True + Add from _database... + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + True + Edit the properties of the selected object + True + _Edit... + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + + True + Remove selected object from this gallery only + True + True + _Remove + True + GTK_RELIEF_NORMAL + True + + + + 0 + False + False + + + + + 0 + False + True + + + + + 0 + True + True + + + + + + True + GTK_BUTTONBOX_SPREAD + 30 + + + 0 + False + True + + + + + False + True + + + + + + True + Gallery + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + + + tab + + 0