* src/Date.py (is_equal): Add method -- needed to compare dates
for being identical, since __cmp__ only compares the sorting value and ignores the modifiers. * src/RelLib.py (Event.are_equal, LdsOrd.are_equal): Use is_equal() method to compare dates. * src/AddrEdit.py: Use is_equal() method to compare dates. * src/EventEdit.py: Use is_equal() method to compare dates. * src/gramps.glade (date_edit): Re-order widgets, add hot keys; (event_edit, addr_edit): Remove button relief as in editPerson. svn: r3558
This commit is contained in:
19
src/Date.py
19
src/Date.py
@ -140,6 +140,24 @@ class Date:
|
||||
"""
|
||||
return cmp(self.sortval,other.sortval)
|
||||
|
||||
def is_equal(self,other):
|
||||
"""
|
||||
Return 1 if the given Date instance is the same as the present
|
||||
instance IN ALL REGARDS. Needed, because the __cmp__ only looks
|
||||
at the sorting value, and ignores the modifiers/comments.
|
||||
"""
|
||||
|
||||
if (self.calendar == other.calendar and
|
||||
self.modifier == other.modifier and
|
||||
self.quality == other.quality and
|
||||
self.dateval == other.dateval and
|
||||
self.text == other.text and
|
||||
self.sortval == other.sortval and
|
||||
self.comment == other.comment):
|
||||
return 1
|
||||
else:
|
||||
return 0
|
||||
|
||||
def __str__(self):
|
||||
"""
|
||||
Produces a string representation of the Date object. If the
|
||||
@ -447,4 +465,3 @@ class Date:
|
||||
Returns True if the date is a date range or a date span.
|
||||
"""
|
||||
return self.modifier == MOD_RANGE or self.modifier == MOD_SPAN
|
||||
|
||||
|
Reference in New Issue
Block a user