* 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
This commit is contained in:
Alex Roitman 2003-11-19 03:14:14 +00:00
parent b362afd128
commit 188bfa24a9
4 changed files with 115 additions and 96 deletions

View File

@ -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 <shura@alex.neuro.umn.edu>
* src/gramps.glade: Add Help buttons to dialogs.

View File

@ -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)

View File

@ -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()

View File

@ -51,7 +51,7 @@
<accelerator key="N" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1550">
<widget class="GtkImage" id="image1626">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
<property name="icon_size">1</property>
@ -73,7 +73,7 @@
<accelerator key="O" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1551">
<widget class="GtkImage" id="image1627">
<property name="visible">True</property>
<property name="stock">gtk-open</property>
<property name="icon_size">1</property>
@ -95,7 +95,7 @@
<accelerator key="S" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1552">
<widget class="GtkImage" id="image1628">
<property name="visible">True</property>
<property name="stock">gtk-save</property>
<property name="icon_size">1</property>
@ -116,7 +116,7 @@
<signal name="activate" handler="on_save_as_activate" last_modification_time="Tue, 01 Apr 2003 03:50:28 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1553">
<widget class="GtkImage" id="image1629">
<property name="visible">True</property>
<property name="stock">gtk-save-as</property>
<property name="icon_size">1</property>
@ -150,7 +150,7 @@
<property name="use_underline">True</property>
<child internal-child="image">
<widget class="GtkImage" id="image1554">
<widget class="GtkImage" id="image1630">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
@ -171,7 +171,7 @@
<signal name="activate" handler="on_revert_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1555">
<widget class="GtkImage" id="image1631">
<property name="visible">True</property>
<property name="stock">gtk-revert-to-saved</property>
<property name="icon_size">1</property>
@ -192,7 +192,7 @@
<signal name="activate" handler="on_reload_plugins_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1556">
<widget class="GtkImage" id="image1632">
<property name="visible">True</property>
<property name="stock">gtk-refresh</property>
<property name="icon_size">1</property>
@ -220,7 +220,7 @@
<accelerator key="Q" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1557">
<widget class="GtkImage" id="image1633">
<property name="visible">True</property>
<property name="stock">gtk-quit</property>
<property name="icon_size">1</property>
@ -256,7 +256,7 @@
<accelerator key="Insert" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1558">
<widget class="GtkImage" id="image1634">
<property name="visible">True</property>
<property name="stock">gtk-add</property>
<property name="icon_size">1</property>
@ -279,7 +279,7 @@
<accelerator key="Delete" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1559">
<widget class="GtkImage" id="image1635">
<property name="visible">True</property>
<property name="stock">gtk-remove</property>
<property name="icon_size">1</property>
@ -317,7 +317,7 @@
<accelerator key="F" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1560">
<widget class="GtkImage" id="image1636">
<property name="visible">True</property>
<property name="stock">gtk-find</property>
<property name="icon_size">1</property>
@ -339,7 +339,7 @@
<accelerator key="M" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1561">
<widget class="GtkImage" id="image1637">
<property name="visible">True</property>
<property name="stock">gtk-convert</property>
<property name="icon_size">1</property>
@ -351,6 +351,54 @@
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="separator11">
<property name="visible">True</property>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="preferences1">
<property name="visible">True</property>
<property name="label" translatable="yes">Prefere_nces...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_preferences1_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1638">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="default_person1">
<property name="visible">True</property>
<property name="label" translatable="yes">Set _Home person...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_default_person_activate" last_modification_time="Sat, 16 Aug 2003 01:58:26 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1639">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
@ -425,7 +473,7 @@
<accelerator key="D" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1562">
<widget class="GtkImage" id="image1640">
<property name="visible">True</property>
<property name="stock">gtk-index</property>
<property name="icon_size">1</property>
@ -447,7 +495,7 @@
<accelerator key="B" modifiers="GDK_CONTROL_MASK" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1563">
<widget class="GtkImage" id="image1641">
<property name="visible">True</property>
<property name="stock">gnome-stock-book-open</property>
<property name="icon_size">1</property>
@ -494,61 +542,6 @@
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="settings1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Settings</property>
<property name="use_underline">True</property>
<child>
<widget class="GtkMenu" id="settings1_menu">
<child>
<widget class="GtkImageMenuItem" id="preferences1">
<property name="visible">True</property>
<property name="label" translatable="yes">Prefere_nces...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_preferences1_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1564">
<property name="visible">True</property>
<property name="stock">gtk-preferences</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkImageMenuItem" id="default_person1">
<property name="visible">True</property>
<property name="label" translatable="yes">_Home person...</property>
<property name="use_underline">True</property>
<signal name="activate" handler="on_default_person_activate" last_modification_time="Sat, 16 Aug 2003 01:58:26 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1565">
<property name="visible">True</property>
<property name="stock">gtk-home</property>
<property name="icon_size">1</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
</child>
</widget>
</child>
</widget>
</child>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="help1">
<property name="visible">True</property>
@ -567,7 +560,7 @@
<accelerator key="F1" modifiers="0" signal="activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1566">
<widget class="GtkImage" id="image1642">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon_size">1</property>
@ -594,7 +587,7 @@
<signal name="activate" handler="on_gramps_home_page_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1567">
<widget class="GtkImage" id="image1643">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
<property name="icon_size">1</property>
@ -615,7 +608,7 @@
<signal name="activate" handler="on_gramps_mailing_lists_activate"/>
<child internal-child="image">
<widget class="GtkImage" id="image1568">
<widget class="GtkImage" id="image1644">
<property name="visible">True</property>
<property name="stock">gnome-stock-mail</property>
<property name="icon_size">1</property>
@ -669,7 +662,7 @@
<signal name="activate" handler="on_about_activate" last_modification_time="Tue, 01 Apr 2003 03:44:24 GMT"/>
<child internal-child="image">
<widget class="GtkImage" id="image1569">
<widget class="GtkImage" id="image1645">
<property name="visible">True</property>
<property name="stock">gnome-stock-about</property>
<property name="icon_size">1</property>
@ -4006,7 +3999,7 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<property name="response_id">-6</property>
<signal name="clicked" handler="destroy_passed_object" object="familyDialog"/>
</widget>
</child>
@ -4020,7 +4013,7 @@
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<property name="response_id">-5</property>
<signal name="clicked" handler="on_save_parents_clicked" object="familyDialog"/>
</widget>
</child>
@ -6580,8 +6573,7 @@
<property name="label">gtk-cancel</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<signal name="clicked" handler="destroy_passed_object" object="familyDialog"/>
<property name="response_id">-6</property>
</widget>
</child>
@ -6594,8 +6586,7 @@
<property name="label">gtk-ok</property>
<property name="use_stock">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="response_id">0</property>
<signal name="clicked" handler="on_save_parents_clicked" object="familyDialog"/>
<property name="response_id">-5</property>
</widget>
</child>