Added the ability to add a new person as the spouse
svn: r362
This commit is contained in:
parent
a9bb6540a2
commit
18273e3e70
@ -74,7 +74,6 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
|
|
||||||
def __init__(self,database,callback,base):
|
def __init__(self,database,callback,base):
|
||||||
self.call = None
|
|
||||||
self.stext_list = []
|
self.stext_list = []
|
||||||
self.scomments_list = []
|
self.scomments_list = []
|
||||||
self.note_list = []
|
self.note_list = []
|
||||||
@ -202,11 +201,11 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
def start_event(self,attrs):
|
def start_event(self,attrs):
|
||||||
self.event = Event()
|
self.event = Event()
|
||||||
self.event_type = u2l(string.capwords(attrs["type"]))
|
self.event_type = u2l(attrs["type"])
|
||||||
if attrs.has_key("conf"):
|
if attrs.has_key("conf"):
|
||||||
self.event.confidence = string.atoi(attrs["conf"])
|
self.event.confidence = int(attrs["conf"])
|
||||||
if attrs.has_key("priv"):
|
if attrs.has_key("priv"):
|
||||||
self.event.private = string.atoi(attrs["priv"])
|
self.event.private = int(attrs["priv"])
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -216,12 +215,12 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
def start_attribute(self,attrs):
|
def start_attribute(self,attrs):
|
||||||
self.attribute = Attribute()
|
self.attribute = Attribute()
|
||||||
if attrs.has_key("conf"):
|
if attrs.has_key("conf"):
|
||||||
self.attribute.confidence = string.atoi(attrs["conf"])
|
self.attribute.confidence = int(attrs["conf"])
|
||||||
if attrs.has_key("priv"):
|
if attrs.has_key("priv"):
|
||||||
self.attribute.privacy = string.atoi(attrs["priv"])
|
self.attribute.privacy = int(attrs["priv"])
|
||||||
if attrs.has_key('type'):
|
if attrs.has_key('type'):
|
||||||
self.in_old_attr = 1
|
self.in_old_attr = 1
|
||||||
self.attribute.setType(u2l(string.capwords(attrs["type"])))
|
self.attribute.setType(u2l(attrs["type"]))
|
||||||
else:
|
else:
|
||||||
self.in_old_attr = 0
|
self.in_old_attr = 0
|
||||||
if self.person:
|
if self.person:
|
||||||
@ -238,9 +237,9 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
self.address = Address()
|
self.address = Address()
|
||||||
self.person.addAddress(self.address)
|
self.person.addAddress(self.address)
|
||||||
if attrs.has_key("conf"):
|
if attrs.has_key("conf"):
|
||||||
self.address.confidence = string.atoi(attrs["conf"])
|
self.address.confidence = int(attrs["conf"])
|
||||||
if attrs.has_key("priv"):
|
if attrs.has_key("priv"):
|
||||||
self.address.private = string.atoi(attrs["priv"])
|
self.address.private = int(attrs["priv"])
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -257,7 +256,7 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
#
|
#
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
def start_person(self,attrs):
|
def start_person(self,attrs):
|
||||||
if self.count % self.increment == 0:
|
if self.callback != None and self.count % self.increment == 0:
|
||||||
self.callback(float(self.count)/float(self.entries))
|
self.callback(float(self.count)/float(self.entries))
|
||||||
self.count = self.count + 1
|
self.count = self.count + 1
|
||||||
self.person = self.db.findPersonNoMap(u2l(attrs["id"]))
|
self.person = self.db.findPersonNoMap(u2l(attrs["id"]))
|
||||||
@ -314,7 +313,7 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
url.set_path(u2l(attrs["href"]))
|
url.set_path(u2l(attrs["href"]))
|
||||||
url.set_description(desc)
|
url.set_description(desc)
|
||||||
if attrs.has_key("priv"):
|
if attrs.has_key("priv"):
|
||||||
url.setPrivacy(string.atoi(attrs['priv']))
|
url.setPrivacy(int(attrs['priv']))
|
||||||
if self.person:
|
if self.person:
|
||||||
self.person.addUrl(url)
|
self.person.addUrl(url)
|
||||||
elif self.placeobj:
|
elif self.placeobj:
|
||||||
@ -328,7 +327,7 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
#
|
#
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
def start_family(self,attrs):
|
def start_family(self,attrs):
|
||||||
if self.count % self.increment == 0:
|
if self.callback != None and self.count % self.increment == 0:
|
||||||
self.callback(float(self.count)/float(self.entries))
|
self.callback(float(self.count)/float(self.entries))
|
||||||
self.count = self.count + 1
|
self.count = self.count + 1
|
||||||
self.family = self.db.findFamilyNoMap(u2l(attrs["id"]))
|
self.family = self.db.findFamilyNoMap(u2l(attrs["id"]))
|
||||||
@ -379,9 +378,9 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
def start_name(self,attrs):
|
def start_name(self,attrs):
|
||||||
self.name = Name()
|
self.name = Name()
|
||||||
if attrs.has_key("conf"):
|
if attrs.has_key("conf"):
|
||||||
self.name.confidence = string.atoi(attrs["conf"])
|
self.name.confidence = int(attrs["conf"])
|
||||||
if attrs.has_key("priv"):
|
if attrs.has_key("priv"):
|
||||||
self.name.private = string.atoi(attrs["priv"])
|
self.name.private = int(attrs["priv"])
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -517,14 +516,15 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
def stop_event(self,tag):
|
def stop_event(self,tag):
|
||||||
self.event.name = self.event_type
|
self.event.name = self.event_type
|
||||||
|
|
||||||
if self.event_type == "Birth":
|
if self.family:
|
||||||
self.person.setBirth(self.event)
|
|
||||||
elif self.event_type == "Death":
|
|
||||||
self.person.setDeath(self.event)
|
|
||||||
elif self.person:
|
|
||||||
self.person.EventList.append(self.event)
|
|
||||||
else:
|
|
||||||
self.family.EventList.append(self.event)
|
self.family.EventList.append(self.event)
|
||||||
|
else:
|
||||||
|
if self.event_type == "Birth":
|
||||||
|
self.person.setBirth(self.event)
|
||||||
|
elif self.event_type == "Death":
|
||||||
|
self.person.setDeath(self.event)
|
||||||
|
else:
|
||||||
|
self.person.EventList.append(self.event)
|
||||||
self.event = None
|
self.event = None
|
||||||
|
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
@ -884,6 +884,8 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
|
|
||||||
func_map = {
|
func_map = {
|
||||||
"address" : (start_address, stop_address),
|
"address" : (start_address, stop_address),
|
||||||
|
"addresses" : (None,None),
|
||||||
|
"childlist" : (None,None),
|
||||||
"aka" : (start_name, stop_aka),
|
"aka" : (start_name, stop_aka),
|
||||||
"attribute" : (start_attribute, stop_attribute),
|
"attribute" : (start_attribute, stop_attribute),
|
||||||
"attr_type" : (None,stop_attr_type),
|
"attr_type" : (None,stop_attr_type),
|
||||||
@ -986,8 +988,6 @@ class GrampsParser(handler.ContentHandler):
|
|||||||
if self.func:
|
if self.func:
|
||||||
self.data = self.data + data
|
self.data = self.data + data
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Gramps database parsing class. Derived from SAX XML parser
|
# Gramps database parsing class. Derived from SAX XML parser
|
||||||
@ -1010,7 +1010,7 @@ class GrampsImportParser(GrampsParser):
|
|||||||
#
|
#
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
def start_person(self,attrs):
|
def start_person(self,attrs):
|
||||||
if self.count % self.increment == 0:
|
if self.callback != None and self.count % self.increment == 0:
|
||||||
self.callback(float(self.count)/float(self.entries))
|
self.callback(float(self.count)/float(self.entries))
|
||||||
self.count = self.count + 1
|
self.count = self.count + 1
|
||||||
self.person = self.db.findPerson("x%s" % u2l(attrs["id"]),self.pmap)
|
self.person = self.db.findPerson("x%s" % u2l(attrs["id"]),self.pmap)
|
||||||
@ -1048,7 +1048,7 @@ class GrampsImportParser(GrampsParser):
|
|||||||
#
|
#
|
||||||
#---------------------------------------------------------------------
|
#---------------------------------------------------------------------
|
||||||
def start_family(self,attrs):
|
def start_family(self,attrs):
|
||||||
if self.count % self.increment == 0:
|
if self.callback != None and self.count % self.increment == 0:
|
||||||
self.callback(float(self.count)/float(self.entries))
|
self.callback(float(self.count)/float(self.entries))
|
||||||
self.count = self.count + 1
|
self.count = self.count + 1
|
||||||
self.family = self.db.findFamily(u2l(attrs["id"]),self.fmap)
|
self.family = self.db.findFamily(u2l(attrs["id"]),self.fmap)
|
||||||
|
@ -106,7 +106,7 @@ def importData(database, filename, callback):
|
|||||||
# of data.
|
# of data.
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def loadData(database, filename, callback):
|
def loadData(database, filename, callback=None):
|
||||||
|
|
||||||
basefile = os.path.dirname(filename)
|
basefile = os.path.dirname(filename)
|
||||||
database.smap = {}
|
database.smap = {}
|
||||||
@ -133,7 +133,8 @@ def loadData(database, filename, callback):
|
|||||||
else:
|
else:
|
||||||
xml_file = open(filename,"r")
|
xml_file = open(filename,"r")
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
GnomeErrorDialog(_("%s could not be opened\n") % filename + str(msg))
|
filemsg = _("%s could not be opened\n") % filename
|
||||||
|
GnomeErrorDialog(filemsg + str(msg))
|
||||||
return 0
|
return 0
|
||||||
except:
|
except:
|
||||||
GnomeErrorDialog(_("%s could not be opened\n") % filename)
|
GnomeErrorDialog(_("%s could not be opened\n") % filename)
|
||||||
@ -149,7 +150,8 @@ def loadData(database, filename, callback):
|
|||||||
GnomeErrorDialog("%s\n%s" % (filemsg,errmsg))
|
GnomeErrorDialog("%s\n%s" % (filemsg,errmsg))
|
||||||
return 0
|
return 0
|
||||||
except IOError,msg:
|
except IOError,msg:
|
||||||
GnomeErrorDialog(_("Error reading %s") % filename + "\n" + str(msg))
|
errmsg = "%s\n%s" % (_("Error reading %s"),filename,str(msg))
|
||||||
|
GnomeErrorDialog(errmsg)
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
return 0
|
return 0
|
||||||
@ -161,3 +163,16 @@ def loadData(database, filename, callback):
|
|||||||
|
|
||||||
xml_file.close()
|
xml_file.close()
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
import sys
|
||||||
|
import time
|
||||||
|
import profile
|
||||||
|
|
||||||
|
database = RelDataBase()
|
||||||
|
t1 = time.time()
|
||||||
|
#profile.run('loadData(database, sys.argv[1])')
|
||||||
|
loadData(database,sys.argv[1])
|
||||||
|
t2 = time.time()
|
||||||
|
print t2-t1
|
||||||
|
@ -377,6 +377,14 @@ def save_fattr(st):
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
|
|
||||||
|
_frel2def = {
|
||||||
|
_("Married") : _("A legal or common-law relationship between a husband and wife"),
|
||||||
|
_("Unmarried"): _("No legal or common-law relationship between man and woman"),
|
||||||
|
_("Partners") : _("An established relationship between members of the same sex"),
|
||||||
|
_("Unknown") : _("Unknown relationship between a man and woman"),
|
||||||
|
_("Other") : _("An unspecified relationship between a man and woman")
|
||||||
|
}
|
||||||
|
|
||||||
_fr_e2l = {
|
_fr_e2l = {
|
||||||
"Married" : _("Married"),
|
"Married" : _("Married"),
|
||||||
"Unmarried" : _("Unmarried"),
|
"Unmarried" : _("Unmarried"),
|
||||||
@ -389,6 +397,17 @@ _fr_l2e = {}
|
|||||||
for a in _fa_e2l.keys():
|
for a in _fa_e2l.keys():
|
||||||
_fa_l2e[_fa_e2l[a]] = a
|
_fa_l2e[_fa_e2l[a]] = a
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
def relationship_def(txt):
|
||||||
|
if _frel2def.has_key(txt):
|
||||||
|
return _frel2def[txt]
|
||||||
|
else:
|
||||||
|
return _("No definition available")
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
|
@ -185,7 +185,7 @@
|
|||||||
<handler>on_person_list1_activate</handler>
|
<handler>on_person_list1_activate</handler>
|
||||||
<last_modification_time>Sun, 22 Oct 2000 23:07:54 GMT</last_modification_time>
|
<last_modification_time>Sun, 22 Oct 2000 23:07:54 GMT</last_modification_time>
|
||||||
</signal>
|
</signal>
|
||||||
<label>Person _List</label>
|
<label>_People</label>
|
||||||
<right_justify>False</right_justify>
|
<right_justify>False</right_justify>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
@ -209,7 +209,7 @@
|
|||||||
<handler>on_pedegree1_activate</handler>
|
<handler>on_pedegree1_activate</handler>
|
||||||
<last_modification_time>Sun, 22 Oct 2000 23:08:36 GMT</last_modification_time>
|
<last_modification_time>Sun, 22 Oct 2000 23:08:36 GMT</last_modification_time>
|
||||||
</signal>
|
</signal>
|
||||||
<label>_Pedigree</label>
|
<label>Pe_digree</label>
|
||||||
<right_justify>False</right_justify>
|
<right_justify>False</right_justify>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
@ -233,7 +233,7 @@
|
|||||||
<handler>on_places_activate</handler>
|
<handler>on_places_activate</handler>
|
||||||
<last_modification_time>Tue, 14 Aug 2001 13:39:34 GMT</last_modification_time>
|
<last_modification_time>Tue, 14 Aug 2001 13:39:34 GMT</last_modification_time>
|
||||||
</signal>
|
</signal>
|
||||||
<label>_Places</label>
|
<label>P_laces</label>
|
||||||
<right_justify>False</right_justify>
|
<right_justify>False</right_justify>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -3094,8 +3094,6 @@
|
|||||||
<widget>
|
<widget>
|
||||||
<class>GtkVBox</class>
|
<class>GtkVBox</class>
|
||||||
<name>vbox11</name>
|
<name>vbox11</name>
|
||||||
<width>400</width>
|
|
||||||
<height>400</height>
|
|
||||||
<homogeneous>False</homogeneous>
|
<homogeneous>False</homogeneous>
|
||||||
<spacing>0</spacing>
|
<spacing>0</spacing>
|
||||||
|
|
||||||
@ -3110,7 +3108,7 @@
|
|||||||
<xpad>0</xpad>
|
<xpad>0</xpad>
|
||||||
<ypad>0</ypad>
|
<ypad>0</ypad>
|
||||||
<child>
|
<child>
|
||||||
<padding>10</padding>
|
<padding>5</padding>
|
||||||
<expand>False</expand>
|
<expand>False</expand>
|
||||||
<fill>False</fill>
|
<fill>False</fill>
|
||||||
</child>
|
</child>
|
||||||
@ -3118,82 +3116,21 @@
|
|||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkHSeparator</class>
|
<class>GtkHSeparator</class>
|
||||||
<name>hseparator18</name>
|
<name>hseparator21</name>
|
||||||
<child>
|
<child>
|
||||||
<padding>10</padding>
|
<padding>5</padding>
|
||||||
<expand>False</expand>
|
<expand>False</expand>
|
||||||
<fill>True</fill>
|
<fill>True</fill>
|
||||||
</child>
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkHBox</class>
|
<class>GtkFrame</class>
|
||||||
<name>hbox29</name>
|
<name>frame5</name>
|
||||||
<homogeneous>False</homogeneous>
|
<border_width>5</border_width>
|
||||||
<spacing>0</spacing>
|
<label>Select existing person as spouse</label>
|
||||||
<child>
|
<label_xalign>0</label_xalign>
|
||||||
<padding>0</padding>
|
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||||
<expand>False</expand>
|
|
||||||
<fill>True</fill>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<widget>
|
|
||||||
<class>GtkLabel</class>
|
|
||||||
<name>label228</name>
|
|
||||||
<label>Relationship Type</label>
|
|
||||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
|
||||||
<wrap>False</wrap>
|
|
||||||
<xalign>0.5</xalign>
|
|
||||||
<yalign>0.5</yalign>
|
|
||||||
<xpad>10</xpad>
|
|
||||||
<ypad>10</ypad>
|
|
||||||
<child>
|
|
||||||
<padding>0</padding>
|
|
||||||
<expand>False</expand>
|
|
||||||
<fill>False</fill>
|
|
||||||
</child>
|
|
||||||
</widget>
|
|
||||||
|
|
||||||
<widget>
|
|
||||||
<class>GtkCombo</class>
|
|
||||||
<name>rel_combo</name>
|
|
||||||
<value_in_list>True</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>
|
|
||||||
<padding>10</padding>
|
|
||||||
<expand>True</expand>
|
|
||||||
<fill>True</fill>
|
|
||||||
</child>
|
|
||||||
|
|
||||||
<widget>
|
|
||||||
<class>GtkEntry</class>
|
|
||||||
<child_name>GtkCombo:entry</child_name>
|
|
||||||
<name>rel_type</name>
|
|
||||||
<can_focus>True</can_focus>
|
|
||||||
<signal>
|
|
||||||
<name>changed</name>
|
|
||||||
<handler>on_rel_type_changed</handler>
|
|
||||||
<last_modification_time>Sat, 14 Jul 2001 15:29:20 GMT</last_modification_time>
|
|
||||||
</signal>
|
|
||||||
<editable>False</editable>
|
|
||||||
<text_visible>True</text_visible>
|
|
||||||
<text_max_length>0</text_max_length>
|
|
||||||
<text></text>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
|
||||||
|
|
||||||
<widget>
|
|
||||||
<class>GtkScrolledWindow</class>
|
|
||||||
<name>scrolledwindow9</name>
|
|
||||||
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
|
||||||
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
|
|
||||||
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
|
||||||
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
|
||||||
<child>
|
<child>
|
||||||
<padding>0</padding>
|
<padding>0</padding>
|
||||||
<expand>True</expand>
|
<expand>True</expand>
|
||||||
@ -3201,46 +3138,251 @@
|
|||||||
</child>
|
</child>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkCList</class>
|
<class>GtkScrolledWindow</class>
|
||||||
<name>spouseList</name>
|
<name>scrolledwindow9</name>
|
||||||
|
<border_width>10</border_width>
|
||||||
<width>400</width>
|
<width>400</width>
|
||||||
<height>450</height>
|
<height>200</height>
|
||||||
<can_focus>True</can_focus>
|
<hscrollbar_policy>GTK_POLICY_NEVER</hscrollbar_policy>
|
||||||
<signal>
|
<vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
|
||||||
<name>select_row</name>
|
<hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
|
||||||
<handler>on_spouseList_select_row</handler>
|
<vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
|
||||||
<last_modification_time>Sun, 19 Nov 2000 00:44:36 GMT</last_modification_time>
|
|
||||||
</signal>
|
<widget>
|
||||||
|
<class>GtkCList</class>
|
||||||
|
<name>spouseList</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<signal>
|
||||||
|
<name>select_row</name>
|
||||||
|
<handler>on_spouseList_select_row</handler>
|
||||||
|
<last_modification_time>Sun, 19 Nov 2000 00:44:36 GMT</last_modification_time>
|
||||||
|
</signal>
|
||||||
|
<columns>2</columns>
|
||||||
|
<column_widths>256,80</column_widths>
|
||||||
|
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
|
||||||
|
<show_titles>True</show_titles>
|
||||||
|
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<child_name>CList:title</child_name>
|
||||||
|
<name>label65</name>
|
||||||
|
<label>Name</label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0.5</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<child_name>CList:title</child_name>
|
||||||
|
<name>label66</name>
|
||||||
|
<label>Birthdate</label>
|
||||||
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
|
<wrap>False</wrap>
|
||||||
|
<xalign>0.5</xalign>
|
||||||
|
<yalign>0.5</yalign>
|
||||||
|
<xpad>0</xpad>
|
||||||
|
<ypad>0</ypad>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkFrame</class>
|
||||||
|
<name>frame4</name>
|
||||||
|
<border_width>5</border_width>
|
||||||
|
<label>Add new person as spouse</label>
|
||||||
|
<label_xalign>0</label_xalign>
|
||||||
|
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||||
|
<child>
|
||||||
|
<padding>5</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkTable</class>
|
||||||
|
<name>table25</name>
|
||||||
|
<rows>2</rows>
|
||||||
<columns>2</columns>
|
<columns>2</columns>
|
||||||
<column_widths>203,80</column_widths>
|
<homogeneous>False</homogeneous>
|
||||||
<selection_mode>GTK_SELECTION_SINGLE</selection_mode>
|
<row_spacing>5</row_spacing>
|
||||||
<show_titles>True</show_titles>
|
<column_spacing>5</column_spacing>
|
||||||
<shadow_type>GTK_SHADOW_IN</shadow_type>
|
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkLabel</class>
|
<class>GtkLabel</class>
|
||||||
<child_name>CList:title</child_name>
|
<name>label235</name>
|
||||||
<name>label65</name>
|
<label>Given Name</label>
|
||||||
<label>Name</label>
|
|
||||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
<wrap>False</wrap>
|
<wrap>False</wrap>
|
||||||
<xalign>0.5</xalign>
|
<xalign>1</xalign>
|
||||||
<yalign>0.5</yalign>
|
<yalign>0.5</yalign>
|
||||||
<xpad>0</xpad>
|
<xpad>5</xpad>
|
||||||
<ypad>0</ypad>
|
<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>
|
||||||
|
|
||||||
<widget>
|
<widget>
|
||||||
<class>GtkLabel</class>
|
<class>GtkLabel</class>
|
||||||
<child_name>CList:title</child_name>
|
<name>label236</name>
|
||||||
<name>label66</name>
|
<label>Surname</label>
|
||||||
<label>Birthdate</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>
|
||||||
|
<name>given</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>0</top_attach>
|
||||||
|
<bottom_attach>1</bottom_attach>
|
||||||
|
<xpad>5</xpad>
|
||||||
|
<ypad>5</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>5</ypad>
|
||||||
|
<xexpand>True</xexpand>
|
||||||
|
<yexpand>False</yexpand>
|
||||||
|
<xshrink>False</xshrink>
|
||||||
|
<yshrink>False</yshrink>
|
||||||
|
<xfill>True</xfill>
|
||||||
|
<yfill>False</yfill>
|
||||||
|
</child>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkFrame</class>
|
||||||
|
<name>frame6</name>
|
||||||
|
<border_width>5</border_width>
|
||||||
|
<label>Relationship Type</label>
|
||||||
|
<label_xalign>0</label_xalign>
|
||||||
|
<shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>True</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkVBox</class>
|
||||||
|
<name>vbox40</name>
|
||||||
|
<homogeneous>False</homogeneous>
|
||||||
|
<spacing>0</spacing>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkCombo</class>
|
||||||
|
<name>rel_combo</name>
|
||||||
|
<border_width>5</border_width>
|
||||||
|
<value_in_list>True</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>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkEntry</class>
|
||||||
|
<child_name>GtkCombo:entry</child_name>
|
||||||
|
<name>rel_type</name>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
|
<signal>
|
||||||
|
<name>changed</name>
|
||||||
|
<handler>on_rel_type_changed</handler>
|
||||||
|
<last_modification_time>Sat, 14 Jul 2001 15:29:20 GMT</last_modification_time>
|
||||||
|
</signal>
|
||||||
|
<editable>False</editable>
|
||||||
|
<text_visible>True</text_visible>
|
||||||
|
<text_max_length>0</text_max_length>
|
||||||
|
<text></text>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkLabel</class>
|
||||||
|
<name>reldef</name>
|
||||||
|
<label>Relationship definition</label>
|
||||||
<justify>GTK_JUSTIFY_CENTER</justify>
|
<justify>GTK_JUSTIFY_CENTER</justify>
|
||||||
<wrap>False</wrap>
|
<wrap>False</wrap>
|
||||||
<xalign>0.5</xalign>
|
<xalign>0.5</xalign>
|
||||||
<yalign>0.5</yalign>
|
<yalign>0.5</yalign>
|
||||||
<xpad>0</xpad>
|
<xpad>5</xpad>
|
||||||
<ypad>0</ypad>
|
<ypad>5</ypad>
|
||||||
|
<child>
|
||||||
|
<padding>0</padding>
|
||||||
|
<expand>False</expand>
|
||||||
|
<fill>False</fill>
|
||||||
|
</child>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
@ -3267,11 +3409,11 @@
|
|||||||
<can_focus>True</can_focus>
|
<can_focus>True</can_focus>
|
||||||
<signal>
|
<signal>
|
||||||
<name>clicked</name>
|
<name>clicked</name>
|
||||||
<handler>on_select_spouse_clicked</handler>
|
<handler>on_new_spouse_clicked</handler>
|
||||||
<object>spouseDialog</object>
|
<object>spouseDialog</object>
|
||||||
<last_modification_time>Sun, 19 Nov 2000 00:52:25 GMT</last_modification_time>
|
<last_modification_time>Thu, 23 Aug 2001 21:21:10 GMT</last_modification_time>
|
||||||
</signal>
|
</signal>
|
||||||
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
|
<label>Add new person</label>
|
||||||
<relief>GTK_RELIEF_NORMAL</relief>
|
<relief>GTK_RELIEF_NORMAL</relief>
|
||||||
</widget>
|
</widget>
|
||||||
|
|
||||||
@ -3282,10 +3424,19 @@
|
|||||||
<can_focus>True</can_focus>
|
<can_focus>True</can_focus>
|
||||||
<signal>
|
<signal>
|
||||||
<name>clicked</name>
|
<name>clicked</name>
|
||||||
<handler>destroy_passed_object</handler>
|
<handler>on_select_spouse_clicked</handler>
|
||||||
<object>spouseDialog</object>
|
<object>spouseDialog</object>
|
||||||
<last_modification_time>Sun, 22 Oct 2000 20:51:13 GMT</last_modification_time>
|
<last_modification_time>Thu, 23 Aug 2001 21:21:01 GMT</last_modification_time>
|
||||||
</signal>
|
</signal>
|
||||||
|
<label>Select existing person</label>
|
||||||
|
<relief>GTK_RELIEF_NORMAL</relief>
|
||||||
|
</widget>
|
||||||
|
|
||||||
|
<widget>
|
||||||
|
<class>GtkButton</class>
|
||||||
|
<name>button117</name>
|
||||||
|
<can_default>True</can_default>
|
||||||
|
<can_focus>True</can_focus>
|
||||||
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
|
||||||
<relief>GTK_RELIEF_NORMAL</relief>
|
<relief>GTK_RELIEF_NORMAL</relief>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -123,7 +123,9 @@ ODDFGCOLOR = "oddForeground"
|
|||||||
ODDBGCOLOR = "oddBackground"
|
ODDBGCOLOR = "oddBackground"
|
||||||
EVENFGCOLOR= "evenForeground"
|
EVENFGCOLOR= "evenForeground"
|
||||||
EVENBGCOLOR= "evenBackground"
|
EVENBGCOLOR= "evenBackground"
|
||||||
|
GIVEN = "g"
|
||||||
|
SURNAME = "s"
|
||||||
|
RELTYPE = "d"
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Short hand function to return either the person's birthday, or an empty
|
# Short hand function to return either the person's birthday, or an empty
|
||||||
@ -250,15 +252,22 @@ def on_remove_child_clicked(obj):
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def on_add_sp_clicked(obj):
|
def on_add_sp_clicked(obj):
|
||||||
spouseDialog = libglade.GladeXML(const.gladeFile, "spouseDialog")
|
spouseDialog = libglade.GladeXML(const.gladeFile, "spouseDialog")
|
||||||
|
|
||||||
spouseList = spouseDialog.get_widget("spouseList")
|
spouseList = spouseDialog.get_widget("spouseList")
|
||||||
spouseDialog.get_widget("rel_combo").set_popdown_strings(const.familyRelations)
|
spouseDialog.get_widget("rel_combo").set_popdown_strings(const.familyRelations)
|
||||||
rel_type = spouseDialog.get_widget("rel_type")
|
rel_type = spouseDialog.get_widget("rel_type")
|
||||||
rel_type.set_data("d",spouseList)
|
rel_type.set_data("d",spouseList)
|
||||||
spouseDialog.get_widget("spouseDialog").set_data("d",rel_type)
|
rel_type.set_data("x",spouseDialog.get_widget("reldef"))
|
||||||
|
|
||||||
|
top = spouseDialog.get_widget("spouseDialog")
|
||||||
|
top.set_data(RELTYPE,rel_type)
|
||||||
|
top.set_data(GIVEN,spouseDialog.get_widget("given"))
|
||||||
|
top.set_data(SURNAME,spouseDialog.get_widget("surname"))
|
||||||
|
|
||||||
spouseDialog.signal_autoconnect({
|
spouseDialog.signal_autoconnect({
|
||||||
"on_spouseList_select_row" : on_spouseList_select_row,
|
"on_spouseList_select_row" : on_spouseList_select_row,
|
||||||
"on_select_spouse_clicked" : on_select_spouse_clicked,
|
"on_select_spouse_clicked" : on_select_spouse_clicked,
|
||||||
|
"on_new_spouse_clicked" : on_new_spouse_clicked,
|
||||||
"on_rel_type_changed" : on_rel_type_changed,
|
"on_rel_type_changed" : on_rel_type_changed,
|
||||||
"destroy_passed_object" : utils.destroy_passed_object
|
"destroy_passed_object" : utils.destroy_passed_object
|
||||||
})
|
})
|
||||||
@ -519,7 +528,7 @@ def on_addchild_ok_clicked(obj):
|
|||||||
|
|
||||||
# must do an apply filter here to make sure the main window gets updated
|
# must do an apply filter here to make sure the main window gets updated
|
||||||
|
|
||||||
apply_filter()
|
redisplay_person_list(person)
|
||||||
load_family()
|
load_family()
|
||||||
utils.modified()
|
utils.modified()
|
||||||
utils.destroy_passed_object(obj)
|
utils.destroy_passed_object(obj)
|
||||||
@ -1358,6 +1367,56 @@ def on_select_spouse_clicked(obj):
|
|||||||
|
|
||||||
load_family()
|
load_family()
|
||||||
|
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#
|
||||||
|
#-------------------------------------------------------------------------
|
||||||
|
def on_new_spouse_clicked(obj):
|
||||||
|
global active_spouse
|
||||||
|
global select_spouse
|
||||||
|
global active_family
|
||||||
|
|
||||||
|
select_spouse = Person()
|
||||||
|
database.addPerson(select_spouse)
|
||||||
|
name = Name()
|
||||||
|
select_spouse.setPrimaryName(name)
|
||||||
|
name.setSurname(string.strip(obj.get_data(SURNAME).get_text()))
|
||||||
|
name.setFirstName(string.strip(obj.get_data(GIVEN).get_text()))
|
||||||
|
|
||||||
|
reltype = const.save_frel(obj.get_data(RELTYPE).get_text())
|
||||||
|
if reltype == "Partners":
|
||||||
|
select_spouse.setGender(active_person.getGender())
|
||||||
|
else:
|
||||||
|
if active_person.getGender() == Person.male:
|
||||||
|
select_spouse.setGender(Person.female)
|
||||||
|
else:
|
||||||
|
select_spouse.setGender(Person.male)
|
||||||
|
|
||||||
|
utils.modified()
|
||||||
|
active_spouse = select_spouse
|
||||||
|
|
||||||
|
family = database.newFamily()
|
||||||
|
active_family = family
|
||||||
|
|
||||||
|
active_person.addFamily(family)
|
||||||
|
select_spouse.addFamily(family)
|
||||||
|
|
||||||
|
if active_person.getGender() == Person.male:
|
||||||
|
family.setMother(select_spouse)
|
||||||
|
family.setFather(active_person)
|
||||||
|
else:
|
||||||
|
family.setFather(select_spouse)
|
||||||
|
family.setMother(active_person)
|
||||||
|
|
||||||
|
family.setRelationship(const.save_frel(obj.get_data("d").get_text()))
|
||||||
|
|
||||||
|
select_spouse = None
|
||||||
|
utils.destroy_passed_object(obj)
|
||||||
|
|
||||||
|
redisplay_person_list(active_spouse)
|
||||||
|
load_family()
|
||||||
|
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
@ -1474,8 +1533,12 @@ def on_rel_type_changed(obj):
|
|||||||
spouse_list = obj.get_data("d")
|
spouse_list = obj.get_data("d")
|
||||||
spouse_list.clear()
|
spouse_list.clear()
|
||||||
spouse_list.freeze()
|
spouse_list.freeze()
|
||||||
|
deftxt = obj.get_data("x")
|
||||||
|
|
||||||
text = obj.get_text()
|
text = obj.get_text()
|
||||||
|
|
||||||
|
deftxt.set_text(const.relationship_def(text))
|
||||||
|
|
||||||
gender = active_person.getGender()
|
gender = active_person.getGender()
|
||||||
if text == _("Partners"):
|
if text == _("Partners"):
|
||||||
if gender == Person.male:
|
if gender == Person.male:
|
||||||
|
Loading…
Reference in New Issue
Block a user