diff --git a/gramps/src/EditPerson.py b/gramps/src/EditPerson.py index 43ae55ef9..b50b7b941 100644 --- a/gramps/src/EditPerson.py +++ b/gramps/src/EditPerson.py @@ -280,9 +280,9 @@ class EditPerson: self.get_widget("user_colon").hide() self.get_widget("user_data").hide() - self.lds_baptism = self.person.getLdsBaptism() - self.lds_endowment = self.person.getLdsEndowment() - self.lds_sealing = self.person.getLdsSeal() + self.lds_baptism = LdsOrd(self.person.getLdsBaptism()) + self.lds_endowment = LdsOrd(self.person.getLdsEndowment()) + self.lds_sealing = LdsOrd(self.person.getLdsSeal()) if GrampsCfg.uselds or self.lds_baptism or self.lds_endowment or self.lds_sealing: self.get_widget("lds_tab").show() @@ -382,23 +382,22 @@ class EditPerson: self.ldssealplace = self.get_widget("lds_seal_place") self.ldsendowplace = self.get_widget("lds_end_place") - self.bstat = self.lds_field(self.person.getLdsBaptism(), + self.bstat = self.lds_field(self.lds_baptism, self.ldsbap_temple, self.ldsbap_date, self.ldsbapplace) - self.estat = self.lds_field(self.person.getLdsEndowment(), + self.estat = self.lds_field(self.lds_endowment, self.ldsend_temple, self.ldsend_date, self.ldsendowplace) - ord = self.person.getLdsSeal() - self.seal_stat = self.lds_field(self.person.getLdsSeal(), + self.seal_stat = self.lds_field(self.lds_sealing, self.ldsseal_temple, self.ldsseal_date, self.ldssealplace) - if ord: - self.ldsfam = ord.getFamily() + if self.lds_sealing: + self.ldsfam = self.lds_sealing.getFamily() else: self.ldsfam = None @@ -834,75 +833,43 @@ class EditPerson: if text != self.person.getNote() or self.lists_changed: changed = 1 + if self.lds_not_loaded == 0: + if not self.lds_baptism.are_equal(self.person.getLdsBaptism()): + changed= 1 + + if not self.lds_endowment.are_equal(self.person.getLdsEndowment()): + changed = 1 + + if not self.lds_sealing.are_equal(self.person.getLdsSeal()): + changed = 1 + return changed def check_lds(self): - date = self.ldsbap_date.get_text() + self.lds_baptism.setDate(self.ldsbap_date.get_text()) temple = self.ldsbap_temple.entry.get_text() - place = self.get_place(self.ldsbapplace) - if const.lds_temple_codes.has_key(temple): - temple = const.lds_temple_codes[temple] + self.lds_baptism.setTemple(const.lds_temple_codes[temple]) else: - temple = "" - ord = self.person.getLdsBaptism() + self.lds_baptism.setTemple("") + self.lds_baptism.setPlace(self.get_place(self.ldsbapplace,1)) - if not ord: - if date or temple or place or self.bstat: - return 1 - else: - d = Date() - d.set(date) - if compare_dates(d,ord.getDateObj()) != 0 or \ - ord.getPlace() != place or \ - ord.getStatus() != self.bstat or \ - ord.getTemple() != temple: - return 1 - - date = self.ldsend_date.get_text() + self.lds_endowment.setDate(self.ldsend_date.get_text()) temple = self.ldsend_temple.entry.get_text() - place = self.get_place(self.ldsendowplace) - if const.lds_temple_codes.has_key(temple): - temple = const.lds_temple_codes[temple] + self.lds_endowment.setTemple(const.lds_temple_codes[temple]) else: - temple = "" - ord = self.person.getLdsEndowment() + self.lds_endowment.setTemple("") + self.lds_endowment.setPlace(self.get_place(self.ldsendowplace,1)) - if not ord: - if date or temple or place or self.estat: - return 1 - else: - d = Date() - d.set(date) - if compare_dates(d,ord.getDateObj()) != 0 or \ - ord.getPlace() != place or \ - ord.getStatus() != self.estat or \ - ord.getTemple() != temple: - return 1 - - date = self.ldsseal_date.get_text() + self.lds_sealing.setDate(self.ldsseal_date.get_text()) temple = self.ldsseal_temple.entry.get_text() - place = self.get_place(self.ldssealplace) if const.lds_temple_codes.has_key(temple): - temple = const.lds_temple_codes[temple] + self.lds_sealing.setTemple(const.lds_temple_codes[temple]) else: - temple = "" - - ord = self.person.getLdsSeal() - if not ord: - if date or temple or self.ldsfam or self.seal_stat: - return 1 - else: - d = Date() - d.set(date) - if compare_dates(d,ord.getDateObj()) != 0 or \ - ord.getPlace() != place or \ - ord.getTemple() != temple or \ - ord.getStatus() != self.seal_stat or \ - ord.getFamily() != self.ldsfam: - return 1 - return 0 + self.lds_sealing.setTemple("") + self.lds_sealing.setFamily(self.ldsfam) + self.lds_sealing.setPlace(self.get_place(self.ldssealplace,1)) def on_event_delete_clicked(self,obj): """Delete the selected event""" @@ -1170,6 +1137,8 @@ class EditPerson: if title != name.getTitle(): name.setTitle(title) + name.setSourceRefList(self.pname.getSourceRefList()) + if not name.are_equal(self.person.getPrimaryName()): self.person.setPrimaryName(name) Utils.modified() @@ -1258,63 +1227,21 @@ class EditPerson: Utils.modified() if self.lds_not_loaded == 0: - date = self.ldsbap_date.get_text() - temple = self.ldsbap_temple.entry.get_text() - if const.lds_temple_codes.has_key(temple): - temple = const.lds_temple_codes[temple] - else: - temple = "" - ord = self.person.getLdsBaptism() - place = self.get_place(self.ldsbapplace,1) - update_ord(self.person.setLdsBaptism,ord,date, - temple,self.bstat,place) + self.check_lds() + ord = LdsOrd(self.person.getLdsBaptism()) + if not self.lds_baptism.are_equal(ord): + self.person.setLdsBaptism(self.lds_baptism) + Utils.modified() - date = self.ldsend_date.get_text() - temple = self.ldsend_temple.entry.get_text() - if const.lds_temple_codes.has_key(temple): - temple = const.lds_temple_codes[temple] - else: - temple = "" - ord = self.person.getLdsEndowment() - place = self.get_place(self.ldsendowplace,1) - update_ord(self.person.setLdsEndowment,ord,date, - temple,self.estat,place) + ord = LdsOrd(self.person.getLdsEndowment()) + if not self.lds_endowment.are_equal(ord): + self.person.setLdsEndowment(self.lds_endowment) + Utils.modified() - date = self.ldsseal_date.get_text() - temple = self.ldsseal_temple.entry.get_text() - if const.lds_temple_codes.has_key(temple): - temple = const.lds_temple_codes[temple] - else: - temple = "" - ord = self.person.getLdsSeal() - place = self.get_place(self.ldssealplace,1) - if not ord: - if self.ldsfam or date or temple: - ord = LdsOrd() - ord.setDate(date) - ord.setTemple(temple) - ord.setFamily(self.ldsfam) - ord.setPlace(place) - self.person.setLdsSeal(ord) - Utils.modified() - else: - d = Date() - d.set(date) - if compare_dates(d,ord.getDateObj()) != 0: - ord.setDateObj(d) - Utils.modified() - if ord.getPlace() != place: - ord.setPlace(place) - Utils.modified() - if ord.getTemple() != temple: - ord.setTemple(temple) - Utils.modified() - if ord.getStatus() != self.seal_stat: - ord.setStatus(self.seal_stat) - Utils.modified() - if ord.getFamily() != self.ldsfam: - ord.setFamily(self.ldsfam) - Utils.modified() + ord = LdsOrd(self.person.getLdsSeal()) + if not self.lds_sealing.are_equal(ord): + self.person.setLdsSeal(self.lds_sealing) + Utils.modified() self.update_lists() if self.callback: @@ -1341,7 +1268,11 @@ class EditPerson: def on_primary_name_source_clicked(self,obj): import Sources - Sources.SourceSelector(self.pname.getSourceRefList(),self) + Sources.SourceSelector(self.pname.getSourceRefList(),self,self.update_primary_name) + + def update_primary_name(self,list): + self.pname.setSourceRefList(list) + self.lists_changed = 1 def on_name_note_clicked(self,obj): import NoteEdit @@ -1349,51 +1280,40 @@ class EditPerson: def on_ldsbap_source_clicked(self,obj): import Sources - ord = self.person.getLdsBaptism() - if ord == None: - ord = LdsOrd() - self.person.setLdsBaptism(ord) - Sources.SourceSelector(self.pname.getSourceRefList(),self) + Sources.SourceSelector(self.lds_baptism.getSourceRefList(),self,self.update_ldsbap_list) + def update_ldsbap_list(self,list): + self.lds_baptism.setSourceRefList(list) + self.lists_changed = 1 + def on_ldsbap_note_clicked(self,obj): import NoteEdit - ord = self.person.getLdsBaptism() - if ord == None: - ord = LdsOrd() - self.person.setLdsBaptism(ord) - NoteEdit.NoteEditor(ord) + NoteEdit.NoteEditor(self.lds_baptism) def on_ldsendow_source_clicked(self,obj): import Sources - ord = self.person.getLdsEndowment() - if ord == None: - ord = LdsOrd() - self.person.setLdsEndowment(ord) - Sources.SourceSelector(self.pname.getSourceRefList(),self) + Sources.SourceSelector(self.lds_endowment.getSourceRefList(),self,self.set_ldsendow_list) + + def set_ldsendow_list(self,list): + self.lds_endowment.setSourceRefList(list) + self.lists_changed = 1 def on_ldsendow_note_clicked(self,obj): import NoteEdit - ord = self.person.getLdsEndowment() - if ord == None: - ord = LdsOrd() - self.person.setLdsEndowment(ord) - NoteEdit.NoteEditor(ord) + NoteEdit.NoteEditor(self.lds_endowment) def on_ldsseal_source_clicked(self,obj): import Sources ord = self.person.getLdsSeal() - if ord == None: - ord = LdsOrd() - self.person.setLdsSeal(ord) - Sources.SourceSelector(self.pname.getSourceRefList(),self) + Sources.SourceSelector(self.lds_sealing.getSourceRefList(),self,self.lds_seal_list) + + def lds_seal_list(self,list): + self.lds_sealing.setSourceRefList(list) + self.lists_changed = 1 def on_ldsseal_note_clicked(self,obj): import NoteEdit - ord = self.person.getLdsSeal() - if ord == None: - ord = LdsOrd() - self.person.setLdsSeal(ord) - NoteEdit.NoteEditor(ord) + NoteEdit.NoteEditor(self.lds_sealing) def load_person_image(self): photo_list = self.person.getPhotoList() @@ -1454,36 +1374,6 @@ class EditPerson: self.ntype_field.entry.set_text(_(self.pname.getType())) self.title.set_text(self.pname.getTitle()) -#------------------------------------------------------------------------- -# -# update_ord -# -#------------------------------------------------------------------------- -def update_ord(func,ord,date,temple,stat,place): - if not ord: - if (date or temple or place): - ord = LdsOrd() - ord.setDate(date) - ord.setTemple(temple) - ord.setPlace(place) - func(ord) - Utils.modified() - else: - d = Date() - d.set(date) - if compare_dates(d,ord.getDateObj()) != 0: - ord.setDateObj(d) - Utils.modified() - elif ord.getTemple() != temple: - ord.setTemple(temple) - Utils.modified() - elif ord.getPlace() != place: - ord.setPlace(place) - Utils.modified() - elif ord.getStatus() != stat: - ord.setStatus(stat) - Utils.modified() - #------------------------------------------------------------------------- # # disp_name diff --git a/gramps/src/EditPlace.py b/gramps/src/EditPlace.py index 974b0483d..599667973 100644 --- a/gramps/src/EditPlace.py +++ b/gramps/src/EditPlace.py @@ -63,11 +63,12 @@ pycode_tgts = [('url', 0, 0)] #------------------------------------------------------------------------- class EditPlace: - def __init__(self,place,db,func=None): + def __init__(self,parent,place,func=None): self.place = place - self.db = db + self.db = parent.db + self.parent = parent self.callback = func - self.path = db.getSavePath() + self.path = parent.db.getSavePath() self.not_loaded = 1 self.ref_not_loaded = 1 self.lists_changed = 0 @@ -78,7 +79,7 @@ class EditPlace: self.top_window = libglade.GladeXML(const.placesFile,"placeEditor") plwidget = self.top_window.get_widget("photolist") - self.glry = ImageSelect.Gallery(place, self.path, plwidget, db, self) + self.glry = ImageSelect.Gallery(place, self.path, plwidget, self.db, self) self.title = self.top_window.get_widget("place_title") self.city = self.top_window.get_widget("city") self.parish = self.top_window.get_widget("parish") @@ -101,7 +102,6 @@ class EditPlace: self.loc_parish = self.top_window.get_widget("loc_parish") self.loc_country = self.top_window.get_widget("loc_country") - self.lists_changed = 0 self.ulist = place.getUrlList()[:] self.llist = place.get_alternate_locations()[:] @@ -115,6 +115,7 @@ class EditPlace: self.longitude.set_text(place.get_longitude()) self.latitude.set_text(place.get_latitude()) self.refinfo = self.top_window.get_widget("refinfo") + self.slist = self.top_window.get_widget("slist") self.note.set_point(0) self.note.insert_defaults(place.getNote()) @@ -122,7 +123,6 @@ class EditPlace: self.top_window.signal_autoconnect({ "destroy_passed_object" : Utils.destroy_passed_object, - "on_source_clicked" : self.on_source_clicked, "on_photolist_select_icon" : self.glry.on_photo_select_icon, "on_photolist_button_press" : self.glry.on_button_press_event, "on_switch_page" : self.on_switch_page, @@ -152,6 +152,8 @@ class EditPlace: self.top.editable_enters(self.country); self.top.editable_enters(self.longitude); self.top.editable_enters(self.latitude); + + self.sourcetab = Sources.SourceTab(self.srcreflist,self,self.top_window,self.slist) if self.place.getId() == "": self.top_window.get_widget("add_photo").set_sensitive(0) @@ -297,9 +299,6 @@ class EditPlace: import LocEdit LocEdit.LocationEditor(self,None) - def on_source_clicked(self,obj): - Sources.SourceSelector(self.srcreflist,self) - def on_web_list_select_row(self,obj,row,b,c): url = obj.get_row_data(row) if url == None: diff --git a/gramps/src/EventEdit.py b/gramps/src/EventEdit.py index 7bc0c660e..4a1da408f 100644 --- a/gramps/src/EventEdit.py +++ b/gramps/src/EventEdit.py @@ -222,5 +222,3 @@ class EventEditor: if self.event.getPrivacy() != priv: self.event.setPrivacy(priv) self.parent.lists_changed = 1 - - diff --git a/gramps/src/ImageSelect.py b/gramps/src/ImageSelect.py index 67ec0e11b..3369e5b19 100644 --- a/gramps/src/ImageSelect.py +++ b/gramps/src/ImageSelect.py @@ -34,7 +34,6 @@ import string import GDK import GTK import gtk -import GdkImlib import gnome.ui import libglade @@ -340,7 +339,7 @@ class Gallery(ImageSelect): self.add_thumbnail(oref) self.parent.lists_changed = 1 if GrampsCfg.globalprop: - LocalMediaProperties(oref,self.path) + LocalMediaProperties(oref,self.path,self) Utils.modified() w.drag_finish(context, 1, 0, time) else: @@ -428,7 +427,7 @@ class Gallery(ImageSelect): of a picture.""" if self.selectedIcon >=0: photo = self.dataobj.getPhotoList()[self.selectedIcon] - LocalMediaProperties(photo,self.path) + LocalMediaProperties(photo,self.path,self) #------------------------------------------------------------------------- # @@ -437,11 +436,12 @@ class Gallery(ImageSelect): #------------------------------------------------------------------------- class LocalMediaProperties: - def __init__(self,photo,path): + def __init__(self,photo,path,parent): self.photo = photo self.object = photo.getReference() self.alist = photo.getAttributeList()[:] self.lists_changed = 0 + self.parent = parent fname = self.object.getPath() self.change_dialog = libglade.GladeXML(const.imageselFile, @@ -682,11 +682,9 @@ class GlobalMediaProperties: if text != note or desc != self.object.getDescription(): self.object.setNote(text) self.object.setDescription(desc) - self.parent.lists_changed = 1 Utils.modified() if self.lists_changed: self.object.setAttributeList(self.alist) - self.parent.lists_changed = 1 Utils.modified() if self.update != None: self.update() @@ -742,7 +740,7 @@ class DeleteMediaQuery: Utils.modified() for key in self.db.getPersonKeys(): - key = self.db.getPerson(key) + p = self.db.getPerson(key) nl = [] change = 0 for photo in p.getPhotoList(): diff --git a/gramps/src/PlaceView.py b/gramps/src/PlaceView.py index 601c1736e..1f8d39d32 100644 --- a/gramps/src/PlaceView.py +++ b/gramps/src/PlaceView.py @@ -135,7 +135,7 @@ class PlaceView: def on_button_press_event(self,obj,event): if event.button == 1 and event.type == GDK._2BUTTON_PRESS: if self.active: - EditPlace.EditPlace(self.active,self.db, + EditPlace.EditPlace(self,self.active, self.update_display_after_edit) def insert_place(self,place): @@ -164,7 +164,7 @@ class PlaceView: self.place_list.thaw() def on_add_place_clicked(self,obj): - EditPlace.EditPlace(Place(),self.db,self.new_place_after_edit) + EditPlace.EditPlace(self,Place(),self.new_place_after_edit) def moveto(self,row): self.place_list.unselect_all() @@ -223,7 +223,7 @@ class PlaceView: else: for p in obj.selection: place = self.db.getPlace(obj.get_row_data(p)) - EditPlace.EditPlace(place,self.db, + EditPlace.EditPlace(self,place, self.update_display_after_edit) diff --git a/gramps/src/Sources.py b/gramps/src/Sources.py index cb3e85b1c..bb303463a 100644 --- a/gramps/src/Sources.py +++ b/gramps/src/Sources.py @@ -84,7 +84,7 @@ class SourceSelector: for s in self.list: self.orig.append(s) if self.update: - self.update(self.parent) + self.update(self.orig) Utils.destroy_passed_object(self.sourcesel) def on_edit_src_clicked(self,obj): @@ -92,11 +92,14 @@ class SourceSelector: if len(sel) > 0: row = sel[0] src = obj.get_row_data(row) - SourceEditor(src,self.db,update_clist,self) + SourceEditor(src,self.db,self.update_clist,self) + + def update_clist(self,inst,ref): + inst.redraw() def on_add_src_clicked(self,obj): src = SourceRef() - SourceEditor(src,self.db,add_ref,self) + SourceEditor(src,self.db,self.add_ref,self) def on_del_src_clicked(self,obj): sel = obj.selection @@ -105,6 +108,11 @@ class SourceSelector: del self.list[row] self.redraw() + def add_ref(self,inst,ref): + self.parent.lists_changed = 1 + inst.list.append(ref) + inst.redraw() + #------------------------------------------------------------------------- # # SourceTab @@ -140,16 +148,25 @@ class SourceTab: index = index + 1 self.slist.thaw() + def update_clist(self,inst,ref): + inst.redraw() + self.parent.lists_changed = 1 + def on_edit_src_clicked(self,obj): sel = obj.selection if len(sel) > 0: row = sel[0] src = obj.get_row_data(row) - SourceEditor(src,self.db,update_clist,self) + SourceEditor(src,self.db,self.update_clist,self) def on_add_src_clicked(self,obj): src = SourceRef() - SourceEditor(src,self.db,add_ref,self) + SourceEditor(src,self.db,self.add_ref,self) + + def add_ref(self,inst,ref): + self.parent.lists_changed = 1 + inst.list.append(ref) + inst.redraw() def on_del_src_clicked(self,obj): sel = obj.selection @@ -290,11 +307,5 @@ class SourceEditor: def by_title(a,b): return cmp(a.getTitle(),b.getTitle()) -def update_clist(inst,ref): - inst.redraw() - -def add_ref(inst,ref): - inst.list.append(ref) - inst.redraw() diff --git a/gramps/src/places.glade b/gramps/src/places.glade index fc9e6ae91..ecef5d40f 100644 --- a/gramps/src/places.glade +++ b/gramps/src/places.glade @@ -156,7 +156,7 @@ GtkTable table19 - 9 + 8 3 False 0 @@ -344,56 +344,6 @@ - - GtkLabel - label251 - - GTK_JUSTIFY_CENTER - False - 1 - 0.5 - 5 - 0 - - 0 - 1 - 8 - 9 - 0 - 0 - False - False - False - False - True - False - - - - - GtkEntry - source_field - True - False - True - 0 - - - 1 - 2 - 8 - 9 - 5 - 5 - True - False - False - False - True - False - - - GtkEntry place_title @@ -563,34 +513,6 @@ - - GtkButton - button119 - True - - clicked - on_source_clicked - placeEditor - Tue, 21 Aug 2001 14:02:25 GMT - - - GTK_RELIEF_NORMAL - - 2 - 3 - 8 - 9 - 5 - 0 - False - False - False - False - True - False - - - GtkLabel label279 @@ -1262,6 +1184,254 @@ 0 + + GtkVBox + vbox40 + False + 0 + + + GtkScrolledWindow + scrolledwindow32 + 400 + 150 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + True + True + + + + GtkCList + slist + True + 2 + 80,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN + + + GtkHBox + CList:title + hbox3 + True + 0 + + + GtkHBox + CList:title + hbox4 + True + 0 + + 0 + False + False + + + + GtkHBox + hbox5 + False + 0 + + 0 + False + False + + + + GtkLabel + CList:title + label283 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkArrow + arrow1 + 10 + 10 + False + GTK_ARROW_DOWN + GTK_SHADOW_OUT + 0.5 + 0.5 + 0 + 0 + + 5 + False + True + + + + + + + + GtkHBox + CList:title + hbox6 + True + 0 + + + GtkHBox + CList:title + hbox7 + True + 0 + + 0 + False + False + + + + GtkHBox + hbox8 + False + 0 + + 0 + False + False + + + + GtkLabel + CList:title + label284 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 0 + False + False + + + + + GtkArrow + arrow2 + 10 + 10 + False + GTK_ARROW_DOWN + GTK_SHADOW_OUT + 0.5 + 0.5 + 0 + 0 + + 5 + False + True + + + + + + + + + + GtkHButtonBox + hbuttonbox27 + GTK_BUTTONBOX_SPREAD + 30 + 85 + 27 + 7 + 0 + + 0 + False + True + + + + GtkButton + button133 + True + True + + clicked + on_add_src_clicked + slist + Sat, 06 Oct 2001 15:47:16 GMT + + + GTK_RELIEF_NORMAL + + + + GtkButton + button134 + True + True + + clicked + on_edit_src_clicked + slist + Fri, 05 Oct 2001 02:49:15 GMT + + + GTK_RELIEF_NORMAL + + + + GtkButton + button135 + True + True + + clicked + on_del_src_clicked + slist + Sat, 06 Oct 2001 15:39:54 GMT + + + GTK_RELIEF_NORMAL + + + + + + GtkLabel + Notebook:tab + label282 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + GtkScrolledWindow scrolledwindow28