From b382ac04766a4b39429e80ae713588fbd40322d8 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Wed, 19 Nov 2003 03:14:14 +0000 Subject: [PATCH] * src/ChooseParents.py (ModifyParents.__init__): Make the dialog modal and a transient for its parent; (ModifyParents.on_help_clicked): Add function; (ChooseParents.__init__): Make the dialog modal and a transient for its parent; (ChooseParents.on_help_clicked): Add function. * src/FamilyView.py: Pass the window to the ChooseParents classes. svn: r2349 --- gramps2/ChangeLog | 6 ++ gramps2/src/ChooseParents.py | 48 +++++++---- gramps2/src/FamilyView.py | 8 +- gramps2/src/gramps.glade | 149 ++++++++++++++++------------------- 4 files changed, 115 insertions(+), 96 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 9a3802a1d..218bc331c 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -2,6 +2,12 @@ * src/NameEdit.py (on_help_clicked): Add function. * src/UrlEdit.py (on_help_clicked): Add function. * src/gramps.glade: Add hot keys to the family view list labels. + * src/ChooseParents.py (ModifyParents.__init__): Make the dialog modal + and a transient for its parent; (ModifyParents.on_help_clicked): Add + function; (ChooseParents.__init__): Make the dialog modal and a + transient for its parent; (ChooseParents.on_help_clicked): + Add function. + * src/FamilyView.py: Pass the window to the ChooseParents classes. 2003-11-17 Alex Roitman * src/gramps.glade: Add Help buttons to dialogs. diff --git a/gramps2/src/ChooseParents.py b/gramps2/src/ChooseParents.py index bd87963a0..47a782be2 100644 --- a/gramps2/src/ChooseParents.py +++ b/gramps2/src/ChooseParents.py @@ -18,6 +18,8 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # +# $Id$ + """ ChooseParents interface allows users to select the paretns of an individual. @@ -39,6 +41,7 @@ from gettext import gettext as _ # #------------------------------------------------------------------------- import gtk.glade +import gnome #------------------------------------------------------------------------- # @@ -63,7 +66,7 @@ class ChooseParents: Displays the Choose Parents dialog box, allowing the parents to be edited. """ - def __init__(self,db,person,family,family_update,full_update): + def __init__(self,db,person,family,family_update,full_update,parent_window=None): """ Creates a ChoosePerson dialog box. @@ -136,14 +139,25 @@ class ChooseParents: self.redrawm() self.glade.signal_autoconnect({ - "on_save_parents_clicked" : self.save_parents_clicked, "on_add_parent_clicked" : self.add_parent_clicked, "on_prel_changed" : self.parent_relation_changed, "on_showallf_toggled" : self.showallf_toggled, "on_showallm_toggled" : self.showallm_toggled, - "destroy_passed_object" : Utils.destroy_passed_object + "on_help_familyDialog_clicked" : self.on_help_clicked, }) + if parent_window: + self.top.set_transient_for(parent_window) + self.val = self.top.run() + if self.val == gtk.RESPONSE_OK: + self.save_parents_clicked() + self.top.destroy() + + def on_help_clicked(self,obj): + """Display the relevant portion of GRAMPS manual""" + gnome.help_display('gramps-manual','gramps-spec-par') + self.val = self.top.run() + def redrawf(self): """Redraws the potential father list""" @@ -369,7 +383,7 @@ class ChooseParents: self.mmodel.find(mother.getId()) self.mmodel.center_selected() - def save_parents_clicked(self,obj): + def save_parents_clicked(self): """ Called with the OK button nis pressed. Saves the selected people as parents of the main perosn. @@ -409,7 +423,6 @@ class ChooseParents: else: self.family = None - Utils.destroy_passed_object(obj) if self.family: self.family.setRelationship(self.type) self.change_family_type(self.family,mother_rel,father_rel) @@ -477,7 +490,7 @@ class ChooseParents: class ModifyParents: - def __init__(self,db,person,family,family_update,full_update): + def __init__(self,db,person,family,family_update,full_update,parent_window=None): """ Creates a ChoosePerson dialog box. @@ -519,8 +532,7 @@ class ModifyParents: self.father_rel.set_text(self.orig_frel) self.glade.signal_autoconnect({ - "on_save_parents_clicked" : self.save_parents_clicked, - "destroy_passed_object" : self.quit, + "on_parents_help_clicked" : self.on_help_clicked, }) self.title.set_use_markup(gtk.TRUE) @@ -554,13 +566,20 @@ class ModifyParents: else: self.pref.set_active(0) - self.top.show() - - - def quit(self,obj): + if parent_window: + self.top.set_transient_for(parent_window) + self.val = self.top.run() + if self.val == gtk.RESPONSE_OK: + self.save_parents_clicked() self.top.destroy() - - def save_parents_clicked(self,obj): + + + def on_help_clicked(self,obj): + """Display the relevant portion of GRAMPS manual""" + gnome.help_display('gramps-manual','gramps-spec-par') + self.val = self.top.run() + + def save_parents_clicked(self): """ Called with the OK button nis pressed. Saves the selected people as parents of the main perosn. @@ -569,7 +588,6 @@ class ModifyParents: father_rel = const.childRelations[self.father_rel.get_text()] mod = 0 - Utils.destroy_passed_object(self.top) if mother_rel != self.orig_mrel or father_rel != self.orig_frel: self.person.removeAltFamily(self.family) self.person.addAltFamily(self.family,mother_rel,father_rel) diff --git a/gramps2/src/FamilyView.py b/gramps2/src/FamilyView.py index 9d5bc96ad..54b7e61cd 100644 --- a/gramps2/src/FamilyView.py +++ b/gramps2/src/FamilyView.py @@ -996,7 +996,9 @@ class FamilyView: try: ChooseParents.ModifyParents(self.parent.db,person,parents, - self.load_family,self.parent.full_update) + self.load_family, + self.parent.full_update, + self.parent.topWindow) except: DisplayTrace.DisplayTrace() @@ -1005,7 +1007,9 @@ class FamilyView: return try: ChooseParents.ChooseParents(self.parent.db,person,None, - self.load_family,self.parent.full_update) + self.load_family, + self.parent.full_update, + self.parent.topWindow) except: DisplayTrace.DisplayTrace() diff --git a/gramps2/src/gramps.glade b/gramps2/src/gramps.glade index ebb01cc70..6f6b7488f 100644 --- a/gramps2/src/gramps.glade +++ b/gramps2/src/gramps.glade @@ -51,7 +51,7 @@ - + True gtk-new 1 @@ -73,7 +73,7 @@ - + True gtk-open 1 @@ -95,7 +95,7 @@ - + True gtk-save 1 @@ -116,7 +116,7 @@ - + True gtk-save-as 1 @@ -150,7 +150,7 @@ True - + True gtk-convert 1 @@ -171,7 +171,7 @@ - + True gtk-revert-to-saved 1 @@ -192,7 +192,7 @@ - + True gtk-refresh 1 @@ -220,7 +220,7 @@ - + True gtk-quit 1 @@ -256,7 +256,7 @@ - + True gtk-add 1 @@ -279,7 +279,7 @@ - + True gtk-remove 1 @@ -317,7 +317,7 @@ - + True gtk-find 1 @@ -339,7 +339,7 @@ - + True gtk-convert 1 @@ -351,6 +351,54 @@ + + + + True + + + + + + True + Prefere_nces... + True + + + + + True + gtk-preferences + 1 + 0.5 + 0.5 + 0 + 0 + + + + + + + + True + Set _Home person... + True + + + + + True + gtk-home + 1 + 0.5 + 0.5 + 0 + 0 + + + + @@ -425,7 +473,7 @@ - + True gtk-index 1 @@ -447,7 +495,7 @@ - + True gnome-stock-book-open 1 @@ -494,61 +542,6 @@ - - - True - _Settings - True - - - - - - - True - Prefere_nces... - True - - - - - True - gtk-preferences - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - _Home person... - True - - - - - True - gtk-home - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - - True @@ -567,7 +560,7 @@ - + True gtk-help 1 @@ -594,7 +587,7 @@ - + True gtk-jump-to 1 @@ -615,7 +608,7 @@ - + True gnome-stock-mail 1 @@ -669,7 +662,7 @@ - + True gnome-stock-about 1 @@ -4006,7 +3999,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 + -6 @@ -4020,7 +4013,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 + -5 @@ -6580,8 +6573,7 @@ gtk-cancel True GTK_RELIEF_NORMAL - 0 - + -6 @@ -6594,8 +6586,7 @@ gtk-ok True GTK_RELIEF_NORMAL - 0 - + -5