2006-04-20 Alex Roitman <shura@gramps-project.org>

* src/RelLib/_EventRef.py (unserialize): Avoid class constructor.
	* src/RelLib/_Person.py (unserialize): Avoid class constructor.
	* src/RelLib/_Name.py (unserialize): Avoid class constructor.
	* src/RelLib/_Repository.py (unserialize): Avoid class constructor.
	* src/RelLib/_RepoRef.py (unserialize): Avoid class constructor.
	* src/GrampsDb/_WriteXML.py: Update to export new types.



svn: r6382
This commit is contained in:
Alex Roitman 2006-04-20 18:20:55 +00:00
parent b3c5c9816a
commit 232e32b2c1
7 changed files with 18 additions and 13 deletions

View File

@ -1,3 +1,11 @@
2006-04-20 Alex Roitman <shura@gramps-project.org>
* src/RelLib/_EventRef.py (unserialize): Avoid class constructor.
* src/RelLib/_Person.py (unserialize): Avoid class constructor.
* src/RelLib/_Name.py (unserialize): Avoid class constructor.
* src/RelLib/_Repository.py (unserialize): Avoid class constructor.
* src/RelLib/_RepoRef.py (unserialize): Avoid class constructor.
* src/GrampsDb/_WriteXML.py: Update to export new types.
2006-04-19 Alex Roitman <shura@gramps-project.org> 2006-04-19 Alex Roitman <shura@gramps-project.org>
* src/Editors/_EditPrimary.py (EditPrimary.build_window_key): * src/Editors/_EditPrimary.py (EditPrimary.build_window_key):
Always have a window key, even if there is no handle. Always have a window key, even if there is no handle.

View File

@ -549,7 +549,7 @@ class XmlWriter:
return return
sp = " "*index sp = " "*index
priv_text = conf_priv(eventref) priv_text = conf_priv(eventref)
role = _ConstXML.str_for_xml(_ConstXML.event_roles,eventref.role) role = eventref.role.xml_str()
if role: if role:
role_text = ' role="%s"' % role role_text = ' role="%s"' % role
else: else:
@ -571,7 +571,7 @@ class XmlWriter:
self.write_primary_tag("event",event,2) self.write_primary_tag("event",event,2)
sp = " " * index sp = " " * index
etype = _ConstXML.str_for_xml(_ConstXML.events,event.get_type()) etype = event.get_type().xml_str()
self.g.write(' %s<type>%s</type>\n' % (sp,self.fix(etype)) ) self.g.write(' %s<type>%s</type>\n' % (sp,self.fix(etype)) )
self.write_date(event.get_date_object(),index+1) self.write_date(event.get_date_object(),index+1)
self.write_ref("place",event.get_place_handle(),index+1) self.write_ref("place",event.get_place_handle(),index+1)
@ -645,8 +645,7 @@ class XmlWriter:
if not obj: if not obj:
return return
sp = " "*index sp = " "*index
marker = _ConstXML.str_for_xml(_ConstXML.marker_types, marker = obj.get_marker().xml_str()
obj.get_marker())
if marker: if marker:
marker_text = ' marker="%s"' % marker marker_text = ' marker="%s"' % marker
else: else:
@ -663,8 +662,7 @@ class XmlWriter:
sp = " "*index sp = " "*index
self.write_primary_tag('family',family,index) self.write_primary_tag('family',family,index)
if family: if family:
rel = _ConstXML.str_for_xml(_ConstXML.family_relations, rel = family.get_relationship().xml_str()
family.get_relationship())
if rel != "": if rel != "":
self.g.write(' %s<rel type="%s"/>\n' % (sp,rel) ) self.g.write(' %s<rel type="%s"/>\n' % (sp,rel) )
@ -902,8 +900,7 @@ class XmlWriter:
else: else:
callno_text = ' callno="%s"' % reporef.call_number callno_text = ' callno="%s"' % reporef.call_number
mtype = _ConstXML.str_for_xml(_ConstXML.source_media_types, mtype = reporef.media_type.xml_str()
reporef.media_type)
if mtype: if mtype:
type_text = ' medium="%s"' % mtype type_text = ' medium="%s"' % mtype
else: else:

View File

@ -81,7 +81,7 @@ class EventRef(BaseObject,PrivacyBase,NoteBase,RefBase):
PrivacyBase.unserialize(self,privacy) PrivacyBase.unserialize(self,privacy)
NoteBase.unserialize(self,note) NoteBase.unserialize(self,note)
RefBase.unserialize(self,ref) RefBase.unserialize(self,ref)
self.role = EventRoleType(role) self.role.unserialize(role)
return self return self
def get_text_data_list(self): def get_text_data_list(self):

View File

@ -121,7 +121,7 @@ class Name(BaseObject,PrivacyBase,SourceBase,NoteBase,DateBase):
self.first_name,self.surname,self.suffix,self.title, self.first_name,self.surname,self.suffix,self.title,
name_type,self.prefix,self.patronymic,self.sname, name_type,self.prefix,self.patronymic,self.sname,
self.group_as,self.sort_as,self.display_as) = data self.group_as,self.sort_as,self.display_as) = data
self.type = NameType(name_type) self.type.unserialize(name_type)
PrivacyBase.unserialize(self,privacy) PrivacyBase.unserialize(self,privacy)
SourceBase.unserialize(self,source_list) SourceBase.unserialize(self,source_list)
NoteBase.unserialize(self,note) NoteBase.unserialize(self,note)

View File

@ -201,7 +201,7 @@ class Person(PrimaryObject,SourceBase,NoteBase,MediaBase,
person_ref_list, # 21 person_ref_list, # 21
) = data ) = data
self.marker = MarkerType(marker) self.marker.unserialize(marker)
self.primary_name.unserialize(primary_name) self.primary_name.unserialize(primary_name)
if death_ref: if death_ref:
self.death_ref = EventRef().unserialize(death_ref) self.death_ref = EventRef().unserialize(death_ref)

View File

@ -63,7 +63,7 @@ class RepoRef(BaseObject,NoteBase,RefBase):
def unserialize(self,data): def unserialize(self,data):
(note,ref,self.call_number,media_type) = data (note,ref,self.call_number,media_type) = data
self.media_type = SourceMediaType(media_type) self.media_type.unserialize(media_type)
NoteBase.unserialize(self,note) NoteBase.unserialize(self,note)
RefBase.unserialize(self,ref) RefBase.unserialize(self,ref)
return self return self

View File

@ -75,7 +75,7 @@ class Repository(PrimaryObject,NoteBase,AddressBase,UrlBase):
(self.handle, self.gramps_id, the_type, self.name, note, (self.handle, self.gramps_id, the_type, self.name, note,
address_list, urls ,self.marker, self.private) = data address_list, urls ,self.marker, self.private) = data
self.type = RepositoryType(the_type) self.type.unserialize(the_type)
NoteBase.unserialize(self,note) NoteBase.unserialize(self,note)
AddressBase.unserialize(self,address_list) AddressBase.unserialize(self,address_list)
UrlBase.unserialize(self,urls) UrlBase.unserialize(self,urls)