* 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:
Alex Roitman 2004-09-20 01:53:59 +00:00
parent 97fd0bc7d5
commit f9fb4cd962
6 changed files with 301 additions and 265 deletions

View File

@ -1,3 +1,14 @@
2004-09-19 Alex Roitman <shura@alex.neuro.umn.edu>
* 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 <dallingham@users.sourceforge.net>
* src/gramps.glade: remove button border for date editor button
* src/DateDisplay.py: fix quality prefix display

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -26449,7 +26449,7 @@ Other</property>
<widget class="GtkButton" id="date_stat">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<child>
@ -28704,7 +28704,7 @@ Other</property>
<widget class="GtkButton" id="date_stat">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="relief">GTK_RELIEF_NORMAL</property>
<property name="relief">GTK_RELIEF_NONE</property>
<property name="focus_on_click">True</property>
<child>
@ -28723,7 +28723,7 @@ Other</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
<property name="y_options">fill</property>
</packing>
</child>
</widget>
@ -30859,8 +30859,8 @@ Other</property>
<child>
<widget class="GtkLabel" id="label404">
<property name="visible">True</property>
<property name="label" translatable="yes">Calendar:</property>
<property name="use_underline">False</property>
<property name="label" translatable="yes">Calenda_r:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@ -30869,6 +30869,7 @@ Other</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">calendar_box</property>
</widget>
<packing>
<property name="padding">6</property>
@ -30906,149 +30907,89 @@ Other</property>
<property name="column_spacing">6</property>
<child>
<widget class="GtkLabel" id="label405">
<widget class="GtkLabel" id="label413">
<property name="visible">True</property>
<property name="label" translatable="yes">Year</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="label" translatable="yes">&lt;b&gt;Q_uality&lt;/b&gt;</property>
<property name="use_underline">True</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="xpad">6</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">quality_box</property>
</widget>
<packing>
<property name="left_attach">7</property>
<property name="right_attach">8</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label406">
<property name="visible">True</property>
<property name="label" translatable="yes">Month</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">6</property>
<property name="right_attach">7</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label407">
<property name="visible">True</property>
<property name="label" translatable="yes">Day</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">6</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label408">
<property name="visible">True</property>
<property name="label" translatable="yes">Year</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="left_attach">0</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label409">
<widget class="GtkComboBox" id="quality_box">
<property name="visible">True</property>
<property name="label" translatable="yes">Month</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label410">
<property name="visible">True</property>
<property name="label" translatable="yes">Day</property>
<property name="use_underline">False</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="items" translatable="yes"></property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">6</property>
<property name="y_padding">6</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label414">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;_Type&lt;/b&gt;</property>
<property name="use_underline">True</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">type_box</property>
</widget>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">8</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="type_box">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
</widget>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">8</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_padding">6</property>
<property name="y_padding">6</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label411">
<property name="visible">True</property>
@ -31074,24 +31015,75 @@ Other</property>
</child>
<child>
<widget class="GtkLabel" id="label412">
<widget class="GtkLabel" id="label410">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Second date&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="label" translatable="yes">_Day</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">start_day</property>
</widget>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">8</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label409">
<property name="visible">True</property>
<property name="label" translatable="yes">_Month</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">start_month_box</property>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label408">
<property name="visible">True</property>
<property name="label" translatable="yes">_Year</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">start_year</property>
</widget>
<packing>
<property name="left_attach">3</property>
<property name="right_attach">4</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -31119,115 +31111,6 @@ Other</property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="stop_day">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">0 0 31 1 10 10</property>
</widget>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">6</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_padding">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="stop_year">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">0 0 99999 1 10 10</property>
</widget>
<packing>
<property name="left_attach">7</property>
<property name="right_attach">8</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_padding">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label413">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Quality&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">4</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label414">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Type&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">8</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="stop_month_box">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
</widget>
<packing>
<property name="left_attach">6</property>
<property name="right_attach">7</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_padding">6</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="start_month_box">
<property name="visible">True</property>
@ -31266,36 +31149,160 @@ Other</property>
</child>
<child>
<widget class="GtkComboBox" id="quality_box">
<widget class="GtkLabel" id="label412">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Second date&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">6</property>
<property name="ypad">0</property>
</widget>
<packing>
<property name="left_attach">4</property>
<property name="right_attach">8</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label407">
<property name="visible">True</property>
<property name="label" translatable="yes">D_ay</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">stop_day</property>
</widget>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">6</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label406">
<property name="visible">True</property>
<property name="label" translatable="yes">Mo_nth</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">stop_month_box</property>
</widget>
<packing>
<property name="left_attach">6</property>
<property name="right_attach">7</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label405">
<property name="visible">True</property>
<property name="label" translatable="yes">Y_ear</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.5</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">stop_year</property>
</widget>
<packing>
<property name="left_attach">7</property>
<property name="right_attach">8</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkSpinButton" id="stop_day">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">0 0 31 1 10 10</property>
</widget>
<packing>
<property name="left_attach">5</property>
<property name="right_attach">6</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_padding">6</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="stop_month_box">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="left_attach">6</property>
<property name="right_attach">7</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_padding">6</property>
<property name="y_padding">6</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkComboBox" id="type_box">
<widget class="GtkSpinButton" id="stop_year">
<property name="visible">True</property>
<property name="items" translatable="yes"></property>
<property name="can_focus">True</property>
<property name="climb_rate">1</property>
<property name="digits">0</property>
<property name="numeric">True</property>
<property name="update_policy">GTK_UPDATE_ALWAYS</property>
<property name="snap_to_ticks">False</property>
<property name="wrap">False</property>
<property name="adjustment">0 0 99999 1 10 10</property>
</widget>
<packing>
<property name="left_attach">5</property>
<property name="left_attach">7</property>
<property name="right_attach">8</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_padding">6</property>
<property name="y_padding">6</property>
<property name="x_options">fill</property>
<property name="y_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
</widget>
@ -31315,8 +31322,8 @@ Other</property>
<child>
<widget class="GtkLabel" id="label415">
<property name="visible">True</property>
<property name="label" translatable="yes">Text comment:</property>
<property name="use_underline">False</property>
<property name="label" translatable="yes">Te_xt comment:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
@ -31325,6 +31332,7 @@ Other</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">date_text_entry</property>
</widget>
<packing>
<property name="padding">6</property>