* src/Sources.py: Use get_date_object (not get_date) for source refs.
* src/ReadXML.py: Use get_date_object for source refs. * src/WriteXML.py: Use get_date_object for source refs. * src/WriteGedcom.py: Use get_date_object for sourcerefs. * src/plugins/FtmStyleAncestors.py: Use get_date_object for sourcerefs. * src/plugins/FtmStyleDescendants.py: Use get_date_object for sourcerefs. * src/plugins/NavWebPage.py: Use get_date_object for sourcerefs. * src/plugins/WebPage.py: Use get_date_object for sourcerefs. * src/RelLib.py (DateBase): Add base class for keeping Date; (MediaBase): Do not inherit from BaseObject; (Event,MediaObject,LdsOrd, Address,Name,SourceRef): Inherit all date-related methods from DateBase. svn: r4222
This commit is contained in:
parent
61a713d91d
commit
13dfeb6be8
@ -11,6 +11,18 @@
|
|||||||
Rename DataObj to PrivateObject; (People,Family,Event,MediaObject):
|
Rename DataObj to PrivateObject; (People,Family,Event,MediaObject):
|
||||||
remove get_handleholder_list, add low-level handle reference detector.
|
remove get_handleholder_list, add low-level handle reference detector.
|
||||||
|
|
||||||
|
* src/Sources.py: Use get_date_object (not get_date) for source refs.
|
||||||
|
* src/ReadXML.py: Use get_date_object for source refs.
|
||||||
|
* src/WriteXML.py: Use get_date_object for source refs.
|
||||||
|
* src/WriteGedcom.py: Use get_date_object for sourcerefs.
|
||||||
|
* src/plugins/FtmStyleAncestors.py: Use get_date_object for sourcerefs.
|
||||||
|
* src/plugins/FtmStyleDescendants.py: Use get_date_object for sourcerefs.
|
||||||
|
* src/plugins/NavWebPage.py: Use get_date_object for sourcerefs.
|
||||||
|
* src/plugins/WebPage.py: Use get_date_object for sourcerefs.
|
||||||
|
* src/RelLib.py (DateBase): Add base class for keeping Date;
|
||||||
|
(MediaBase): Do not inherit from BaseObject; (Event,MediaObject,LdsOrd,
|
||||||
|
Address,Name,SourceRef): Inherit all date-related methods from DateBase.
|
||||||
|
|
||||||
2005-03-21 Julio Sanchez <jsanchez@users.sourceforge.net>
|
2005-03-21 Julio Sanchez <jsanchez@users.sourceforge.net>
|
||||||
* src/MergeData.py: further changes to adapt to new API
|
* src/MergeData.py: further changes to adapt to new API
|
||||||
|
|
||||||
|
@ -972,7 +972,7 @@ class GrampsParser:
|
|||||||
|
|
||||||
def start_daterange(self,attrs):
|
def start_daterange(self,attrs):
|
||||||
if self.source_ref:
|
if self.source_ref:
|
||||||
dv = self.source_ref.get_date()
|
dv = self.source_ref.get_date_object()
|
||||||
elif self.ord:
|
elif self.ord:
|
||||||
dv = self.ord.get_date_object()
|
dv = self.ord.get_date_object()
|
||||||
elif self.object:
|
elif self.object:
|
||||||
@ -1026,7 +1026,7 @@ class GrampsParser:
|
|||||||
|
|
||||||
def start_dateval(self,attrs):
|
def start_dateval(self,attrs):
|
||||||
if self.source_ref:
|
if self.source_ref:
|
||||||
dv = self.source_ref.get_date()
|
dv = self.source_ref.get_date_object()
|
||||||
elif self.ord:
|
elif self.ord:
|
||||||
dv = self.ord.get_date_object()
|
dv = self.ord.get_date_object()
|
||||||
elif self.object:
|
elif self.object:
|
||||||
@ -1080,7 +1080,7 @@ class GrampsParser:
|
|||||||
|
|
||||||
def start_datestr(self,attrs):
|
def start_datestr(self,attrs):
|
||||||
if self.source_ref:
|
if self.source_ref:
|
||||||
dv = self.source_ref.get_date()
|
dv = self.source_ref.get_date_object()
|
||||||
elif self.ord:
|
elif self.ord:
|
||||||
dv = self.ord.get_date_object()
|
dv = self.ord.get_date_object()
|
||||||
elif self.object:
|
elif self.object:
|
||||||
|
@ -480,7 +480,7 @@ class SourceNote(BaseObject):
|
|||||||
"""Creates a unique instance of the current note"""
|
"""Creates a unique instance of the current note"""
|
||||||
self.note = Note(self.note.get())
|
self.note = Note(self.note.get())
|
||||||
|
|
||||||
class MediaBase(BaseObject):
|
class MediaBase:
|
||||||
"""
|
"""
|
||||||
Base class for storing media references
|
Base class for storing media references
|
||||||
"""
|
"""
|
||||||
@ -564,6 +564,85 @@ class MediaBase(BaseObject):
|
|||||||
ix = self.media_list.index(old_handle)
|
ix = self.media_list.index(old_handle)
|
||||||
self.media_list[ix] = new_handle
|
self.media_list[ix] = new_handle
|
||||||
|
|
||||||
|
class DateBase:
|
||||||
|
"""
|
||||||
|
Base class for storing date information.
|
||||||
|
"""
|
||||||
|
|
||||||
|
def __init__(self,source=None):
|
||||||
|
"""
|
||||||
|
Create a new DateBase, copying from source if not None
|
||||||
|
|
||||||
|
@param source: Object used to initialize the new object
|
||||||
|
@type source: DateBase
|
||||||
|
"""
|
||||||
|
if source:
|
||||||
|
self.date = Date.Date(source.date)
|
||||||
|
else:
|
||||||
|
self.date = None
|
||||||
|
|
||||||
|
def set_date(self, date) :
|
||||||
|
"""
|
||||||
|
Sets the date of the DateBase instance.
|
||||||
|
|
||||||
|
The date is parsed into a L{Date} instance.
|
||||||
|
|
||||||
|
@param date: String representation of a date. The locale specific
|
||||||
|
L{DateParser} is used to parse the string into a GRAMPS L{Date}
|
||||||
|
object.
|
||||||
|
@type date: str
|
||||||
|
"""
|
||||||
|
self.date = DateHandler.parser.parse(date)
|
||||||
|
|
||||||
|
def get_date(self) :
|
||||||
|
"""
|
||||||
|
Returns a string representation of the date of the DateBase instance.
|
||||||
|
|
||||||
|
This representation is based off the default date display format
|
||||||
|
determined by the locale's L{DateDisplay} instance.
|
||||||
|
|
||||||
|
@return: Returns a string representing the DateBase date
|
||||||
|
@rtype: str
|
||||||
|
"""
|
||||||
|
if self.date:
|
||||||
|
return DateHandler.displayer.display(self.date)
|
||||||
|
return u""
|
||||||
|
|
||||||
|
def get_quote_date(self) :
|
||||||
|
"""
|
||||||
|
Returns a string representation of the date of the DateBase instance.
|
||||||
|
|
||||||
|
This representation is based off the default date display format
|
||||||
|
determined by the locale's L{DateDisplay} instance. The date is
|
||||||
|
enclosed in quotes if the L{Date} is not a valid date.
|
||||||
|
|
||||||
|
@return: Returns a string representing the DateBase date
|
||||||
|
@rtype: str
|
||||||
|
"""
|
||||||
|
if self.date:
|
||||||
|
return DateHandler.displayer.quote_display(self.date)
|
||||||
|
return u""
|
||||||
|
|
||||||
|
def get_date_object(self):
|
||||||
|
"""
|
||||||
|
Returns the L{Date} object associated with the DateBase.
|
||||||
|
|
||||||
|
@return: Returns a DateBase L{Date} instance.
|
||||||
|
@rtype: L{Date}
|
||||||
|
"""
|
||||||
|
if not self.date:
|
||||||
|
self.date = Date.Date()
|
||||||
|
return self.date
|
||||||
|
|
||||||
|
def set_date_object(self,date):
|
||||||
|
"""
|
||||||
|
Sets the L{Date} object associated with the DateBase.
|
||||||
|
|
||||||
|
@param date: L{Date} instance to be assigned to the DateBase
|
||||||
|
@type date: L{Date}
|
||||||
|
"""
|
||||||
|
self.date = date
|
||||||
|
|
||||||
class PrivateObject(SourceNote):
|
class PrivateObject(SourceNote):
|
||||||
"""
|
"""
|
||||||
Same as SourceNote, plus the privacy capabilities.
|
Same as SourceNote, plus the privacy capabilities.
|
||||||
@ -1798,7 +1877,7 @@ class Family(PrimaryObject,SourceNote,MediaBase):
|
|||||||
"""
|
"""
|
||||||
self.event_list = event_list
|
self.event_list = event_list
|
||||||
|
|
||||||
class Event(PrimaryObject,PrivateObject,MediaBase):
|
class Event(PrimaryObject,PrivateObject,MediaBase,DateBase):
|
||||||
"""
|
"""
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
@ -1821,10 +1900,10 @@ class Event(PrimaryObject,PrivateObject,MediaBase):
|
|||||||
PrimaryObject.__init__(self,source)
|
PrimaryObject.__init__(self,source)
|
||||||
PrivateObject.__init__(self,source)
|
PrivateObject.__init__(self,source)
|
||||||
MediaBase.__init__(self,source)
|
MediaBase.__init__(self,source)
|
||||||
|
DateBase.__init__(self,source)
|
||||||
|
|
||||||
if source:
|
if source:
|
||||||
self.place = source.place
|
self.place = source.place
|
||||||
self.date = Date.Date(source.date)
|
|
||||||
self.description = source.description
|
self.description = source.description
|
||||||
self.name = source.name
|
self.name = source.name
|
||||||
self.cause = source.cause
|
self.cause = source.cause
|
||||||
@ -1834,7 +1913,6 @@ class Event(PrimaryObject,PrivateObject,MediaBase):
|
|||||||
self.witness = None
|
self.witness = None
|
||||||
else:
|
else:
|
||||||
self.place = ""
|
self.place = ""
|
||||||
self.date = None
|
|
||||||
self.description = ""
|
self.description = ""
|
||||||
self.name = ""
|
self.name = ""
|
||||||
self.cause = ""
|
self.cause = ""
|
||||||
@ -2100,65 +2178,6 @@ class Event(PrimaryObject,PrivateObject,MediaBase):
|
|||||||
"""
|
"""
|
||||||
return self.description
|
return self.description
|
||||||
|
|
||||||
def set_date(self, date) :
|
|
||||||
"""
|
|
||||||
Sets the date of the Event instance. The date is parsed into
|
|
||||||
a L{Date} instance.
|
|
||||||
|
|
||||||
@param date: String representation of a date. The locale specific
|
|
||||||
L{DateParser} is used to parse the string into a GRAMPS L{Date}
|
|
||||||
object.
|
|
||||||
@type date: str
|
|
||||||
"""
|
|
||||||
self.date = DateHandler.parser.parse(date)
|
|
||||||
|
|
||||||
def get_date(self) :
|
|
||||||
"""
|
|
||||||
Returns a string representation of the date of the Event instance
|
|
||||||
based off the default date display format determined by the
|
|
||||||
locale's L{DateDisplay} instance.
|
|
||||||
|
|
||||||
@return: Returns a string representing the Event's date
|
|
||||||
@rtype: str
|
|
||||||
"""
|
|
||||||
if self.date:
|
|
||||||
return DateHandler.displayer.display(self.date)
|
|
||||||
return u""
|
|
||||||
|
|
||||||
def get_quote_date(self) :
|
|
||||||
"""
|
|
||||||
Returns a string representation of the date of the Event instance
|
|
||||||
based off the default date display format determined by the
|
|
||||||
locale's L{DateDisplay} instance. The date is enclosed in
|
|
||||||
quotes if the L{Date} is not a valid date.
|
|
||||||
|
|
||||||
@return: Returns a string representing the Event's date
|
|
||||||
@rtype: str
|
|
||||||
"""
|
|
||||||
if self.date:
|
|
||||||
return DateHandler.displayer.quote_display(self.date)
|
|
||||||
return u""
|
|
||||||
|
|
||||||
def get_date_object(self):
|
|
||||||
"""
|
|
||||||
Returns the L{Date} object associated with the Event.
|
|
||||||
|
|
||||||
@return: Returns a Event's L{Date} instance.
|
|
||||||
@rtype: L{Date}
|
|
||||||
"""
|
|
||||||
if not self.date:
|
|
||||||
self.date = Date.Date()
|
|
||||||
return self.date
|
|
||||||
|
|
||||||
def set_date_object(self,date):
|
|
||||||
"""
|
|
||||||
Sets the L{Date} object associated with the Event.
|
|
||||||
|
|
||||||
@param date: L{Date} instance to be assigned to the Event
|
|
||||||
@type date: L{Date}
|
|
||||||
"""
|
|
||||||
self.date = date
|
|
||||||
|
|
||||||
class Place(PrimaryObject,SourceNote,MediaBase):
|
class Place(PrimaryObject,SourceNote,MediaBase):
|
||||||
"""
|
"""
|
||||||
Contains information related to a place, including multiple address
|
Contains information related to a place, including multiple address
|
||||||
@ -2415,7 +2434,7 @@ class Place(PrimaryObject,SourceNote,MediaBase):
|
|||||||
return [self.title,self.gramps_id,'','','','','',
|
return [self.title,self.gramps_id,'','','','','',
|
||||||
self.title.upper(), '','','','','']
|
self.title.upper(), '','','','','']
|
||||||
|
|
||||||
class MediaObject(PrimaryObject,SourceNote):
|
class MediaObject(PrimaryObject,SourceNote,DateBase):
|
||||||
"""
|
"""
|
||||||
Containter for information about an image file, including location,
|
Containter for information about an image file, including location,
|
||||||
description and privacy
|
description and privacy
|
||||||
@ -2431,6 +2450,7 @@ class MediaObject(PrimaryObject,SourceNote):
|
|||||||
"""
|
"""
|
||||||
PrimaryObject.__init__(self,source)
|
PrimaryObject.__init__(self,source)
|
||||||
SourceNote.__init__(self,source)
|
SourceNote.__init__(self,source)
|
||||||
|
DateBase.__init__(self,source)
|
||||||
|
|
||||||
self.attrlist = []
|
self.attrlist = []
|
||||||
if source:
|
if source:
|
||||||
@ -2438,7 +2458,6 @@ class MediaObject(PrimaryObject,SourceNote):
|
|||||||
self.mime = source.mime
|
self.mime = source.mime
|
||||||
self.desc = source.desc
|
self.desc = source.desc
|
||||||
self.thumb = source.thumb
|
self.thumb = source.thumb
|
||||||
self.date = Date.Date(source.date)
|
|
||||||
self.place = source.place
|
self.place = source.place
|
||||||
for attr in source.attrlist:
|
for attr in source.attrlist:
|
||||||
self.attrlist.append(Attribute(attr))
|
self.attrlist.append(Attribute(attr))
|
||||||
@ -2446,7 +2465,6 @@ class MediaObject(PrimaryObject,SourceNote):
|
|||||||
self.path = ""
|
self.path = ""
|
||||||
self.mime = ""
|
self.mime = ""
|
||||||
self.desc = ""
|
self.desc = ""
|
||||||
self.date = None
|
|
||||||
self.place = ""
|
self.place = ""
|
||||||
self.thumb = None
|
self.thumb = None
|
||||||
|
|
||||||
@ -2545,50 +2563,6 @@ class MediaObject(PrimaryObject,SourceNote):
|
|||||||
"""
|
"""
|
||||||
return self.place
|
return self.place
|
||||||
|
|
||||||
def get_date(self) :
|
|
||||||
"""
|
|
||||||
Returns a string representation of the date of the instance
|
|
||||||
based off the default date display format determined by the
|
|
||||||
locale's L{DateDisplay} instance.
|
|
||||||
|
|
||||||
@return: Returns a string representing the object's date
|
|
||||||
@rtype: str
|
|
||||||
"""
|
|
||||||
if self.date:
|
|
||||||
return DateHandler.displayer.display(self.date)
|
|
||||||
return u""
|
|
||||||
|
|
||||||
def get_date_object(self):
|
|
||||||
"""
|
|
||||||
Returns the L{Date} instance associated with the object.
|
|
||||||
|
|
||||||
@return: Returns the object's L{Date} instance.
|
|
||||||
@rtype: L{Date}
|
|
||||||
"""
|
|
||||||
if not self.date:
|
|
||||||
self.date = Date.Date()
|
|
||||||
return self.date
|
|
||||||
|
|
||||||
def set_date(self, date) :
|
|
||||||
"""
|
|
||||||
Sets the date of the object. The date is parsed into a L{Date} instance.
|
|
||||||
|
|
||||||
@param date: String representation of a date. The locale specific
|
|
||||||
L{DateParser} is used to parse the string into a GRAMPS L{Date}
|
|
||||||
object.
|
|
||||||
@type date: str
|
|
||||||
"""
|
|
||||||
self.date = DateHandler.parser.parse(date)
|
|
||||||
|
|
||||||
def set_date_object(self,date):
|
|
||||||
"""
|
|
||||||
Sets the L{Date} instance associated with the object.
|
|
||||||
|
|
||||||
@param date: L{Date} instance to be assigned to the object
|
|
||||||
@type date: L{Date}
|
|
||||||
"""
|
|
||||||
self.date = date
|
|
||||||
|
|
||||||
def set_mime_type(self,type):
|
def set_mime_type(self,type):
|
||||||
"""
|
"""
|
||||||
Sets the MIME type associated with the MediaObject
|
Sets the MIME type associated with the MediaObject
|
||||||
@ -2804,7 +2778,7 @@ class Source(PrimaryObject,MediaBase):
|
|||||||
"""returns the title abbreviation of the Source"""
|
"""returns the title abbreviation of the Source"""
|
||||||
return self.abbrev
|
return self.abbrev
|
||||||
|
|
||||||
class LdsOrd(SourceNote):
|
class LdsOrd(SourceNote,DateBase):
|
||||||
"""
|
"""
|
||||||
Class that contains information about LDS Ordinances. LDS
|
Class that contains information about LDS Ordinances. LDS
|
||||||
ordinances are similar to events, but have very specific additional
|
ordinances are similar to events, but have very specific additional
|
||||||
@ -2815,16 +2789,15 @@ class LdsOrd(SourceNote):
|
|||||||
def __init__(self,source=None):
|
def __init__(self,source=None):
|
||||||
"""Creates a LDS Ordinance instance"""
|
"""Creates a LDS Ordinance instance"""
|
||||||
SourceNote.__init__(self,source)
|
SourceNote.__init__(self,source)
|
||||||
|
DateBase.__init__(self,source)
|
||||||
|
|
||||||
if source:
|
if source:
|
||||||
self.famc = source.famc
|
self.famc = source.famc
|
||||||
self.date = Date.Date(source.date)
|
|
||||||
self.temple = source.temple
|
self.temple = source.temple
|
||||||
self.status = source.status
|
self.status = source.status
|
||||||
self.place = source.place
|
self.place = source.place
|
||||||
else:
|
else:
|
||||||
self.famc = None
|
self.famc = None
|
||||||
self.date = None
|
|
||||||
self.temple = ""
|
self.temple = ""
|
||||||
self.status = 0
|
self.status = 0
|
||||||
self.place = None
|
self.place = None
|
||||||
@ -2876,52 +2849,6 @@ class LdsOrd(SourceNote):
|
|||||||
"""Gets the status of the LDS ordinance"""
|
"""Gets the status of the LDS ordinance"""
|
||||||
return self.status
|
return self.status
|
||||||
|
|
||||||
def set_date(self, date) :
|
|
||||||
"""
|
|
||||||
Sets the date of the object. The date is parsed into a L{Date} instance.
|
|
||||||
|
|
||||||
@param date: String representation of a date. The locale specific
|
|
||||||
L{DateParser} is used to parse the string into a GRAMPS L{Date}
|
|
||||||
object.
|
|
||||||
@type date: str
|
|
||||||
"""
|
|
||||||
if not self.date:
|
|
||||||
self.date = Date.Date()
|
|
||||||
DateHandler.parser.set_date(self.date,date)
|
|
||||||
|
|
||||||
def get_date(self) :
|
|
||||||
"""
|
|
||||||
Returns a string representation of the date of the instance
|
|
||||||
based off the default date display format determined by the
|
|
||||||
locale's L{DateDisplay} instance.
|
|
||||||
|
|
||||||
@return: Returns a string representing the object's date
|
|
||||||
@rtype: str
|
|
||||||
"""
|
|
||||||
if self.date:
|
|
||||||
return DateHandler.displayer.display(self.date)
|
|
||||||
return u""
|
|
||||||
|
|
||||||
def get_date_object(self):
|
|
||||||
"""
|
|
||||||
Returns the L{Date} instance associated with the object.
|
|
||||||
|
|
||||||
@return: Returns the object's L{Date} instance.
|
|
||||||
@rtype: L{Date}
|
|
||||||
"""
|
|
||||||
if not self.date:
|
|
||||||
self.date = Date.Date()
|
|
||||||
return self.date
|
|
||||||
|
|
||||||
def set_date_object(self,date):
|
|
||||||
"""
|
|
||||||
Sets the L{Date} instance associated with the object.
|
|
||||||
|
|
||||||
@param date: L{Date} instance to be assigned to the object
|
|
||||||
@type date: L{Date}
|
|
||||||
"""
|
|
||||||
self.date = date
|
|
||||||
|
|
||||||
def set_temple(self,temple):
|
def set_temple(self,temple):
|
||||||
"""Sets the temple assocated with the ordinance"""
|
"""Sets the temple assocated with the ordinance"""
|
||||||
self.temple = temple
|
self.temple = temple
|
||||||
@ -3332,13 +3259,14 @@ class Attribute(PrivateObject):
|
|||||||
"""returns the value of the Attribute instance"""
|
"""returns the value of the Attribute instance"""
|
||||||
return self.value
|
return self.value
|
||||||
|
|
||||||
class Address(PrivateObject):
|
class Address(PrivateObject,DateBase):
|
||||||
"""Provides address information for a person"""
|
"""Provides address information for a person"""
|
||||||
|
|
||||||
def __init__(self,source=None):
|
def __init__(self,source=None):
|
||||||
"""Creates a new Address instance, copying from the source
|
"""Creates a new Address instance, copying from the source
|
||||||
if provided"""
|
if provided"""
|
||||||
PrivateObject.__init__(self,source)
|
PrivateObject.__init__(self,source)
|
||||||
|
DateBase.__init__(self,source)
|
||||||
|
|
||||||
if source:
|
if source:
|
||||||
self.street = source.street
|
self.street = source.street
|
||||||
@ -3346,7 +3274,6 @@ class Address(PrivateObject):
|
|||||||
self.state = source.state
|
self.state = source.state
|
||||||
self.country = source.country
|
self.country = source.country
|
||||||
self.postal = source.postal
|
self.postal = source.postal
|
||||||
self.date = Date.Date(source.date)
|
|
||||||
self.phone = source.phone
|
self.phone = source.phone
|
||||||
else:
|
else:
|
||||||
self.street = ""
|
self.street = ""
|
||||||
@ -3354,7 +3281,6 @@ class Address(PrivateObject):
|
|||||||
self.state = ""
|
self.state = ""
|
||||||
self.country = ""
|
self.country = ""
|
||||||
self.postal = ""
|
self.postal = ""
|
||||||
self.date = Date.Date()
|
|
||||||
self.phone = ""
|
self.phone = ""
|
||||||
|
|
||||||
def get_text_data_list(self):
|
def get_text_data_list(self):
|
||||||
@ -3379,48 +3305,6 @@ class Address(PrivateObject):
|
|||||||
check_list.append(self.note)
|
check_list.append(self.note)
|
||||||
return check_list
|
return check_list
|
||||||
|
|
||||||
def set_date(self,date):
|
|
||||||
"""
|
|
||||||
Sets the date of the object. The date is parsed into a L{Date} instance.
|
|
||||||
|
|
||||||
@param date: String representation of a date. The locale specific
|
|
||||||
L{DateParser} is used to parse the string into a GRAMPS L{Date}
|
|
||||||
object.
|
|
||||||
@type date: str
|
|
||||||
"""
|
|
||||||
self.date = DateHandler.parser.parse(date)
|
|
||||||
|
|
||||||
def get_date(self):
|
|
||||||
"""
|
|
||||||
Returns a string representation of the date of the instance
|
|
||||||
based off the default date display format determined by the
|
|
||||||
locale's L{DateDisplay} instance.
|
|
||||||
|
|
||||||
@return: Returns a string representing the object's date
|
|
||||||
@rtype: str
|
|
||||||
"""
|
|
||||||
if self.date:
|
|
||||||
return DateHandler.displayer.display(self.date)
|
|
||||||
return u""
|
|
||||||
|
|
||||||
def get_date_object(self):
|
|
||||||
"""
|
|
||||||
Returns the L{Date} instance associated with the object.
|
|
||||||
|
|
||||||
@return: Returns the object's L{Date} instance.
|
|
||||||
@rtype: L{Date}
|
|
||||||
"""
|
|
||||||
return self.date
|
|
||||||
|
|
||||||
def set_date_object(self,date):
|
|
||||||
"""
|
|
||||||
Sets the L{Date} instance associated with the object.
|
|
||||||
|
|
||||||
@param date: L{Date} instance to be assigned to the object
|
|
||||||
@type date: L{Date}
|
|
||||||
"""
|
|
||||||
self.date = date
|
|
||||||
|
|
||||||
def set_street(self,val):
|
def set_street(self,val):
|
||||||
"""sets the street portion of the Address"""
|
"""sets the street portion of the Address"""
|
||||||
self.street = val
|
self.street = val
|
||||||
@ -3469,7 +3353,7 @@ class Address(PrivateObject):
|
|||||||
"""returns the postal code of the Address"""
|
"""returns the postal code of the Address"""
|
||||||
return self.postal
|
return self.postal
|
||||||
|
|
||||||
class Name(PrivateObject):
|
class Name(PrivateObject,DateBase):
|
||||||
"""Provides name information about a person. A person may have more
|
"""Provides name information about a person. A person may have more
|
||||||
that one name throughout his or her life."""
|
that one name throughout his or her life."""
|
||||||
|
|
||||||
@ -3480,6 +3364,7 @@ class Name(PrivateObject):
|
|||||||
def __init__(self,source=None):
|
def __init__(self,source=None):
|
||||||
"""creates a new Name instance, copying from the source if provided"""
|
"""creates a new Name instance, copying from the source if provided"""
|
||||||
PrivateObject.__init__(self,source)
|
PrivateObject.__init__(self,source)
|
||||||
|
DateBase.__init__(self,source)
|
||||||
|
|
||||||
if source:
|
if source:
|
||||||
self.first_name = source.first_name
|
self.first_name = source.first_name
|
||||||
@ -3493,10 +3378,6 @@ class Name(PrivateObject):
|
|||||||
self.group_as = source.group_as
|
self.group_as = source.group_as
|
||||||
self.sort_as = source.sort_as
|
self.sort_as = source.sort_as
|
||||||
self.display_as = source.display_as
|
self.display_as = source.display_as
|
||||||
if source.date:
|
|
||||||
self.date = Date.Date(source.date)
|
|
||||||
else:
|
|
||||||
self.date = None
|
|
||||||
else:
|
else:
|
||||||
self.first_name = ""
|
self.first_name = ""
|
||||||
self.surname = ""
|
self.surname = ""
|
||||||
@ -3509,7 +3390,6 @@ class Name(PrivateObject):
|
|||||||
self.group_as = ""
|
self.group_as = ""
|
||||||
self.sort_as = self.DEF
|
self.sort_as = self.DEF
|
||||||
self.display_as = self.DEF
|
self.display_as = self.DEF
|
||||||
self.date = None
|
|
||||||
|
|
||||||
def get_text_data_list(self):
|
def get_text_data_list(self):
|
||||||
"""
|
"""
|
||||||
@ -3767,6 +3647,10 @@ class Name(PrivateObject):
|
|||||||
return False
|
return False
|
||||||
if self.get_note() != other.get_note():
|
if self.get_note() != other.get_note():
|
||||||
return False
|
return False
|
||||||
|
if (self.date and other.date and not self.date.is_equal(other.date)) \
|
||||||
|
or (self.date and not other.date) \
|
||||||
|
or (not self.date and other.date):
|
||||||
|
return False
|
||||||
if len(self.get_source_references()) != len(other.get_source_references()):
|
if len(self.get_source_references()) != len(other.get_source_references()):
|
||||||
return False
|
return False
|
||||||
index = 0
|
index = 0
|
||||||
@ -3777,65 +3661,6 @@ class Name(PrivateObject):
|
|||||||
index += 1
|
index += 1
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def set_date(self, date) :
|
|
||||||
"""
|
|
||||||
Sets the date of the L{Name} instance. The date is parsed into
|
|
||||||
a L{Date} instance.
|
|
||||||
|
|
||||||
@param date: String representation of a date. The locale specific
|
|
||||||
L{DateParser} is used to parse the string into a GRAMPS L{Date}
|
|
||||||
object.
|
|
||||||
@type date: str
|
|
||||||
"""
|
|
||||||
self.date = DateHandler.parser.parse(date)
|
|
||||||
|
|
||||||
def get_date(self) :
|
|
||||||
"""
|
|
||||||
Returns a string representation of the date of the L{Name} instance
|
|
||||||
based off the default date display format determined by the
|
|
||||||
locale's L{DateDisplay} instance.
|
|
||||||
|
|
||||||
@return: Returns a string representing the L{Name}'s date
|
|
||||||
@rtype: str
|
|
||||||
"""
|
|
||||||
if self.date:
|
|
||||||
return DateHandler.displayer.display(self.date)
|
|
||||||
return u""
|
|
||||||
|
|
||||||
def get_quote_date(self) :
|
|
||||||
"""
|
|
||||||
Returns a string representation of the date of the L{Name} instance
|
|
||||||
based off the default date display format determined by the
|
|
||||||
locale's L{DateDisplay} instance. The date is enclosed in
|
|
||||||
quotes if the L{Date} is not a valid date.
|
|
||||||
|
|
||||||
@return: Returns a string representing the L{Name}'s date
|
|
||||||
@rtype: str
|
|
||||||
"""
|
|
||||||
if self.date:
|
|
||||||
return DateHandler.displayer.quote_display(self.date)
|
|
||||||
return u""
|
|
||||||
|
|
||||||
def get_date_object(self):
|
|
||||||
"""
|
|
||||||
Returns the L{Date} object associated with the L{Name}.
|
|
||||||
|
|
||||||
@return: Returns a L{Name}'s L{Date} instance.
|
|
||||||
@rtype: L{Date}
|
|
||||||
"""
|
|
||||||
if not self.date:
|
|
||||||
self.date = Date.Date()
|
|
||||||
return self.date
|
|
||||||
|
|
||||||
def set_date_object(self,date):
|
|
||||||
"""
|
|
||||||
Sets the L{Date} object associated with the L{Name}.
|
|
||||||
|
|
||||||
@param date: L{Date} instance to be assigned to the L{Name}
|
|
||||||
@type date: L{Date}
|
|
||||||
"""
|
|
||||||
self.date = date
|
|
||||||
|
|
||||||
class Url(BaseObject):
|
class Url(BaseObject):
|
||||||
"""Contains information related to internet Uniform Resource Locators,
|
"""Contains information related to internet Uniform Resource Locators,
|
||||||
allowing gramps to store information about internet resources"""
|
allowing gramps to store information about internet resources"""
|
||||||
@ -3966,17 +3791,17 @@ class Witness(BaseObject):
|
|||||||
def get_comment(self):
|
def get_comment(self):
|
||||||
return self.comment
|
return self.comment
|
||||||
|
|
||||||
class SourceRef(BaseObject):
|
class SourceRef(BaseObject,DateBase):
|
||||||
"""Source reference, containing detailed information about how a
|
"""Source reference, containing detailed information about how a
|
||||||
referenced source relates to it"""
|
referenced source relates to it"""
|
||||||
|
|
||||||
def __init__(self,source=None):
|
def __init__(self,source=None):
|
||||||
"""creates a new SourceRef, copying from the source if present"""
|
"""creates a new SourceRef, copying from the source if present"""
|
||||||
|
DateBase.__init__(self,source)
|
||||||
if source:
|
if source:
|
||||||
self.confidence = source.confidence
|
self.confidence = source.confidence
|
||||||
self.ref = source.ref
|
self.ref = source.ref
|
||||||
self.page = source.page
|
self.page = source.page
|
||||||
self.date = Date.Date(source.date)
|
|
||||||
self.comments = Note(source.comments.get())
|
self.comments = Note(source.comments.get())
|
||||||
self.text = source.text
|
self.text = source.text
|
||||||
self.private = source.private
|
self.private = source.private
|
||||||
@ -3984,7 +3809,6 @@ class SourceRef(BaseObject):
|
|||||||
self.confidence = CONF_NORMAL
|
self.confidence = CONF_NORMAL
|
||||||
self.ref = None
|
self.ref = None
|
||||||
self.page = ""
|
self.page = ""
|
||||||
self.date = Date.Date()
|
|
||||||
self.comments = Note()
|
self.comments = Note()
|
||||||
self.text = ""
|
self.text = ""
|
||||||
self.private = False
|
self.private = False
|
||||||
@ -4042,14 +3866,6 @@ class SourceRef(BaseObject):
|
|||||||
"""returns the Source instance to which the SourceRef refers"""
|
"""returns the Source instance to which the SourceRef refers"""
|
||||||
return self.ref
|
return self.ref
|
||||||
|
|
||||||
def set_date(self,date):
|
|
||||||
"""sets the Date instance of the SourceRef"""
|
|
||||||
self.date = date
|
|
||||||
|
|
||||||
def get_date(self):
|
|
||||||
"""returns the Date instance of the SourceRef"""
|
|
||||||
return self.date
|
|
||||||
|
|
||||||
def set_page(self,page):
|
def set_page(self,page):
|
||||||
"""sets the page indicator of the SourceRef"""
|
"""sets the page indicator of the SourceRef"""
|
||||||
self.page = page
|
self.page = page
|
||||||
@ -4083,7 +3899,10 @@ class SourceRef(BaseObject):
|
|||||||
if self.ref and other.ref:
|
if self.ref and other.ref:
|
||||||
if self.page != other.page:
|
if self.page != other.page:
|
||||||
return False
|
return False
|
||||||
if self.date != other.date:
|
if (self.date and other.date and \
|
||||||
|
not self.date.is_equal(other.date)) \
|
||||||
|
or (self.date and not other.date) \
|
||||||
|
or (not self.date and other.date):
|
||||||
return False
|
return False
|
||||||
if self.get_text() != other.get_text():
|
if self.get_text() != other.get_text():
|
||||||
return False
|
return False
|
||||||
|
@ -404,7 +404,7 @@ class SourceEditor:
|
|||||||
if self.source_ref:
|
if self.source_ref:
|
||||||
handle = self.source_ref.get_base_handle()
|
handle = self.source_ref.get_base_handle()
|
||||||
self.active_source = self.db.get_source_from_handle(handle)
|
self.active_source = self.db.get_source_from_handle(handle)
|
||||||
self.date_obj = self.source_ref.get_date()
|
self.date_obj = self.source_ref.get_date_object()
|
||||||
self.date_entry_field.set_text(DateHandler.displayer.display(self.date_obj))
|
self.date_entry_field.set_text(DateHandler.displayer.display(self.date_obj))
|
||||||
self.private.set_active(self.source_ref.get_privacy())
|
self.private.set_active(self.source_ref.get_privacy())
|
||||||
else:
|
else:
|
||||||
@ -548,7 +548,7 @@ class SourceEditor:
|
|||||||
buf.get_end_iter(),False))
|
buf.get_end_iter(),False))
|
||||||
|
|
||||||
self.source_ref.set_page(page)
|
self.source_ref.set_page(page)
|
||||||
self.source_ref.set_date(self.date_obj)
|
self.source_ref.set_date_object(self.date_obj)
|
||||||
self.source_ref.set_text(text)
|
self.source_ref.set_text(text)
|
||||||
self.source_ref.set_comments(comments)
|
self.source_ref.set_comments(comments)
|
||||||
self.source_ref.set_confidence_level(conf)
|
self.source_ref.set_confidence_level(conf)
|
||||||
|
@ -1161,12 +1161,12 @@ class GedcomWriter:
|
|||||||
self.write_long_text("PAGE",level+1,self.cnvtxt(ref.get_page()))
|
self.write_long_text("PAGE",level+1,self.cnvtxt(ref.get_page()))
|
||||||
|
|
||||||
ref_text = ref.get_text()
|
ref_text = ref.get_text()
|
||||||
if ref_text != "" or not ref.get_date().is_empty():
|
if ref_text != "" or not ref.get_date_object().is_empty():
|
||||||
self.writeln('%d DATA' % (level+1))
|
self.writeln('%d DATA' % (level+1))
|
||||||
if ref_text != "":
|
if ref_text != "":
|
||||||
self.write_long_text("TEXT",level+2,self.cnvtxt(ref_text))
|
self.write_long_text("TEXT",level+2,self.cnvtxt(ref_text))
|
||||||
pfx = "%d DATE" % (level+2)
|
pfx = "%d DATE" % (level+2)
|
||||||
self.print_date(pfx,ref.get_date())
|
self.print_date(pfx,ref.get_date_object())
|
||||||
else:
|
else:
|
||||||
# We put title, page, and date on the SOUR line.
|
# We put title, page, and date on the SOUR line.
|
||||||
# Not using CONC and CONT because GeneWeb does not support these.
|
# Not using CONC and CONT because GeneWeb does not support these.
|
||||||
@ -1181,8 +1181,8 @@ class GedcomWriter:
|
|||||||
if ref.get_page():
|
if ref.get_page():
|
||||||
txt = txt + ref.get_page() + ". "
|
txt = txt + ref.get_page() + ". "
|
||||||
self.g.write("%d SOUR %s" % (level,self.cnvtxt(txt)))
|
self.g.write("%d SOUR %s" % (level,self.cnvtxt(txt)))
|
||||||
if not ref.get_date().is_empty():
|
if not ref.get_date_object().is_empty():
|
||||||
self.print_date("", ref.get_date())
|
self.print_date("", ref.get_date_object())
|
||||||
else:
|
else:
|
||||||
self.writeln("")
|
self.writeln("")
|
||||||
if ref.get_text():
|
if ref.get_text():
|
||||||
|
@ -541,7 +541,7 @@ class XmlWriter:
|
|||||||
p = source_ref.get_page()
|
p = source_ref.get_page()
|
||||||
c = source_ref.get_comments()
|
c = source_ref.get_comments()
|
||||||
t = source_ref.get_text()
|
t = source_ref.get_text()
|
||||||
d = source_ref.get_date()
|
d = source_ref.get_date_object()
|
||||||
q = source_ref.get_confidence_level()
|
q = source_ref.get_confidence_level()
|
||||||
self.g.write(" " * index)
|
self.g.write(" " * index)
|
||||||
if p == "" and c == "" and t == "" and d.is_empty() and q == 2:
|
if p == "" and c == "" and t == "" and d.is_empty() and q == 2:
|
||||||
|
@ -153,7 +153,7 @@ class FtmAncestorReport(Report.Report):
|
|||||||
self.doc.write_text(base.get_title())
|
self.doc.write_text(base.get_title())
|
||||||
|
|
||||||
for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(),
|
for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(),
|
||||||
dd.display(srcref.get_date()),]:
|
dd.display(srcref.get_date_object()),]:
|
||||||
if item:
|
if item:
|
||||||
self.doc.write_text('; %s' % item)
|
self.doc.write_text('; %s' % item)
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ class FtmDescendantReport(Report.Report):
|
|||||||
self.doc.write_text(base.get_title())
|
self.doc.write_text(base.get_title())
|
||||||
|
|
||||||
for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(),
|
for item in [ base.get_author(), base.get_publication_info(), base.get_abbreviation(),
|
||||||
dd.display(srcref.get_date()),]:
|
dd.display(srcref.get_date_object()),]:
|
||||||
if item:
|
if item:
|
||||||
self.doc.write_text('; %s' % item)
|
self.doc.write_text('; %s' % item)
|
||||||
|
|
||||||
|
@ -549,7 +549,7 @@ class IndividualPage(BasePage):
|
|||||||
author = source.get_author()
|
author = source.get_author()
|
||||||
title = source.get_title()
|
title = source.get_title()
|
||||||
publisher = source.get_publication_info()
|
publisher = source.get_publication_info()
|
||||||
date = _dd.display(sref.get_date())
|
date = _dd.display(sref.get_date_object())
|
||||||
of.write('<tr><td class="field">%d. ' % index)
|
of.write('<tr><td class="field">%d. ' % index)
|
||||||
values = []
|
values = []
|
||||||
if author:
|
if author:
|
||||||
|
@ -233,7 +233,7 @@ class IndividualPage:
|
|||||||
self.write_info(base.get_title())
|
self.write_info(base.get_title())
|
||||||
self.write_info(base.get_author())
|
self.write_info(base.get_author())
|
||||||
self.write_info(base.get_publication_info())
|
self.write_info(base.get_publication_info())
|
||||||
self.write_info(DateHandler.displayer.display(sref.get_date()))
|
self.write_info(DateHandler.displayer.display(sref.get_date_object()))
|
||||||
self.write_info(sref.get_page())
|
self.write_info(sref.get_page())
|
||||||
if self.usecomments:
|
if self.usecomments:
|
||||||
self.write_info(sref.get_text())
|
self.write_info(sref.get_text())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user