2006-09-09 Don Allingham <don@gramps-project.org>

* src/GrampsDb/_ReadXML.py: remove commented out code
	* src/Editors/_EditEvent.py: handle overwriting of date text
	* src/RelLib/_DateBase.py: allow optional dropping of date text on
	serialization
	* src/RelLib/_Date.py: allow optional dropping of date text on
	serialization
	* src/RelLib/_Event.py: allow optional dropping of date text on
	serialization



svn: r7306
This commit is contained in:
Don Allingham 2006-09-09 17:10:13 +00:00
parent 52b44be3aa
commit 76cce7e656
8 changed files with 64 additions and 73 deletions

View File

@ -1,3 +1,13 @@
2006-09-09 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadXML.py: remove commented out code
* src/Editors/_EditEvent.py: handle overwriting of date text
* src/RelLib/_DateBase.py: allow optional dropping of date text on
serialization
* src/RelLib/_Date.py: allow optional dropping of date text on
serialization
* src/RelLib/_Event.py: allow optional dropping of date text on
serialization
2006-09-05 Alex Roitman <shura@gramps-project.org> 2006-09-05 Alex Roitman <shura@gramps-project.org>
* src/plugins/Verify.py: Import Errors. * src/plugins/Verify.py: Import Errors.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

@ -418,54 +418,6 @@
</variablelist> </variablelist>
</sect1> </sect1>
<sect1 id="run-1st-time">
<title>Running GRAMPS for the first time</title>
<para>The first time you run the program, GRAMPS will display the
"Getting Started" dialogs. Follow the directions that guide you through
<guilabel>Researcher information</guilabel> and <guilabel>the LDS
extensions</guilabel> sections. You should find them to be
self-explanatory.</para>
<note id="note-dialog">
<title>Dialog boxes</title>
<para>We'll make frequent reference in this manual to dialogs. A
dialog is simply a pop-up window into which you can enter
information.</para>
</note>
<para>We recommend you enter your personal information when GRAMPS
prompts you for it. GRAMPS uses this information strictly so it can
create valid GEDCOM output files (which require information about the
files' creator). If you wish, you can choose not to supply this
information, but be aware that unless and until you do, any GEDCOM files
you export will not be valid.</para>
<figure id="druid-fig">
<title>GRAMPS Getting Started Window: Researcher Information</title>
<screenshot>
<mediaobject>
<imageobject>
<imagedata fileref="figures/researcher.png" format="PNG" />
</imageobject>
<textobject>
<phrase>Shows Researcher Information Window.</phrase>
</textobject>
</mediaobject>
</screenshot>
</figure>
<tip id="preferences-tip">
<title>Entering personal information</title>
<para>This information can be entered at any time in the Preferences
dialog, under the Database/Researcher Information category.</para>
</tip>
</sect1>
<!----> <!---->
<sect1 id="choose-db-start"> <sect1 id="choose-db-start">
@ -525,6 +477,22 @@
</listitem> </listitem>
</varlistentry> </varlistentry>
<varlistentry>
<term>Tip of the day</term>
<listitem>
<para>Displays the &quot;Tip of the day&quot; dialog.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Plugin status</term>
<listitem>
<para>Use this item to display the status of any plugins you may
have added.</para>
</listitem>
</varlistentry>
<varlistentry> <varlistentry>
<term>GRAMPS home page</term> <term>GRAMPS home page</term>
@ -554,22 +522,11 @@
</varlistentry> </varlistentry>
<varlistentry> <varlistentry>
<term>Show plugin status</term> <term>About</term>
<listitem> <listitem>
<para>Use this item to display the status of any plugins you may <para>This item displays a dialog with general information about
have added.</para> the GRAMPS version you are running.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>Open example database</term>
<listitem>
<para>Select this item to load the example database that is
included in your GRAMPS package. This database is composed of
fictitious people and serves as a useful example for learning how
to work with GRAMPS.</para>
</listitem> </listitem>
</varlistentry> </varlistentry>
</variablelist> </variablelist>

View File

@ -224,6 +224,30 @@ class EditEvent(EditPrimary):
self.callback(self.obj) self.callback(self.obj)
self.close() self.close()
def data_has_changed(self):
"""
A date comparison can fail incorrectly because we have made the
decision to store entered text in the date. However, there is no
entered date when importing from a XML file, so we can get an
incorrect fail.
"""
if self.db.readonly:
return False
elif self.obj.handle:
orig = self.get_from_handle(self.obj.handle)
if orig:
cmp_obj = orig
else:
cmp_obj = self.empty_object()
return cmp(cmp_obj.serialize(True)[1:],
self.obj.serialize(True)[1:]) != 0
else:
cmp_obj = self.empty_object()
return cmp(cmp_obj.serialize(True)[1:],
self.obj.serialize()[1:]) != 0
class EditPersonEvent(EditEvent): class EditPersonEvent(EditEvent):
def __init__(self, event, dbstate, uistate, track=[], callback=None): def __init__(self, event, dbstate, uistate, track=[], callback=None):

View File

@ -162,11 +162,6 @@ def importData(database, filename, callback=None,cl=0,use_trans=False):
ErrorDialog(_("Error reading %s") % filename, ErrorDialog(_("Error reading %s") % filename,
_("The file is probably either corrupt or not a valid GRAMPS database.")) _("The file is probably either corrupt or not a valid GRAMPS database."))
return return
# except:
# if cl:
# import traceback
# traceback.print_exc()
# os._exit(1)
xml_file.close() xml_file.close()

View File

@ -135,12 +135,17 @@ class Date:
self.text = u"" self.text = u""
self.sortval = 0 self.sortval = 0
def serialize(self): def serialize(self, no_text_date=False):
""" """
Convert to a series of tuples for data storage Convert to a series of tuples for data storage
""" """
if no_text_date:
text = u''
else:
text = self.text
return (self.calendar, self.modifier, self.quality, return (self.calendar, self.modifier, self.quality,
self.dateval, self.text, self.sortval) self.dateval, text, self.sortval)
def unserialize(self, data): def unserialize(self, data):
""" """

View File

@ -53,11 +53,11 @@ class DateBase:
else: else:
self.date = Date() self.date = Date()
def serialize(self): def serialize(self, no_text_date=False):
if self.date == None or (self.date.is_empty() and not self.date.text): if self.date == None or (self.date.is_empty() and not self.date.text):
date = None date = None
else: else:
date = self.date.serialize() date = self.date.serialize(no_text_date)
return date return date
def unserialize(self,data): def unserialize(self,data):

View File

@ -76,7 +76,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
self.description = "" self.description = ""
self.type = EventType() self.type = EventType()
def serialize(self): def serialize(self, no_text_date = False):
""" """
Converts the data held in the event to a Python tuple that Converts the data held in the event to a Python tuple that
represents all the data elements. This method is used to convert represents all the data elements. This method is used to convert
@ -93,7 +93,7 @@ class Event(PrimaryObject,SourceBase,NoteBase,MediaBase,AttributeBase,
@rtype: tuple @rtype: tuple
""" """
return (self.handle, self.gramps_id, self.type.serialize(), return (self.handle, self.gramps_id, self.type.serialize(),
DateBase.serialize(self), DateBase.serialize(self, no_text_date),
self.description, self.place, self.description, self.place,
SourceBase.serialize(self), SourceBase.serialize(self),
NoteBase.serialize(self), NoteBase.serialize(self),