Add last name completion to the 'add person' dialog within the 'Choose

Parents' dialog.  When new people are added this way, make sure the
main people list gets updated.


svn: r521
This commit is contained in:
David Hampton 2001-10-30 03:48:57 +00:00
parent 9d086224f1
commit 33fd3137f3
3 changed files with 55 additions and 28 deletions

View File

@ -57,11 +57,12 @@ import Config
class ChooseParents: class ChooseParents:
def __init__(self,db,person,family,update): def __init__(self,db,person,family,family_update,full_update):
self.db = db self.db = db
self.person = person self.person = person
self.family = family self.family = family
self.update = update self.family_update = family_update
self.full_update = full_update
if self.family: if self.family:
self.father = self.family.getFather() self.father = self.family.getFather()
@ -238,19 +239,26 @@ class ChooseParents:
if self.family: if self.family:
self.family.setRelationship(type) self.family.setRelationship(type)
self.change_family_type(self.family,mrel,frel) self.change_family_type(self.family,mrel,frel)
self.update(self.family) self.family_update(self.family)
def on_addparent_clicked(self,obj,sex): def on_addparent_clicked(self,obj,sex):
self.xml = libglade.GladeXML(const.gladeFile,"addperson") self.xml = libglade.GladeXML(const.gladeFile,"addperson")
self.xml.get_widget(sex).set_active(1) self.xml.get_widget(sex).set_active(1)
self.xml.signal_autoconnect({ self.xml.signal_autoconnect({
"on_addfather_close": self.on_addparent_close, "on_addfather_close": self.on_addparent_close,
"on_combo_insert_text" : utils.combo_insert_text,
"destroy_passed_object" : utils.destroy_passed_object "destroy_passed_object" : utils.destroy_passed_object
}) })
window = self.xml.get_widget("addperson") window = self.xml.get_widget("addperson")
window.editable_enters(self.xml.get_widget("given")) window.editable_enters(self.xml.get_widget("given"))
window.editable_enters(self.xml.get_widget("surname")) window.editable_enters(self.xml.get_widget("surname"))
if len(const.surnames) > 0:
const.surnames.sort()
combo = self.xml.get_widget("surnameCombo")
combo.set_popdown_strings(const.surnames)
combo.disable_activate()
self.xml.get_widget("surname").set_text("")
def on_addfather_clicked(self,obj): def on_addfather_clicked(self,obj):
self.on_addparent_clicked(obj,"male") self.on_addparent_clicked(obj,"male")
@ -330,4 +338,5 @@ class ChooseParents:
utils.modified() utils.modified()
self.on_prel_changed(self.prel) self.on_prel_changed(self.prel)
utils.destroy_passed_object(obj) utils.destroy_passed_object(obj)
self.full_update()

View File

@ -6745,30 +6745,6 @@ Unknown
</child> </child>
</widget> </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> <widget>
<class>GtkHBox</class> <class>GtkHBox</class>
<name>hbox32</name> <name>hbox32</name>
@ -6845,6 +6821,48 @@ Unknown
<yfill>False</yfill> <yfill>False</yfill>
</child> </child>
</widget> </widget>
<widget>
<class>GtkCombo</class>
<name>surnameCombo</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>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>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>surname</name>
<can_focus>True</can_focus>
<signal>
<name>insert_text</name>
<handler>on_combo_insert_text</handler>
<object>surnameCombo</object>
<last_modification_time>Sat, 27 Oct 2001 21:43:29 GMT</last_modification_time>
</signal>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
</widget> </widget>
</widget> </widget>
</widget> </widget>

View File

@ -361,7 +361,7 @@ def on_add_new_child_clicked(obj):
def on_choose_parents_clicked(obj): def on_choose_parents_clicked(obj):
import ChooseParents import ChooseParents
if active_person: if active_person:
ChooseParents.ChooseParents(database,active_person,active_parents,load_family) ChooseParents.ChooseParents(database,active_person,active_parents,load_family,full_update)
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #