* 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
This commit is contained in:
Don Allingham 2005-04-02 05:33:06 +00:00
parent 30d0904d71
commit ea4beeb3ff
5 changed files with 29 additions and 20 deletions

View File

@ -1,3 +1,9 @@
2005-04-01 Don Allingham <don@gramps-project.org>
* 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 <shura@gramps-project.org> 2005-04-01 Alex Roitman <shura@gramps-project.org>
* src/EditPerson.py (on_edit_name_clicked): Remove unneeded argument. * src/EditPerson.py (on_edit_name_clicked): Remove unneeded argument.

View File

@ -1212,8 +1212,7 @@ class EditPerson:
self,pname, const.personalEvents, self,pname, const.personalEvents,
const.personal_events,event,def_placename,1, const.personal_events,event,def_placename,1,
self.event_edit_callback, self.event_edit_callback,
noedit=self.db.readonly, noedit=self.db.readonly)
redraw_main_source_list=self.update_sources)
def on_edit_death_clicked(self,obj): def on_edit_death_clicked(self,obj):
"""Brings up the EventEditor for the death record, event """Brings up the EventEditor for the death record, event
@ -1233,8 +1232,7 @@ class EditPerson:
self,pname,const.personalEvents, self,pname,const.personalEvents,
const.personal_events,event,def_placename,1, const.personal_events,event,def_placename,1,
self.event_edit_callback, self.event_edit_callback,
noedit=self.db.readonly, noedit=self.db.readonly)
redraw_main_source_list=self.update_sources)
def on_aka_delete_clicked(self,obj): def on_aka_delete_clicked(self,obj):
"""Deletes the selected name from the name list""" """Deletes the selected name from the name list"""
@ -1488,8 +1486,7 @@ class EditPerson:
EventEdit.EventEditor( EventEdit.EventEditor(
self,pname,const.personalEvents, self,pname,const.personalEvents,
const.personal_events,event,None,0, const.personal_events,event,None,0,
self.event_edit_callback,noedit=self.db.readonly, self.event_edit_callback,noedit=self.db.readonly)
redraw_main_source_list=self.update_sources)
def on_event_select_row(self,obj): def on_event_select_row(self,obj):
store,node = obj.get_selected() store,node = obj.get_selected()

View File

@ -653,8 +653,6 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
if family.get_handle() == None: if family.get_handle() == None:
family.set_handle(self.create_id()) family.set_handle(self.create_id())
self.commit_family(family,transaction) self.commit_family(family,transaction)
if transaction and not transaction.batch:
self.emit('family-add',([str(family.handle),]))
return family.get_handle() return family.get_handle()
def add_source(self,source,transaction): def add_source(self,source,transaction):
@ -667,8 +665,6 @@ class GrampsDbBase(GrampsDBCallback.GrampsDBCallback):
if source.get_gramps_id() == None: if source.get_gramps_id() == None:
source.set_gramps_id(self.find_next_source_gramps_id()) source.set_gramps_id(self.find_next_source_gramps_id())
self.commit_source(source,transaction) self.commit_source(source,transaction)
if transaction and not transaction.batch:
self.emit('source-add',([source.handle],))
return source.get_handle() return source.get_handle()
def add_event(self,event,transaction): def add_event(self,event,transaction):

View File

@ -191,7 +191,8 @@ class SourceView:
msg = "%s %s" % (msg,Utils.data_recover_msg) msg = "%s %s" % (msg,Utils.data_recover_msg)
QuestionDialog(_('Delete %s?') % source.get_title(), 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): def on_edit_clicked(self,obj):
list_store, node = self.selection.get_selected() list_store, node = self.selection.get_selected()
@ -229,4 +230,5 @@ class SourceView:
ErrorDialog(msg,msg2) ErrorDialog(msg,msg2)
else: else:
import MergeData 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)

View File

@ -50,6 +50,7 @@ import RelLib
import Date import Date
import DateEdit import DateEdit
import DateHandler import DateHandler
import GrampsDBCallback
from DdTargets import DdTargets from DdTargets import DdTargets
@ -410,25 +411,29 @@ class SourceEditor:
handle = self.source_ref.get_base_handle() handle = self.source_ref.get_base_handle()
self.active_source = self.db.get_source_from_handle(handle) self.active_source = self.db.get_source_from_handle(handle)
self.date_obj = self.source_ref.get_date_object() 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()) self.private.set_active(self.source_ref.get_privacy())
else: else:
self.date_obj = Date.Date() self.date_obj = Date.Date()
self.active_source = None self.active_source = None
date_stat = self.get_widget("date_stat") date_stat = self.get_widget("date_stat")
self.date_check = DateEdit.DateEdit(self.date_obj, self.date_check = DateEdit.DateEdit(
self.date_entry_field, self.date_obj, self.date_entry_field,
date_stat, date_stat, self.sourceDisplay)
self.sourceDisplay)
self.draw(self.active_source,fresh=True) self.draw(self.active_source,fresh=True)
self.set_button() self.set_button()
if self.parent: if self.parent:
self.sourceDisplay.set_transient_for(self.parent.window) self.sourceDisplay.set_transient_for(self.parent.window)
self.add_itself_to_menu() self.add_itself_to_menu()
self.db.connect('source-add', self.rebuild_menu)
self.sourceDisplay.show() self.sourceDisplay.show()
def rebuild_menu(self,handle_list):
self.build_source_menu()
def on_delete_event(self,obj,b): def on_delete_event(self,obj,b):
self.close_child_windows() self.close_child_windows()
self.remove_itself_from_menu() self.remove_itself_from_menu()
@ -495,7 +500,8 @@ class SourceEditor:
scom = self.get_widget("scomment") scom = self.get_widget("scomment")
scom.get_buffer().set_text(self.source_ref.get_note()) 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 self.active_source = src
if src: if src:
self.author_field.set_text(src.get_author()) self.author_field.set_text(src.get_author())
@ -503,14 +509,16 @@ class SourceEditor:
else: else:
self.author_field.set_text("") self.author_field.set_text("")
self.pub_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 = self.db.get_source_handles()
keys.sort(self.db._sortbysource) keys.sort(self.db._sortbysource)
store = gtk.ListStore(str) store = gtk.ListStore(str)
sel_child = None sel_child = None
self.active_source = sel
index = 0 index = 0
sel_index = 0 sel_index = 0
self.handle_list = [] self.handle_list = []
@ -521,7 +529,7 @@ class SourceEditor:
handle = src.get_handle() handle = src.get_handle()
store.append(row=["%s [%s]" % (title,gid)]) store.append(row=["%s [%s]" % (title,gid)])
self.handle_list.append(handle) 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 sel_index = index
index += 1 index += 1
self.title_menu.set_model(store) self.title_menu.set_model(store)