diff --git a/gramps/src/GrampsParser.py b/gramps/src/GrampsParser.py index 598ab76e5..dc53c3864 100644 --- a/gramps/src/GrampsParser.py +++ b/gramps/src/GrampsParser.py @@ -85,7 +85,6 @@ class GrampsParser(handler.ContentHandler): self.pref = None self.use_p = 0 self.in_note = 0 - self.in_old_attr = 0 self.in_stext = 0 self.in_scomments = 0 self.db = database @@ -231,10 +230,9 @@ class GrampsParser(handler.ContentHandler): if attrs.has_key("priv"): self.attribute.privacy = int(attrs["priv"]) if attrs.has_key('type'): - self.in_old_attr = 1 self.attribute.setType(u2l(attrs["type"])) - else: - self.in_old_attr = 0 + if attrs.has_key('value'): + self.attribute.setValue(u2l(attrs["value"])) if self.photo: self.photo.addAttribute(self.attribute) elif self.object: @@ -540,9 +538,6 @@ class GrampsParser(handler.ContentHandler): # #--------------------------------------------------------------------- def stop_attribute(self,tag): - if self.in_old_attr: - self.attribute.setValue(u2l(tag)) - self.in_old_attr = 0 self.attribute = None #--------------------------------------------------------------------- @@ -857,14 +852,14 @@ class GrampsParser(handler.ContentHandler): if self.address: self.address.setNote(note) + elif self.attribute: + self.attribute.setNote(note) elif self.object: self.object.setNote(note) elif self.objref: self.objref.setNote(note) elif self.photo: self.photo.setNote(note) - elif self.attribute: - self.attribute.setNote(note) elif self.name: self.name.setNote(note) elif self.source: diff --git a/gramps/src/ImageSelect.py b/gramps/src/ImageSelect.py index 474789879..90912b326 100644 --- a/gramps/src/ImageSelect.py +++ b/gramps/src/ImageSelect.py @@ -417,8 +417,6 @@ class LocalMediaProperties: self.change_dialog.get_widget("path").set_text(fname) self.change_dialog.get_widget("type").set_text(utils.get_mime_description(mtype)) self.change_dialog.get_widget("notes").insert_defaults(photo.getNote()) - window.set_data("p",photo) - window.set_data("t",self.change_dialog) self.change_dialog.signal_autoconnect({ "on_cancel_clicked" : utils.destroy_passed_object, "on_ok_clicked" : self.on_ok_clicked, @@ -472,6 +470,92 @@ class LocalMediaProperties: import AttrEdit AttrEdit.AttributeEditor(self,None,"Media Object",[]) +class GlobalMediaProperties: + + def __init__(self,object,path): + self.object = object + self.alist = self.object.getAttributeList()[:] + self.lists_changed = 0 + + fname = self.object.getPath() + self.change_dialog = libglade.GladeXML(const.imageselFile,"change_global") + window = self.change_dialog.get_widget("change_global") + descr_window = self.change_dialog.get_widget("description") + pixmap = self.change_dialog.get_widget("pixmap") + self.attr_type = self.change_dialog.get_widget("attr_type") + self.attr_value = self.change_dialog.get_widget("attr_value") + self.attr_details = self.change_dialog.get_widget("attr_details") + self.attr_list = self.change_dialog.get_widget("attr_list") + + descr_window.set_text(self.object.getDescription()) + mtype = self.object.getMimeType() + if mtype[0:5] == "image": + thumb = "%s/.thumb/%s" % (path,self.object.getId()) + RelImage.check_thumb(fname,thumb,const.thumbScale) + pixmap.load_file(thumb) + else: + pixmap.load_file(utils.find_icon(mtype)) + + self.change_dialog.get_widget("gid").set_text(self.object.getId()) + + if self.object.getLocal(): + self.change_dialog.get_widget("path").set_text("") + else: + self.change_dialog.get_widget("path").set_text(fname) + self.change_dialog.get_widget("type").set_text(utils.get_mime_description(mtype)) + self.change_dialog.get_widget("notes").insert_defaults(object.getNote()) + self.change_dialog.signal_autoconnect({ + "on_cancel_clicked" : utils.destroy_passed_object, + "on_ok_clicked" : self.on_ok_clicked, + "on_apply_clicked" : self.on_apply_clicked, + "on_attr_list_select_row" : self.on_attr_list_select_row, + "on_add_attr_clicked": self.on_add_attr_clicked, + "on_delete_attr_clicked" : self.on_delete_attr_clicked, + "on_update_attr_clicked" : self.on_update_attr_clicked, + }) + self.redraw_attr_list() + + def redraw_attr_list(self): + utils.redraw_list(self.alist,self.attr_list,disp_attr) + + def on_apply_clicked(self, obj): + text = self.change_dialog.get_widget("notes").get_chars(0,-1) + desc = self.change_dialog.get_widget("description").get_text() + note = self.object.getNote() + if text != note or desc != self.object.getDescription(): + self.object.setNote(text) + utils.modified() + if self.lists_changed: + self.object.setAttributeList(self.alist) + utils.modified() + + def on_ok_clicked(self, obj): + self.on_apply_clicked(obj) + utils.destroy_passed_object(obj) + + def on_attr_list_select_row(self,obj,row,b,c): + attr = obj.get_row_data(row) + + self.attr_type.set_label(attr.getType()) + self.attr_value.set_text(attr.getValue()) + self.attr_details.set_text(utils.get_detail_text(attr)) + + def on_update_attr_clicked(self,obj): + import AttrEdit + if len(obj.selection) > 0: + row = obj.selection[0] + attr = obj.get_row_data(row) + AttrEdit.AttributeEditor(self,attr,"Media Object",[]) + + def on_delete_attr_clicked(self,obj): + if utils.delete_selected(obj,self.alist): + self.lists_changed = 1 + self.redraw_attr_list() + + def on_add_attr_clicked(self,obj): + import AttrEdit + AttrEdit.AttributeEditor(self,None,"Media Object",[]) + #------------------------------------------------------------------------- # # diff --git a/gramps/src/RelLib.py b/gramps/src/RelLib.py index d5af514cc..2d5313128 100644 --- a/gramps/src/RelLib.py +++ b/gramps/src/RelLib.py @@ -407,6 +407,9 @@ class Photo(SourceNote): """returns the property list associated with the image""" return self.attrlist + def setAttributeList(self,list): + self.attrlist = list + class ObjectRef: def __init__(self,source=None): diff --git a/gramps/src/WriteXML.py b/gramps/src/WriteXML.py index c6ab8e550..8c8437a21 100644 --- a/gramps/src/WriteXML.py +++ b/gramps/src/WriteXML.py @@ -280,6 +280,7 @@ def write_attribute_list(g, list, indent=3): if note == "" and len(slist) == 0: g.write('/>\n') else: + g.write('>\n') for s in attr.getSourceRefList(): dump_source_ref(g,s,indent+1) write_note(g,"note",attr.getNote(),4) diff --git a/gramps/src/gramps.glade b/gramps/src/gramps.glade index 0bbc5a4f9..273055ccb 100644 --- a/gramps/src/gramps.glade +++ b/gramps/src/gramps.glade @@ -3113,6 +3113,11 @@ button143 True True + + clicked + on_edit_media_clicked + Sun, 14 Oct 2001 21:50:44 GMT + GTK_RELIEF_NORMAL @@ -3120,8 +3125,14 @@ GtkButton button144 + False True True + + clicked + on_delete_media_clicked + Sun, 14 Oct 2001 21:50:57 GMT + GTK_RELIEF_NORMAL diff --git a/gramps/src/gramps_main.py b/gramps/src/gramps_main.py index aece425ae..eea56dbcb 100755 --- a/gramps/src/gramps_main.py +++ b/gramps/src/gramps_main.py @@ -69,6 +69,7 @@ import Marriage import Find import VersionControl import RelImage +import ImageSelect #------------------------------------------------------------------------- # @@ -3522,6 +3523,7 @@ def main(arg): "on_edit_active_person" : load_active_person, "on_edit_bookmarks_activate" : on_edit_bookmarks_activate, "on_edit_father_clicked" : on_edit_father_clicked, + "on_edit_media_clicked" : on_edit_media_clicked, "on_edit_mother_clicked" : on_edit_mother_clicked, "on_edit_place_clicked" : on_edit_place_clicked, "on_edit_source_clicked" : on_edit_source_clicked, @@ -3663,6 +3665,12 @@ def on_name_changed(obj): else: glade.get_widget("image").load_file(utils.find_icon(type)) +def on_edit_media_clicked(obj): + if len(media_list.selection) <= 0: + return + object = media_list.get_row_data(media_list.selection[0]) + ImageSelect.GlobalMediaProperties(object,database.getSavePath()) + def on_media_list_drag_data_received(w, context, x, y, data, info, time): if data and data.format == 8: d = string.strip(string.replace(data.data,'\0',' ')) diff --git a/gramps/src/imagesel.glade b/gramps/src/imagesel.glade index dc03f2007..8a4da166b 100644 --- a/gramps/src/imagesel.glade +++ b/gramps/src/imagesel.glade @@ -1232,7 +1232,7 @@ Gramps - Change Global Medial Object Properties GTK_WINDOW_TOPLEVEL GTK_WIN_POS_NONE - True + False False True False @@ -1277,7 +1277,7 @@ clicked on_ok_clicked - change_description + change_global Thu, 19 Apr 2001 00:00:19 GMT GNOME_STOCK_BUTTON_OK @@ -1305,7 +1305,7 @@ clicked on_cancel_clicked - change_description + change_global Thu, 19 Apr 2001 00:00:43 GMT GNOME_STOCK_BUTTON_CANCEL @@ -1379,29 +1379,278 @@ False 0 - 0 + 10 True True - - Placeholder - - GnomePixmap - pixmap1 + pixmap 100 100 - 0 + 10 False True - Placeholder + GtkFrame + frame5 + + 0 + GTK_SHADOW_ETCHED_IN + + 0 + True + True + + + + GtkTable + table6 + 3 + 4 + False + 0 + 0 + + + GtkLabel + label154 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 5 + + 0 + 1 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label155 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 0 + 1 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + gid + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 4 + 0 + 1 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + label150 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 5 + + 0 + 1 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label151 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 1 + 2 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + path + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 4 + 1 + 2 + 0 + 0 + True + False + False + False + True + False + + + + + GtkLabel + label156 + + GTK_JUSTIFY_CENTER + False + 1 + 0.5 + 5 + 5 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + label157 + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + + + GtkLabel + type + + GTK_JUSTIFY_CENTER + False + 0 + 0.5 + 0 + 0 + + 2 + 4 + 2 + 3 + 0 + 0 + False + False + False + False + True + False + + + @@ -1410,19 +1659,16 @@ hseparator12 10 - False + True True - GtkTable - table4 - 4 - 4 + GtkHBox + hbox4 False - 0 - 0 + 0 0 True @@ -1440,18 +1686,9 @@ 5 5 - 0 - 1 - 1 - 2 - 0 - 0 - False - False - False - False - True - False + 0 + False + False @@ -1466,274 +1703,9 @@ 0 0 - 1 - 2 - 1 - 2 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label150 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 5 - - 0 - 1 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label151 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 2 - 3 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label153 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 2 - 3 - 2 - 3 - 5 - 5 - True - False - False - False - True - False - - - - - GtkButton - button92 - True - - GTK_RELIEF_NORMAL - - 3 - 4 - 2 - 3 - 5 - 5 - False - False - False - False - True - False - - - - - GtkLabel - label154 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 5 - - 0 - 1 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label155 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 0 - 1 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label156 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 5 - - 0 - 1 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label157 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 1 - 2 - 3 - 4 - 0 - 0 - False - False - False - False - True - False - - - - - GtkLabel - label158 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 2 - 4 - 3 - 4 - 5 - 5 - False - False - False - False - True - False - - - - - GtkLabel - label159 - - GTK_JUSTIFY_CENTER - False - 0 - 0.5 - 0 - 0 - - 2 - 4 - 0 - 1 - 5 - 5 - True - False - False - False - True - False + 0 + False + False @@ -1746,18 +1718,73 @@ 0 - 2 - 4 - 1 - 2 - 5 - 5 - True - False - False - False - True - False + 2 + True + True + + + + + + GtkHBox + hbox5 + False + 0 + + 0 + False + False + + + + GtkLabel + label172 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + True + True + + + + + GtkButton + button92 + True + + clicked + on_make_local_clicked + Mon, 15 Oct 2001 00:44:21 GMT + + + GTK_RELIEF_NORMAL + + 5 + False + False + + + + + GtkLabel + label173 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + True + True @@ -1784,7 +1811,7 @@ GtkFrame - frame3 + attr_type 5 0 @@ -1832,7 +1859,7 @@ GtkLabel - label162 + attr_value GTK_JUSTIFY_CENTER False @@ -1884,7 +1911,7 @@ GtkLabel - label164 + attr_details GTK_JUSTIFY_LEFT False @@ -1979,7 +2006,8 @@ GtkCList - clist2 + attr_list + 100 True select_row @@ -2121,7 +2149,7 @@ GtkText - text2 + notes True False