From ea4beeb3ff99dbdb14242f06fba9d2abd730d334 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sat, 2 Apr 2005 05:33:06 +0000 Subject: [PATCH] * src/EditPerson.py: removed unused callback functions * src/GrampsDbBase.py: remove duplicate signal emissions * src/SourceView.py: reformat code * src/Sources.py: catch source-add signal and redraw menu svn: r4283 --- ChangeLog | 6 ++++++ src/EditPerson.py | 9 +++------ src/GrampsDbBase.py | 4 ---- src/SourceView.py | 6 ++++-- src/Sources.py | 24 ++++++++++++++++-------- 5 files changed, 29 insertions(+), 20 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3df0a352c..7700cbf05 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-04-01 Don Allingham + * src/EditPerson.py: removed unused callback functions + * src/GrampsDbBase.py: remove duplicate signal emissions + * src/SourceView.py: reformat code + * src/Sources.py: catch source-add signal and redraw menu + 2005-04-01 Alex Roitman * src/EditPerson.py (on_edit_name_clicked): Remove unneeded argument. diff --git a/src/EditPerson.py b/src/EditPerson.py index 01114bfa3..74fab0ab2 100644 --- a/src/EditPerson.py +++ b/src/EditPerson.py @@ -1212,8 +1212,7 @@ class EditPerson: 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) + noedit=self.db.readonly) def on_edit_death_clicked(self,obj): """Brings up the EventEditor for the death record, event @@ -1233,8 +1232,7 @@ class EditPerson: 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) + noedit=self.db.readonly) def on_aka_delete_clicked(self,obj): """Deletes the selected name from the name list""" @@ -1488,8 +1486,7 @@ class EditPerson: 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) + self.event_edit_callback,noedit=self.db.readonly) def on_event_select_row(self,obj): store,node = obj.get_selected() diff --git a/src/GrampsDbBase.py b/src/GrampsDbBase.py index 3c2487728..2dca0100f 100644 --- a/src/GrampsDbBase.py +++ b/src/GrampsDbBase.py @@ -653,8 +653,6 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): if family.get_handle() == None: family.set_handle(self.create_id()) self.commit_family(family,transaction) - if transaction and not transaction.batch: - self.emit('family-add',([str(family.handle),])) return family.get_handle() def add_source(self,source,transaction): @@ -667,8 +665,6 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback): if source.get_gramps_id() == None: source.set_gramps_id(self.find_next_source_gramps_id()) self.commit_source(source,transaction) - if transaction and not transaction.batch: - self.emit('source-add',([source.handle],)) return source.get_handle() def add_event(self,event,transaction): diff --git a/src/SourceView.py b/src/SourceView.py index 554523893..1f800fded 100644 --- a/src/SourceView.py +++ b/src/SourceView.py @@ -191,7 +191,8 @@ class SourceView: msg = "%s %s" % (msg,Utils.data_recover_msg) QuestionDialog(_('Delete %s?') % source.get_title(), msg, - _('_Delete Source'),ans.query_response,self.topWindow) + _('_Delete Source'),ans.query_response, + self.topWindow) def on_edit_clicked(self,obj): list_store, node = self.selection.get_selected() @@ -229,4 +230,5 @@ class SourceView: ErrorDialog(msg,msg2) else: import MergeData - MergeData.MergeSources(self.parent.db,mlist[0],mlist[1],self.build_tree) + MergeData.MergeSources(self.parent.db,mlist[0],mlist[1], + self.build_tree) diff --git a/src/Sources.py b/src/Sources.py index ad346956c..d90623923 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -50,6 +50,7 @@ import RelLib import Date import DateEdit import DateHandler +import GrampsDBCallback from DdTargets import DdTargets @@ -410,25 +411,29 @@ class SourceEditor: handle = self.source_ref.get_base_handle() self.active_source = self.db.get_source_from_handle(handle) self.date_obj = self.source_ref.get_date_object() - self.date_entry_field.set_text(DateHandler.displayer.display(self.date_obj)) + date_str = DateHandler.displayer.display(self.date_obj) + self.date_entry_field.set_text(date_str) self.private.set_active(self.source_ref.get_privacy()) else: self.date_obj = Date.Date() self.active_source = None date_stat = self.get_widget("date_stat") - self.date_check = DateEdit.DateEdit(self.date_obj, - self.date_entry_field, - date_stat, - self.sourceDisplay) + self.date_check = DateEdit.DateEdit( + self.date_obj, self.date_entry_field, + date_stat, self.sourceDisplay) self.draw(self.active_source,fresh=True) self.set_button() if self.parent: self.sourceDisplay.set_transient_for(self.parent.window) self.add_itself_to_menu() + self.db.connect('source-add', self.rebuild_menu) self.sourceDisplay.show() + def rebuild_menu(self,handle_list): + self.build_source_menu() + def on_delete_event(self,obj,b): self.close_child_windows() self.remove_itself_from_menu() @@ -495,7 +500,8 @@ class SourceEditor: scom = self.get_widget("scomment") scom.get_buffer().set_text(self.source_ref.get_note()) - src = self.db.get_source_from_handle(self.source_ref.get_base_handle()) + idval = self.source_ref.get_base_handle() + src = self.db.get_source_from_handle(idval) self.active_source = src if src: self.author_field.set_text(src.get_author()) @@ -503,14 +509,16 @@ class SourceEditor: else: self.author_field.set_text("") self.pub_field.set_text("") + self.active_source = sel + self.build_source_menu() + def build_source_menu(self): keys = self.db.get_source_handles() keys.sort(self.db._sortbysource) store = gtk.ListStore(str) sel_child = None - self.active_source = sel index = 0 sel_index = 0 self.handle_list = [] @@ -521,7 +529,7 @@ class SourceEditor: handle = src.get_handle() store.append(row=["%s [%s]" % (title,gid)]) self.handle_list.append(handle) - if sel and sel.get_handle() == src_id: + if self.active_source and self.active_source.get_handle() == src_id: sel_index = index index += 1 self.title_menu.set_model(store)