Add person from choose parents dialog

svn: r434
This commit is contained in:
Don Allingham 2001-09-27 23:54:12 +00:00
parent cc71b8684f
commit c319d27a2d
8 changed files with 533 additions and 35 deletions

View File

@ -1139,6 +1139,7 @@ def save_person(obj):
del m[person.getId()]
m[idval] = person
person.setId(idval)
utils.modified()
else:
n = Config.nameof(m[idval])
msg1 = _("GRAMPS ID value was not changed.")

View File

@ -107,6 +107,7 @@ class Marriage:
self.descr_field = self.get_widget("marriageDescription")
self.type_field = self.get_widget("marriage_type")
self.notes_field = self.get_widget("marriageNotes")
self.gid = self.get_widget("gid")
self.attr_list = self.get_widget("attr_list")
self.attr_type = self.get_widget("attr_type")
self.attr_value = self.get_widget("attr_value")
@ -126,6 +127,8 @@ class Marriage:
self.type_field.set_popdown_strings(const.familyRelations)
frel = const.display_frel(family.getRelationship())
self.type_field.entry.set_text(frel)
self.gid.set_text(family.getId())
self.gid.set_editable(Config.id_edit)
# stored object data
top_window.set_data(MARRIAGE,self)
@ -232,6 +235,10 @@ def did_data_change(obj):
if family_obj.lists_changed:
changed = 1
idval = family_obj.gid.get_text()
if family_obj.family.getId() != idval:
changed = 1
return changed
#-------------------------------------------------------------------------
@ -283,6 +290,20 @@ def on_delete_event(obj,b):
def on_close_marriage_editor(obj):
family_obj = obj.get_data(MARRIAGE)
idval = family_obj.gid.get_text()
family = family_obj.family
if idval != family.getId():
m = family_obj.db.getFamilyMap()
if not m.has_key(idval):
if m.has_key(family.getId()):
del m[family.getId()]
m[idval] = family
family.setId(idval)
utils.modified()
else:
msg1 = _("GRAMPS ID value was not changed.")
GnomeWarningDialog("%s" % msg1)
relation = family_obj.type_field.entry.get_text()
if const.save_frel(relation) != family_obj.family.getRelationship():
father = family_obj.family.getFather()

View File

@ -2934,6 +2934,7 @@
<widget>
<class>GtkVBox</class>
<name>vbox13</name>
<width>475</width>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
@ -2983,7 +2984,6 @@
<widget>
<class>GtkLabel</class>
<name>mlabel</name>
<width>100</width>
<label>Mother</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
@ -3013,6 +3013,25 @@
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button123</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_addmother_clicked</handler>
<object>prel</object>
<last_modification_time>Thu, 27 Sep 2001 23:08:17 GMT</last_modification_time>
</signal>
<label>Add</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
@ -3158,7 +3177,6 @@ Unknown
<widget>
<class>GtkLabel</class>
<name>flabel</name>
<width>100</width>
<label>Father</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
@ -3187,6 +3205,25 @@ Unknown
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkButton</class>
<name>button124</name>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_addfather_clicked</handler>
<object>prel</object>
<last_modification_time>Thu, 27 Sep 2001 23:08:33 GMT</last_modification_time>
</signal>
<label>Add</label>
<relief>GTK_RELIEF_NORMAL</relief>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
</widget>
<widget>
@ -5705,4 +5742,311 @@ Unknown
</widget>
</widget>
<widget>
<class>GnomeDialog</class>
<name>addperson</name>
<title>Gramps - Edit Person</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>True</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>vbox42</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>hbuttonbox25</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button121</name>
<can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>on_addfather_close</handler>
<object>addperson</object>
<last_modification_time>Thu, 27 Sep 2001 23:21:01 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>button122</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<signal>
<name>clicked</name>
<handler>destroy_passed_object</handler>
<object>addperson</object>
<last_modification_time>Wed, 14 Feb 2001 02:53:18 GMT</last_modification_time>
</signal>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkVBox</class>
<name>vbox43</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label239</name>
<label>Add Person</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<padding>5</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator23</name>
<child>
<padding>10</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkTable</class>
<name>table26</name>
<rows>3</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label240</name>
<label>Surname</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>5</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label241</name>
<label>Gender</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>5</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>given</name>
<width>250</width>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>surname</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>5</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkHBox</class>
<name>hbox32</name>
<homogeneous>True</homogeneous>
<spacing>0</spacing>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>5</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkRadioButton</class>
<name>male</name>
<can_focus>True</can_focus>
<label>male</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
<group>childGender</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
<widget>
<class>GtkRadioButton</class>
<name>female</name>
<can_focus>True</can_focus>
<label>female</label>
<active>True</active>
<draw_indicator>True</draw_indicator>
<group>childGender</group>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
</child>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<name>label242</name>
<label>Given Name</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>5</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>5</xpad>
<ypad>5</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -679,6 +679,8 @@ def on_choose_parents_clicked(obj):
"on_motherList_select_row" : on_mother_list_select_row,
"on_fatherList_select_row" : on_father_list_select_row,
"on_save_parents_clicked" : on_save_parents_clicked,
"on_addmother_clicked" : on_addmother_clicked,
"on_addfather_clicked" : on_addfather_clicked,
"on_prel_changed" : on_prel_changed,
"destroy_passed_object" : utils.destroy_passed_object
})
@ -1476,6 +1478,53 @@ def load_new_person(obj):
active_person = Person()
EditPerson.EditPerson(active_person,database,new_after_edit)
def on_addfather_clicked(obj):
xml = libglade.GladeXML(const.gladeFile,"addperson")
top = xml.get_widget("addperson")
xml.get_widget("male").set_active(1)
xml.signal_autoconnect({
"on_addfather_close": on_addparent_close,
"destroy_passed_object" : utils.destroy_passed_object
})
top.set_data("o",obj)
top.set_data("xml",xml)
def on_addmother_clicked(obj):
xml = libglade.GladeXML(const.gladeFile,"addperson")
top = xml.get_widget("addperson")
xml.get_widget("female").set_active(1)
xml.signal_autoconnect({
"on_addfather_close": on_addparent_close,
"destroy_passed_object" : utils.destroy_passed_object
})
top.set_data("o",obj)
top.set_data("xml",xml)
def on_addparent_close(obj):
global select_father
global select_mother
prel = obj.get_data("o")
xml = obj.get_data("xml")
surname = xml.get_widget("surname").get_text()
given = xml.get_widget("given").get_text()
person = Person()
database.addPerson(person)
name = Name()
name.setSurname(surname)
name.setFirstName(given)
person.setPrimaryName(name)
if xml.get_widget("male").get_active():
person.setGender(Person.male)
select_father = person
else:
person.setGender(Person.female)
select_mother = person
utils.modified()
on_prel_changed(prel)
utils.destroy_passed_object(obj)
#-------------------------------------------------------------------------
#
#

View File

@ -130,7 +130,7 @@
<widget>
<class>GtkHBox</class>
<name>hbox15</name>
<name>hbox16</name>
<homogeneous>False</homogeneous>
<spacing>0</spacing>
<child>
@ -140,47 +140,130 @@
</child>
<widget>
<class>GtkLabel</class>
<name>label202</name>
<label>Relationship Type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0.5</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>10</ypad>
<child>
<padding>4</padding>
<expand>False</expand>
<fill>False</fill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>marriage_type</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<class>GtkTable</class>
<name>table10</name>
<rows>2</rows>
<columns>2</columns>
<homogeneous>False</homogeneous>
<row_spacing>0</row_spacing>
<column_spacing>0</column_spacing>
<child>
<padding>5</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label202</name>
<label>Relationship Type</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>5</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>marriage_type</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items></items>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>combo-entry1</name>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>
<class>GtkLabel</class>
<name>label229</name>
<label>gramps ID</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>5</xpad>
<ypad>5</ypad>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>combo-entry1</name>
<name>gid</name>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>True</editable>
<editable>False</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
</widget>
</widget>

View File

@ -249,7 +249,7 @@
<name>private</name>
<border_width>3</border_width>
<can_focus>True</can_focus>
<label>Do not include records marked &quot;Private&quot;</label>
<label>Do not include records marked private</label>
<active>True</active>
<draw_indicator>True</draw_indicator>
<child>

View File

@ -293,7 +293,7 @@
<name>private</name>
<border_width>3</border_width>
<can_focus>True</can_focus>
<label>Do not include records marked &quot;Private&quot;</label>
<label>Do not include records marked private</label>
<active>True</active>
<draw_indicator>True</draw_indicator>
<child>

View File

@ -427,7 +427,7 @@
<name>private</name>
<border_width>3</border_width>
<can_focus>True</can_focus>
<label>Do not include records marked &quot;Private&quot;</label>
<label>Do not include records marked private</label>
<active>True</active>
<draw_indicator>True</draw_indicator>
<child>