diff --git a/ChangeLog b/ChangeLog index 89047e71b..b66ec364a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2005-02-26 Don Allingham + * src/AddrEdit.py: update main source list after source addition + * src/AttrEdit.py: update main source list after source addition + * src/EditPerson.py: update main source list after source addition + and place addition + * src/EventEdit.py: update main source list after source addition + and place addition + * src/FamilyView.py: update main source list after source addition + * src/Marriage.py: update main source list after source addition + * src/NameEdit.py: update main source list after source addition + * src/Sources.py: update main source list after source addition + * src/gramps_main.py: update main source list after source addition + * src/const.py.in: new constants + 2005-02-25 Don Allingham * src/gramps_main.py: update places and sources after edit diff --git a/src/AddrEdit.py b/src/AddrEdit.py index 95a91dc0d..45f60cddd 100644 --- a/src/AddrEdit.py +++ b/src/AddrEdit.py @@ -61,7 +61,8 @@ class AddressEditor: """ Displays a dialog that allows the user to edit an address. """ - def __init__(self,parent,addr,callback,parent_window=None): + def __init__(self,parent,addr,callback,parent_window=None + update_sources=None): """ Displays the dialog box. @@ -69,6 +70,7 @@ class AddressEditor: addr - The address that is to be edited """ + self.update_sources = update_sources self.parent = parent if addr: if self.parent.child_windows.has_key(addr): @@ -127,17 +129,15 @@ class AddressEditor: self.addr_date_obj = Date.Date() self.srcreflist = [] - self.sourcetab = Sources.SourceTab(self.srcreflist,self, - self.top, self.window, self.slist, - self.top.get_widget('add_src'), - self.top.get_widget('edit_src'), - self.top.get_widget('del_src')) + self.sourcetab = Sources.SourceTab( + self.srcreflist, self, self.top, self.window, self.slist, + self.top.get_widget('add_src'), self.top.get_widget('edit_src'), + self.top.get_widget('del_src'), self.db.readonly, + self.update_sources) date_stat = self.top.get_widget("date_stat") - self.date_check = DateEdit.DateEdit(self.addr_date_obj, - self.addr_start, - date_stat, - self.window) + self.date_check = DateEdit.DateEdit( + self.addr_date_obj, self.addr_start, date_stat, self.window) self.top.signal_autoconnect({ "on_switch_page" : self.on_switch_page, diff --git a/src/AttrEdit.py b/src/AttrEdit.py index b9a670d8e..f7c153441 100644 --- a/src/AttrEdit.py +++ b/src/AttrEdit.py @@ -59,7 +59,8 @@ class AttributeEditor: """ Displays a dialog that allows the user to edit an attribute. """ - def __init__(self,parent,attrib,title,list,callback,parent_window=None): + def __init__(self, parent, attrib, title, list, callback, + parent_window=None, update_sources=None): """ Displays the dialog box. @@ -69,6 +70,7 @@ class AttributeEditor: list - list of options for the pop down menu """ + self.update_sources = update_sources self.parent = parent if attrib: if self.parent.child_windows.has_key(attrib): @@ -104,11 +106,12 @@ class AttributeEditor: else: self.srcreflist = [] - self.sourcetab = Sources.SourceTab(self.srcreflist,self,self.top, - self.window, self.slist, - self.top.get_widget('add_src'), - self.top.get_widget('edit_src'), - self.top.get_widget('del_src')) + self.sourcetab = Sources.SourceTab( + self.srcreflist, self, self.top, self.window, self.slist, + self.top.get_widget('add_src'), self.top.get_widget('edit_src'), + self.top.get_widget('del_src'), self.db.readonly, + self.update_sources + ) if title == ", ": title = _("Attribute Editor") diff --git a/src/EditPerson.py b/src/EditPerson.py index acb40f1f6..6b28f9747 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -99,6 +99,8 @@ class EditPerson: def __init__(self,parent,person,db,callback=None): """Creates an edit window. Associates a person with the window.""" + self.retval = const.UPDATE_PERSON + self.dp = DateHandler.parser self.dd = DateHandler.displayer self.person = person @@ -423,15 +425,13 @@ class EditPerson: self.death_date_object = self.death.get_date_object() self.update_birth_death() - self.bdate_check = DateEdit.DateEdit(self.birth_date_object, - self.bdate, - self.get_widget("birth_stat"), - self.window) + self.bdate_check = DateEdit.DateEdit( + self.birth_date_object, self.bdate, + self.get_widget("birth_stat"), self.window) - self.ddate_check = DateEdit.DateEdit(self.death_date_object, - self.ddate, - self.get_widget("death_stat"), - self.window) + self.ddate_check = DateEdit.DateEdit( + self.death_date_object, self.ddate, + self.get_widget("death_stat"), self.window) self.top.signal_autoconnect({ "destroy_passed_object" : self.on_cancel_edit, @@ -475,11 +475,16 @@ class EditPerson: "on_help_person_clicked" : self.on_help_clicked, }) - self.sourcetab = Sources.SourceTab(self.srcreflist,self, - self.top,self.window,self.slist, - self.top.get_widget('add_src'), - self.top.get_widget('edit_src'), - self.top.get_widget('del_src')) + if self.parent: + self.update_sources = self.parent.source_view.build_tree + else: + self.update_sources = None + + self.sourcetab = Sources.SourceTab( + self.srcreflist, self, self.top, self.window, self.slist, + self.top.get_widget('add_src'), self.top.get_widget('edit_src'), + self.top.get_widget('del_src'), self.db.readonly, + self.update_sources) self.complete.set_active(self.person.get_complete_flag()) self.private.set_active(self.person.get_privacy()) @@ -633,7 +638,8 @@ class EditPerson: build_dropdown(place,self.place_list) if lds_ord and lds_ord.get_place_handle(): - lds_ord_place = self.db.get_place_from_handle(lds_ord.get_place_handle()) + handle = lds_ord.get_place_handle() + lds_ord_place = self.db.get_place_from_handle(handle) place.set_text(lds_ord_place.get_title()) return stat @@ -674,20 +680,18 @@ class EditPerson: self.ldssealstat.set_sensitive(not self.db.readonly) - self.bstat = self.lds_field(self.lds_baptism, - self.ldsbap_temple, - self.ldsbap_date, - self.ldsbapplace) + self.bstat = self.lds_field( + self.lds_baptism, self.ldsbap_temple, + self.ldsbap_date, self.ldsbapplace) - self.estat = self.lds_field(self.lds_endowment, - self.ldsend_temple, - self.ldsend_date, - self.ldsendowplace) + self.estat = self.lds_field( + self.lds_endowment, self.ldsend_temple, + self.ldsend_date, self.ldsendowplace) - self.seal_stat = self.lds_field(self.lds_sealing, - self.ldsseal_temple, - self.ldsseal_date, - self.ldssealplace) + self.seal_stat = self.lds_field( + self.lds_sealing, self.ldsseal_temple, + self.ldsseal_date, self.ldssealplace) + if self.lds_sealing: self.ldsfam = self.lds_sealing.get_family_handle() else: @@ -1081,12 +1085,15 @@ class EditPerson: def on_add_addr_clicked(self,obj): """Invokes the address editor to add a new address""" import AddrEdit - AddrEdit.AddressEditor(self,None,self.addr_edit_callback,self.window) + AddrEdit.AddressEditor(self,None,self.addr_edit_callback,self.window, + self.update_death_info, self.update_death_info) def on_add_aka_clicked(self,obj): """Invokes the name editor to add a new name""" import NameEdit - NameEdit.NameEditor(self,None,self.name_edit_callback,self.window) + NameEdit.NameEditor( + self, None, self.name_edit_callback, self.window, + self.update_sources) def on_add_url_clicked(self,obj): """Invokes the url editor to add a new name""" @@ -1099,7 +1106,8 @@ class EditPerson: import AttrEdit pname = self.name_display.display(self.person) AttrEdit.AttributeEditor(self,None,pname,const.personalAttributes, - self.attr_edit_callback,self.window) + self.attr_edit_callback,self.window, + self.update_sources) def on_up_clicked(self,obj): sel = obj.get_selection() @@ -1119,10 +1127,12 @@ class EditPerson: """Brings up the EventEditor for a new event""" import EventEdit pname = self.name_display.display(self.person) - EventEdit.EventEditor(self,pname,const.personalEvents, - const.personal_events,None,None,0, - self.event_edit_callback, - noedit=self.db.readonly) + EventEdit.EventEditor( + self,pname,const.personalEvents, + const.personal_events,None,None,0, + self.event_edit_callback, + noedit=self.db.readonly, + redraw_main_source_list=self.update_sources) def on_edit_birth_clicked(self,obj): """Brings up the EventEditor for the birth record, event @@ -1138,11 +1148,12 @@ class EditPerson: p = self.get_place(self.bplace) if p: event.set_place_handle(p) - EventEdit.EventEditor(self,pname,const.personalEvents, - const.personal_events,event,def_placename,1, - self.event_edit_callback, - noedit=self.db.readonly) - + EventEdit.EventEditor( + self,pname, const.personalEvents, + const.personal_events,event,def_placename,1, + self.event_edit_callback, + noedit=self.db.readonly, + redraw_main_source_list=self.update_sources) def on_edit_death_clicked(self,obj): """Brings up the EventEditor for the death record, event @@ -1158,10 +1169,12 @@ class EditPerson: p = self.get_place(self.dplace) if p: event.set_place_handle(p) - EventEdit.EventEditor(self,pname,const.personalEvents, - const.personal_events,event,def_placename,1, - self.event_edit_callback, - noedit=self.db.readonly) + EventEdit.EventEditor( + self,pname,const.personalEvents, + const.personal_events,event,def_placename,1, + self.event_edit_callback, + noedit=self.db.readonly, + redraw_main_source_list=self.update_sources) def on_aka_delete_clicked(self,obj): """Deletes the selected name from the name list""" @@ -1254,8 +1267,10 @@ class EditPerson: male = self.is_male.get_active() female = self.is_female.get_active() unknown = self.is_unknown.get_active() - text = unicode(self.notes_buffer.get_text(self.notes_buffer.get_start_iter(), - self.notes_buffer.get_end_iter(),False)) + + start = self.notes_buffer.get_start_iter() + end = self.notes_buffer.get_end_iter() + text = unicode(self.notes_buffer.get_text(start, end, False)) format = self.preform.get_active() idval = unicode(self.gid.get_text()) if idval == "": @@ -1381,14 +1396,16 @@ class EditPerson: attr = self.atree.get_object(node) pname = self.name_display.display(self.person) AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes, - self.attr_edit_callback,self.window) + self.attr_edit_callback,self.window, + self.update_sources) def on_update_addr_clicked(self,obj): import AddrEdit store,node = self.ptree.get_selected() if node: - AddrEdit.AddressEditor(self,self.ptree.get_object(node), - self.addr_edit_callback,self.window) + AddrEdit.AddressEditor( + self,self.ptree.get_object(node), + self.addr_edit_callback,self.window, self.update_sources) def on_update_url_clicked(self,obj): import UrlEdit @@ -1406,10 +1423,12 @@ class EditPerson: return pname = self.name_display.display(self.person) event = self.etree.get_object(node) - EventEdit.EventEditor(self,pname,const.personalEvents, - const.personal_events,event,None,0, - self.event_edit_callback, - noedit=self.db.readonly) + EventEdit.EventEditor( + self,pname,const.personalEvents, + const.personal_events,event,None,0, + self.event_edit_callback, + noedit=self.db.readonly, + redraw_main_source_list=self.update_sources) def on_aka_delete_clicked(self,obj): """Deletes the selected name from the name list""" @@ -1631,14 +1650,16 @@ class EditPerson: attr = self.atree.get_object(node) pname = self.name_display.display(self.person) AttrEdit.AttributeEditor(self,attr,pname,const.personalAttributes, - self.attr_edit_callback,self.window) + self.attr_edit_callback,self.window, + self.update_sources) def on_update_addr_clicked(self,obj): import AddrEdit store,node = self.ptree.get_selected() if node: - AddrEdit.AddressEditor(self,self.ptree.get_object(node), - self.addr_edit_callback,self.window) + AddrEdit.AddressEditor( + self, self.ptree. get_object(node), self.addr_edit_callback, + self.window, self.update_sources) def on_update_url_clicked(self,obj): import UrlEdit @@ -1656,9 +1677,11 @@ class EditPerson: return pname = self.name_display.display(self.person) event = self.etree.get_object(node) - EventEdit.EventEditor(self,pname,const.personalEvents, - const.personal_events,event,None,0, - self.event_edit_callback,noedit=self.db.readonly) + EventEdit.EventEditor( + self,pname,const.personalEvents, + const.personal_events,event,None,0, + self.event_edit_callback,noedit=self.db.readonly, + redraw_main_source_list=self.update_sources) def on_event_select_row(self,obj): store,node = obj.get_selected() @@ -1821,8 +1844,9 @@ class EditPerson: import NameEdit store,node = self.ntree.get_selected() if node: - NameEdit.NameEditor(self,self.ntree.get_object(node), - self.name_edit_callback,self.window) + NameEdit.NameEditor(self, self.ntree.get_object(node), + self.name_edit_callback, self.window, + self.update_sources) def load_photo(self,photo): """loads, scales, and displays the person's main photo""" @@ -2030,16 +2054,14 @@ class EditPerson: if not self.person.get_handle(): self.db.add_person(self.person, trans) - call_value = 0 else: if not self.person.get_gramps_id(): self.person.set_gramps_id(self.db.find_next_person_gramps_id()) - call_value = 1 self.db.commit_person(self.person, trans) n = self.person.get_primary_name().get_regular_name() self.db.transaction_commit(trans,_("Edit Person (%s)") % n) if self.callback: - self.callback(self,call_value) + self.callback(self,self.retval) self.close() def get_place(self,field,makenew=0): @@ -2052,6 +2074,7 @@ class EditPerson: place.set_title(text) trans = self.db.transaction_begin() self.db.add_place(place,trans) + self.retval |= const.UPDATE_PLACE self.db.transaction_commit(trans,_('Add Place (%s)' % text)) self.pdmap[text] = place.get_handle() self.add_places.append(place) @@ -2075,7 +2098,8 @@ class EditPerson: self.pname.set_first_name(unicode(self.given.get_text())) self.pname.set_title(unicode(self.title.get_text())) - NameEdit.NameEditor(self,self.pname,self.update_name,self.window) + NameEdit.NameEditor(self, self.pname, self.update_name, + self.window, self.update_sources) def update_name(self,name): self.write_primary_name() diff --git a/src/EventEdit.py b/src/EventEdit.py index d3cc66655..a3d1674dd 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -61,7 +61,9 @@ from QuestionDialog import WarningDialog class EventEditor: def __init__(self,parent,name,elist,trans,event,def_placename, - read_only, cb, def_event=None, noedit=False): + read_only, cb, def_event=None, noedit=False, + redraw_main_source_list=None): + self.redraw_main_source_list = redraw_main_source_list self.parent = parent self.db = self.parent.db if event: @@ -161,12 +163,10 @@ class EventEditor: del_src = self.top.get_widget('del_src') del_src.set_sensitive(not noedit) - self.sourcetab = Sources.SourceTab(self.srcreflist,self, - self.top,self.window,self.slist, - add_src, - self.top.get_widget('edit_src'), - del_src, self.db.readonly - ) + self.sourcetab = Sources.SourceTab( + self.srcreflist, self, self.top, self.window, self.slist, + add_src, self.top.get_widget('edit_src'), del_src, + self.db.readonly, self.redraw_main_source_list ) add_witness = self.top.get_widget('add_witness') add_witness.set_sensitive(not noedit) @@ -174,11 +174,9 @@ class EventEditor: del_witness = self.top.get_widget('del_witness') del_witness.set_sensitive(not noedit) - self.witnesstab = Witness.WitnessTab(self.witnesslist,self, - self.top,self.window,self.wlist, - add_witness, - edit_witness, - del_witness) + self.witnesstab = Witness.WitnessTab( + self.witnesslist, self, self.top, self.window, self.wlist, + add_witness, edit_witness, del_witness) AutoComp.fill_combo(self.event_menu,self.elist) AutoComp.fill_entry(self.place_field,self.pmap.keys()) @@ -324,9 +322,10 @@ class EventEditor: epriv = self.priv.get_active() if not ename in self.elist: - WarningDialog(_('New event type created'), - _('The "%s" event type has been added to this database.\n' - 'It will now appear in the event menus for this database') % ename) + WarningDialog( + _('New event type created'), + _('The "%s" event type has been added to this database.\n' + 'It will now appear in the event menus for this database') % ename) self.elist.append(ename) self.elist.sort() diff --git a/src/FamilyView.py b/src/FamilyView.py index c262c751a..29b8476dc 100644 --- a/src/FamilyView.py +++ b/src/FamilyView.py @@ -622,9 +622,9 @@ class FamilyView: DisplayTrace.DisplayTrace() def edit_marriage_callback(self,obj): - Marriage.Marriage(self.parent, self.family,self.parent.db, - self.parent.new_after_edit, - self.load_family) + Marriage.Marriage( + self.parent, self.family,self.parent.db, self.parent.new_after_edit, + self.load_family, self.parent.source_view.build_tree) def sp_button_press(self,obj,event): if event.state & gtk.gdk.SHIFT_MASK and \ @@ -641,9 +641,10 @@ class FamilyView: if self.person: try: if self.selected_spouse: - Marriage.Marriage(self.parent,self.family,self.parent.db, - self.parent.new_after_edit, - self.load_family) + Marriage.Marriage( + self.parent,self.family,self.parent.db, + self.parent.new_after_edit, self.load_family, + self.parent.source_view.build_tree) else: AddSpouse.AddSpouse(self.parent,self.parent.db,self.person, self.load_family, @@ -712,9 +713,10 @@ class FamilyView: self.load_family(self.family) self.parent.db.transaction_commit(trans,_("Add Spouse")) - m = Marriage.Marriage(self.parent,self.family,self.parent.db, - self.parent.new_after_edit, - self.load_family) + m = Marriage.Marriage( + self.parent,self.family,self.parent.db, self.parent.new_after_edit, + self.load_family, self.parent.source_view.build_tree) + m.on_add_clicked() def add_child_clicked(self,obj): diff --git a/src/Marriage.py b/src/Marriage.py index 9f10fcace..8374685dd 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -71,7 +71,7 @@ pycode_tgts = [('fevent', 0, 0), ('fattr', 0, 1)] #------------------------------------------------------------------------- class Marriage: - def __init__(self,parent,family,db,callback,update): + def __init__(self,parent,family,db,callback,update,source_update): """Initializes the Marriage class, and displays the window""" self.family = family self.parent = parent @@ -85,6 +85,7 @@ class Marriage: self.update_fv = update self.pmap = {} self.dp = DateHandler.parser + self.update_sources = source_update if family: self.srcreflist = family.get_source_references() @@ -285,12 +286,11 @@ class Marriage: else: self.flowed.set_active(1) - self.sourcetab = Sources.SourceTab(self.srcreflist,self, - self.top,self.window,self.slist, - self.top.get_widget('add_src'), - self.top.get_widget('edit_src'), - self.top.get_widget('del_src'), - self.db.readonly) + self.sourcetab = Sources.SourceTab( + self.srcreflist, self, self.top, self.window, self.slist, + self.top.get_widget('add_src'), self.top.get_widget('edit_src'), + self.top.get_widget('del_src'), self.db.readonly, + self.update_sources) self.redraw_event_list() self.redraw_attr_list() @@ -679,7 +679,8 @@ class Marriage: EventEdit.EventEditor(self,name,const.marriageEvents, const.family_events,None,None, 0,self.event_edit_callback, - const.defaultMarriageEvent) + const.defaultMarriageEvent, + self.update_sources) def on_event_update_clicked(self,obj): import EventEdit @@ -690,7 +691,8 @@ class Marriage: name = Utils.family_name(self.family,self.db) EventEdit.EventEditor(self,name,const.marriageEvents, const.family_events,event, - None,0,self.event_edit_callback) + None,0,self.event_edit_callback, + self.update_sources) def on_delete_clicked(self,obj): if Utils.delete_selected(obj,self.elist): @@ -762,8 +764,9 @@ class Marriage: name = NameDisplay.displayer.display(father) else: name = NameDisplay.displayer.display(mother) - AttrEdit.AttributeEditor(self,attr,name,const.familyAttributes, - self.attr_edit_callback) + AttrEdit.AttributeEditor( + self, attr, name, const.familyAttributes, + self.attr_edit_callback, self.update_sources) def on_delete_attr_clicked(self,obj): if Utils.delete_selected(obj,self.alist): @@ -784,8 +787,9 @@ class Marriage: name = NameDisplay.displayer.display(father) else: name = NameDisplay.displayer.display(mother) - AttrEdit.AttributeEditor(self,None,name,const.familyAttributes, - self.attr_edit_callback) + AttrEdit.AttributeEditor( + self, None, name, const.familyAttributes, + self.attr_edit_callback, self.update_sources) def move_element(self,list,src,dest): if src == -1: diff --git a/src/NameEdit.py b/src/NameEdit.py index 399bda8ee..15c22312c 100644 --- a/src/NameEdit.py +++ b/src/NameEdit.py @@ -54,7 +54,10 @@ import NameDisplay #------------------------------------------------------------------------- class NameEditor: - def __init__(self,parent,name,callback,parent_window=None): + def __init__(self,parent,name,callback,parent_window=None, + update_sources=None): + + self.update_sources = update_sources self.parent = parent self.db = self.parent.db if name: @@ -114,11 +117,11 @@ class NameEditor: Utils.set_titles(self.window, alt_title, tmsg, _('Name Editor')) - self.sourcetab = Sources.SourceTab(self.srcreflist, self, - self.top, self.window, self.slist, - self.top.get_widget('add_src'), - self.top.get_widget('edit_src'), - self.top.get_widget('del_src')) + self.sourcetab = Sources.SourceTab( + self.srcreflist, self, self.top, self.window, self.slist, + self.top.get_widget('add_src'), self.top.get_widget('edit_src'), + self.top.get_widget('del_src'), self.db.readonly, + self.update_sources) self.note_buffer = self.note_field.get_buffer() @@ -274,12 +277,14 @@ class NameEditor: elif self.name.get_group_as() != grp_as: if grp_as not in self.db.get_name_group_keys(): from QuestionDialog import QuestionDialog2 - q = QuestionDialog2(_("Group all people with the same name?"), - _("You have the choice of grouping all people with the " - "name of %(surname)s with the name of %(group_name)s, or " - "just mapping this particular name.") % {'surname' : srn, 'group_name':grp_as}, - _("Group all"), - _("Group this name only")) + q = QuestionDialog2( + _("Group all people with the same name?"), + _("You have the choice of grouping all people with the " + "name of %(surname)s with the name of %(group_name)s, or " + "just mapping this particular name.") % { 'surname' : srn, + 'group_name':grp_as}, + _("Group all"), + _("Group this name only")) val = q.run() if val: self.name.set_group_as("") diff --git a/src/Sources.py b/src/Sources.py index 96468d62c..6d1c4e4df 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -218,8 +218,10 @@ class SourceSelector: # #------------------------------------------------------------------------- class SourceTab: - def __init__(self,srclist,parent,top,window,clist,add_btn, - edit_btn,del_btn,readonly=False): + def __init__(self, srclist, parent, top, window, clist, add_btn, + edit_btn, del_btn, readonly=False, main_update=None ): + + self.main_update = main_update self.db = parent.db self.parent = parent self.list = srclist @@ -270,22 +272,22 @@ class SourceTab: def update_clist(self,inst,ref): inst.redraw() self.parent.lists_changed = 1 + + def add_ref(self,inst,ref): + self.parent.lists_changed = 1 + inst.list.append(ref) + inst.redraw() def edit_src_clicked(self,obj): store,node = self.selection.get_selected() if node: col = store.get_path(node) src = self.list[col[0]] - SourceEditor(src,self.db,self.update_clist,self) + SourceEditor(src,self.db,self.update_clist,self, self.main_update) def add_src_clicked(self,obj): src = RelLib.SourceRef() - 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() + SourceEditor(src,self.db,self.add_ref,self, self.main_update) def del_src_clicked(self,obj): (store,node) = self.selection.get_selected() @@ -302,8 +304,9 @@ class SourceTab: #------------------------------------------------------------------------- class SourceEditor: - def __init__(self,srcref,database,update=None,parent=None): + def __init__(self, srcref, database, update, parent, main_update=None): + self.main_update = main_update self.db = database self.parent = parent if self.parent.__dict__.has_key('child_windows'): @@ -321,18 +324,20 @@ class SourceEditor: self.update = update self.source_ref = srcref self.child_windows = {} - self.showSource = gtk.glade.XML(const.srcselFile, "sourceDisplay","gramps") + self.showSource = gtk.glade.XML(const.srcselFile, + "sourceDisplay","gramps") self.sourceDisplay = self.get_widget("sourceDisplay") - Utils.set_titles(self.sourceDisplay, self.showSource.get_widget('title'), + Utils.set_titles(self.sourceDisplay, + self.showSource.get_widget('title'), _('Source Information')) self.showSource.signal_autoconnect({ - "on_add_src_clicked" : self.add_src_clicked, - "on_help_srcDisplay_clicked" : self.on_help_clicked, - "on_ok_srcDisplay_clicked" : self.on_sourceok_clicked, - "on_cancel_srcDisplay_clicked" : self.close, - "on_sourceDisplay_delete_event" : self.on_delete_event, + "on_add_src_clicked" : self.add_src_clicked, + "on_help_srcDisplay_clicked" : self.on_help_clicked, + "on_ok_srcDisplay_clicked" : self.on_sourceok_clicked, + "on_cancel_srcDisplay_clicked" : self.close, + "on_sourceDisplay_delete_event" : self.on_delete_event, }) self.source_field = self.get_widget("sourceList") @@ -453,7 +458,7 @@ class SourceEditor: keys = self.db.get_source_handles() keys.sort(self.db._sortbysource) - store = gtk.ListStore(gobject.TYPE_STRING) + store = gtk.ListStore(str) sel_child = None self.active_source = sel @@ -480,7 +485,8 @@ class SourceEditor: def on_sourceok_clicked(self,obj): - if self.active_source != self.db.get_source_from_handle(self.source_ref.get_base_handle()): + shandle = self.source_ref.get_base_handle() + if self.active_source != self.db.get_source_from_handle(shandle): self.source_ref.set_base_handle(self.active_source.get_handle()) conf = self.get_widget("conf").get_active() @@ -504,9 +510,7 @@ class SourceEditor: self.source_ref.set_confidence_level(conf) self.source_ref.set_privacy(self.private.get_active()) - if self.update: - self.update(self.parent,self.source_ref) - + self.update(self.parent,self.source_ref) self.close(obj) def on_source_changed(self,obj): @@ -518,6 +522,8 @@ class SourceEditor: def update_display(self,source): self.draw(source,fresh=False) + if self.main_update: + self.main_update() def add_src_clicked(self,obj): import EditSource diff --git a/src/const.py.in b/src/const.py.in index 095745a62..895733b0c 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -48,6 +48,17 @@ app_gedcom = "application/x-gedcom" app_gramps_package = "application/x-gramps-package" app_geneweb = "application/x-geneweb" +#------------------------------------------------------------------------- +# +# Display update values +# +#------------------------------------------------------------------------- + +UPDATE_PERSON = 0x1 +UPDATE_FAMILY = 0x2 +UPDATE_PLACE = 0x4 +UPDATE_SOURCE = 0x8 + #------------------------------------------------------------------------- # # Paths to external programs diff --git a/src/gramps_main.py b/src/gramps_main.py index 884402148..388de537a 100755 --- a/src/gramps_main.py +++ b/src/gramps_main.py @@ -1242,7 +1242,7 @@ class Gramps: def load_new_person(self,obj): person = RelLib.Person() try: - EditPerson.EditPerson(self,person,self.db, + EditPerson.EditPerson(self, person, self.db, self.update_after_edit) except: DisplayTrace.DisplayTrace()