diff --git a/ChangeLog b/ChangeLog index 6cfe1f4eb..183c79ddb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,6 +1,17 @@ 2003-09-13 Alex Roitman * src/plugins/AncestorChart.py (AncestorChart.__init__): Call calc() after self.standalone is defined. + * src/srcsel.glade: Define proper responses for OK and Cancel buttons + in both SourceSelector and SourceEditor windows. + * src/Sources.py: Make both SourceSelector and SourceEditor modal and + transients for their parent window. Add SourceTab window argument to + SourceTab to pass to the SourceEditor. + * src/AddrEdit.py: Pass window widget to the SourceTab. + * src/AttrEdit.py: Likewise. + * src/EditPlace.py: Likewise. + * src/EventEdit.py: Likewise. + * src/NameEdit.py: Likewise. + * src/Marriage.py: Rename top_window to self.window. 2003-09-12 Don Allingham * src/BaseDoc.py: add init function to BaseDoc to be called after diff --git a/src/AddrEdit.py b/src/AddrEdit.py index 7a216b9fe..ddb3cce36 100644 --- a/src/AddrEdit.py +++ b/src/AddrEdit.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000-2003 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -100,7 +100,7 @@ class AddressEditor: self.srcreflist = [] self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent, - self.top, self.slist, + self.top, self.window, self.slist, self.top.get_widget('add_src'), self.top.get_widget('edit_src'), self.top.get_widget('del_src')) diff --git a/src/AttrEdit.py b/src/AttrEdit.py index 38c91db3e..9be39099e 100644 --- a/src/AttrEdit.py +++ b/src/AttrEdit.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000-2003 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -84,7 +84,7 @@ class AttributeEditor: self.srcreflist = [] self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent,self.top, - self.slist, + self.window, self.slist, self.top.get_widget('add_src'), self.top.get_widget('edit_src'), self.top.get_widget('del_src')) diff --git a/src/EditPlace.py b/src/EditPlace.py index d1f1d7b55..3ed237dce 100644 --- a/src/EditPlace.py +++ b/src/EditPlace.py @@ -157,7 +157,7 @@ class EditPlace: }) self.sourcetab = Sources.SourceTab(self.srcreflist,self, - self.top_window,self.slist, + self.top_window,self.top,self.slist, self.top_window.get_widget('add_src'), self.top_window.get_widget('edit_src'), self.top_window.get_widget('del_src')) diff --git a/src/EventEdit.py b/src/EventEdit.py index 4a6dfb8c8..59a94aa4d 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000, 2003 Donald N. Allingham +# Copyright (C) 2000-2003 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -115,7 +115,7 @@ class EventEditor: self.date_field.grab_focus() self.sourcetab = Sources.SourceTab(self.srcreflist,self.parent, - self.top,self.slist, + self.top,self.window,self.slist, self.top.get_widget('add_src'), self.top.get_widget('edit_src'), self.top.get_widget('del_src')) diff --git a/src/Marriage.py b/src/Marriage.py index aef06253b..1b9fcf1ff 100644 --- a/src/Marriage.py +++ b/src/Marriage.py @@ -78,9 +78,9 @@ class Marriage: self.pmap[p[0]] = key self.top = gtk.glade.XML(const.marriageFile,"marriageEditor","gramps") - top_window = self.get_widget("marriageEditor") + self.window = self.get_widget("marriageEditor") - Utils.set_titles(top_window, self.top.get_widget('title'), + Utils.set_titles(self.window, self.top.get_widget('title'), _('Marriage/Relationship Editor')) self.icon_list = self.get_widget('iconlist') @@ -200,7 +200,7 @@ class Marriage: self.redraw_event_list() self.redraw_attr_list() - top_window.show() + self.window.show() def ev_drag_begin(self, context, a): return diff --git a/src/NameEdit.py b/src/NameEdit.py index 0fc11c830..83be7c05c 100644 --- a/src/NameEdit.py +++ b/src/NameEdit.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000 Donald N. Allingham +# Copyright (C) 2000-2003 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -84,7 +84,7 @@ class NameEditor: Utils.set_titles(self.window, alt_title, tmsg, _('Alternate Name Editor')) self.sourcetab = Sources.SourceTab(self.srcreflist, self.parent, - self.top, self.slist, + self.top, self.window, self.slist, self.top.get_widget('add_src'), self.top.get_widget('edit_src'), self.top.get_widget('del_src')) diff --git a/src/Sources.py b/src/Sources.py index e24476693..7df64925a 100644 --- a/src/Sources.py +++ b/src/Sources.py @@ -53,17 +53,15 @@ class SourceSelector: self.list.append(RelLib.SourceRef(s)) self.update=update self.top = gtk.glade.XML(const.srcselFile,"sourcesel","gramps") - self.sourcesel = self.top.get_widget("sourcesel") + self.window = self.top.get_widget("sourcesel") - Utils.set_titles(self.sourcesel, self.top.get_widget('title'), + Utils.set_titles(self.window, self.top.get_widget('title'), _('Source Reference Selection')) self.top.signal_autoconnect({ - "destroy_passed_object" : Utils.destroy_passed_object, "on_add_src_clicked" : self.add_src_clicked, "on_del_src_clicked" : self.del_src_clicked, "on_edit_src_clicked" : self.edit_src_clicked, - "on_src_ok_clicked" : self.src_ok_clicked, }) self.slist = self.top.get_widget("slist") @@ -90,7 +88,14 @@ class SourceSelector: self.delete.set_sensitive(gtk.FALSE) self.edit.set_sensitive(gtk.FALSE) self.redraw() - self.sourcesel.show() + if self.parent: + self.window.set_transient_for(self.parent.window) + + self.window.show() + val = self.window.run() + if val == gtk.RESPONSE_OK: + self.src_ok_clicked() + self.window.destroy() def selection_changed(self,obj): (store,iter) = self.selection.get_selected() @@ -108,13 +113,12 @@ class SourceSelector: iter = self.model.append() self.model.set(iter,0,base.getId(),1,base.getTitle()) - def src_ok_clicked(self,obj): + def src_ok_clicked(self): del self.orig[:] for s in self.list: self.orig.append(s) if self.update: self.update(self.orig) - Utils.destroy_passed_object(self.sourcesel) def edit_src_clicked(self,obj): store,iter = self.selection.get_selected() @@ -148,11 +152,12 @@ class SourceSelector: # #------------------------------------------------------------------------- class SourceTab: - def __init__(self,srclist,parent,top,clist,add_btn,edit_btn,del_btn): + def __init__(self,srclist,parent,top,window,clist,add_btn,edit_btn,del_btn): self.db = parent.db self.parent = parent self.list = srclist self.top = top + self.window = window self.slist = clist self.selection = clist.get_selection() self.model = gtk.ListStore(gobject.TYPE_STRING, gobject.TYPE_STRING) @@ -234,10 +239,8 @@ class SourceEditor: _('Source Information')) self.showSource.signal_autoconnect({ - "on_sourceok_clicked" : self.on_sourceok_clicked, "on_source_changed" : self.on_source_changed, "on_add_src_clicked" : self.add_src_clicked, - "destroy_passed_object" : Utils.destroy_passed_object }) self.source_field = self.get_widget("sourceList") self.title_menu = self.get_widget("source_title") @@ -262,6 +265,12 @@ class SourceEditor: self.draw(self.active_source) self.set_button() self.sourceDisplay.show() + if self.parent: + self.sourceDisplay.set_transient_for(self.parent.window) + val = self.sourceDisplay.run() + if val == gtk.RESPONSE_OK: + self.on_sourceok_clicked() + self.sourceDisplay.destroy() def set_button(self): if self.active_source: @@ -322,7 +331,7 @@ class SourceEditor: else: self.title_menu.set_sensitive(0) - def on_sourceok_clicked(self,obj): + def on_sourceok_clicked(self): if self.active_source != self.source_ref.getBase(): self.source_ref.setBase(self.active_source) @@ -352,7 +361,6 @@ class SourceEditor: self.update(self.parent,self.source_ref) Utils.modified() - Utils.destroy_passed_object(obj) def on_source_changed(self,obj): sel = obj.list.get_selection() diff --git a/src/srcsel.glade b/src/srcsel.glade index 0660da8a7..7ce89a3cf 100644 --- a/src/srcsel.glade +++ b/src/srcsel.glade @@ -35,8 +35,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 - + -6 @@ -49,8 +48,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 - + -5 @@ -744,8 +742,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 - + -6 @@ -757,8 +754,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 - + -5