From f9fb4cd962bfa89763d2463acd3797759a13b9b1 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Mon, 20 Sep 2004 01:53:59 +0000 Subject: [PATCH] * 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 --- ChangeLog | 11 + src/AddrEdit.py | 2 +- src/Date.py | 19 +- src/EventEdit.py | 2 +- src/RelLib.py | 4 +- src/gramps.glade | 528 ++++++++++++++++++++++++----------------------- 6 files changed, 301 insertions(+), 265 deletions(-) diff --git a/ChangeLog b/ChangeLog index 5ef634d21..e9bb04975 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-09-19 Alex Roitman + * 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. + 2004-09-19 Don Allingham * src/gramps.glade: remove button border for date editor button * src/DateDisplay.py: fix quality prefix display diff --git a/src/AddrEdit.py b/src/AddrEdit.py index bace48cad..8f6e2a7ef 100644 --- a/src/AddrEdit.py +++ b/src/AddrEdit.py @@ -235,7 +235,7 @@ class AddressEditor: def update(self,date_obj,street,city,state,country,postal,phone,note,format,priv): """Compares the data items, and updates if necessary""" - if self.addr.get_date_object() != date_obj: + if not self.addr.get_date_object().is_equal(date_obj): self.addr.set_date_object(date_obj) self.parent.lists_changed = 1 diff --git a/src/Date.py b/src/Date.py index 34b172d26..8f2d8ee09 100644 --- a/src/Date.py +++ b/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 - diff --git a/src/EventEdit.py b/src/EventEdit.py index ee3cc8b11..48e42b4ac 100644 --- a/src/EventEdit.py +++ b/src/EventEdit.py @@ -350,7 +350,7 @@ class EventEditor: self.event.set_source_reference_list(self.srcreflist) self.event.set_witness_list(self.witnesslist) - if dobj != date: + if not dobj.are_equal(date): self.event.set_date_object(date) self.parent.lists_changed = 1 diff --git a/src/RelLib.py b/src/RelLib.py index df4cb241d..d7a26965f 100644 --- a/src/RelLib.py +++ b/src/RelLib.py @@ -923,7 +923,7 @@ class Event(PrimaryObject,DataObj): if (self.name != other.name or self.place != other.place or self.description != other.description or self.cause != other.cause or self.private != other.private or - self.get_date_object() != other.get_date_object() or + (not self.get_date_object().is_equal(other.get_date_object())) or len(self.get_source_references()) != len(other.get_source_references())): return 0 @@ -1448,7 +1448,7 @@ class LdsOrd(SourceNote): self.place != other.place or self.status != other.status or self.temple != other.temple or - self.get_date_object() != other.get_date_object() or + not self.get_date_object().is_equal(other.get_date_object()) or len(self.get_source_references()) != len(other.get_source_references())): return 0 diff --git a/src/gramps.glade b/src/gramps.glade index 3379d2366..d3117bd42 100644 --- a/src/gramps.glade +++ b/src/gramps.glade @@ -26449,7 +26449,7 @@ Other True True - GTK_RELIEF_NORMAL + GTK_RELIEF_NONE True @@ -28704,7 +28704,7 @@ Other True True - GTK_RELIEF_NORMAL + GTK_RELIEF_NONE True @@ -28723,7 +28723,7 @@ Other 0 1 fill - + fill @@ -30859,8 +30859,8 @@ Other True - Calendar: - False + Calenda_r: + True False GTK_JUSTIFY_LEFT False @@ -30869,6 +30869,7 @@ Other 0.5 0 0 + calendar_box 6 @@ -30906,149 +30907,89 @@ Other 6 - + True - Year - False - False + <b>Q_uality</b> + True + True GTK_JUSTIFY_LEFT False False - 0.5 + 0 0.5 - 0 + 6 0 + quality_box - 7 - 8 - 3 - 4 - fill - - - - - - - True - Month - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 6 - 7 - 3 - 4 - fill - - - - - - - True - Day - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 5 - 6 - 3 - 4 - fill - - - - - - - True - Year - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 3 + 0 4 - 3 - 4 + 0 + 1 fill - + True - Month - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - - - 2 - 3 - 3 - 4 - fill - - - - - - - True - Day - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 + 1 - 2 - 3 - 4 + 4 + 1 + 2 + 6 + 6 + fill + fill + + + + + + True + <b>_Type</b> + True + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 6 + 0 + type_box + + + 4 + 8 + 0 + 1 fill + + + True + + + + 5 + 8 + 1 + 2 + 6 + 6 + fill + fill + + + True @@ -31074,24 +31015,75 @@ Other - + True - <b>Second date</b> - False - True + _Day + True + False GTK_JUSTIFY_LEFT False False - 0 + 0.5 0.5 - 6 + 0 0 + start_day - 4 - 8 - 2 - 3 + 1 + 2 + 3 + 4 + fill + + + + + + + True + _Month + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + start_month_box + + + 2 + 3 + 3 + 4 + fill + + + + + + + True + _Year + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + start_year + + + 3 + 4 + 3 + 4 fill @@ -31119,115 +31111,6 @@ Other - - - True - False - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 0 0 31 1 10 10 - - - 5 - 6 - 4 - 5 - 6 - - - - - - - True - False - True - 1 - 0 - True - GTK_UPDATE_ALWAYS - False - False - 0 0 99999 1 10 10 - - - 7 - 8 - 4 - 5 - 6 - - - - - - - True - <b>Quality</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 6 - 0 - - - 0 - 4 - 0 - 1 - fill - - - - - - - True - <b>Type</b> - False - True - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 6 - 0 - - - 4 - 8 - 0 - 1 - fill - - - - - - - True - - - - 6 - 7 - 4 - 5 - 6 - fill - - - True @@ -31266,36 +31149,160 @@ Other - + + True + <b>Second date</b> + False + True + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 6 + 0 + + + 4 + 8 + 2 + 3 + fill + + + + + + + True + D_ay + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + stop_day + + + 5 + 6 + 3 + 4 + fill + + + + + + + True + Mo_nth + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + stop_month_box + + + 6 + 7 + 3 + 4 + fill + + + + + + + True + Y_ear + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + stop_year + + + 7 + 8 + 3 + 4 + fill + + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 0 0 31 1 10 10 + + + 5 + 6 + 4 + 5 + 6 + + + + + + True - 1 - 4 - 1 - 2 + 6 + 7 + 4 + 5 6 - 6 - fill fill - + True - + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 0 0 99999 1 10 10 - 5 + 7 8 - 1 - 2 + 4 + 5 6 - 6 - fill - fill + @@ -31315,8 +31322,8 @@ Other True - Text comment: - False + Te_xt comment: + True False GTK_JUSTIFY_LEFT False @@ -31325,6 +31332,7 @@ Other 0.5 0 0 + date_text_entry 6