2006-08-20 Alex Roitman <shura@gramps-project.org>
* src/Config/_GrampsConfigKeys.py: Regenerate file. * src/GrampsCfg.py (add_behavior_panel): Use new key. * data/gramps.schemas.in: Add default-source key. svn: r7222
This commit is contained in:
parent
5c59929c66
commit
cd50843624
@ -1,3 +1,8 @@
|
||||
2006-08-20 Alex Roitman <shura@gramps-project.org>
|
||||
* src/Config/_GrampsConfigKeys.py: Regenerate file.
|
||||
* src/GrampsCfg.py (add_behavior_panel): Use new key.
|
||||
* data/gramps.schemas.in: Add default-source key.
|
||||
|
||||
2006-08-20 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsDb/_ReadGedcom.py: fix CHAN parsing for family
|
||||
|
||||
|
@ -3,6 +3,18 @@
|
||||
<gconfschemafile>
|
||||
<schemalist>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gramps/preferences/default-source</key>
|
||||
<applyto>/apps/gramps/preferences/default-source</applyto>
|
||||
<owner>gramps</owner>
|
||||
<type>bool</type>
|
||||
<default>0</default>
|
||||
<locale name="C">
|
||||
<short>Create default source on import</short>
|
||||
<long>If True, a new source will be created and every record without source reference will be referenced to this source</long>
|
||||
</locale>
|
||||
</schema>
|
||||
|
||||
<schema>
|
||||
<key>/schemas/apps/gramps/preferences/relation-shade</key>
|
||||
<applyto>/apps/gramps/preferences/relation-shade</applyto>
|
||||
|
@ -20,6 +20,7 @@
|
||||
|
||||
# $Id$
|
||||
|
||||
DEFAULT_SOURCE = ('preferences','default-source', 0)
|
||||
RELATION_SHADE = ('preferences','relation-shade', 0)
|
||||
ONLINE_MAPS = ('preferences','online-maps', 0)
|
||||
FAMILY_DETAILS = ('preferences','family-details', 0)
|
||||
@ -75,6 +76,7 @@ WEBSITE_DIRECTORY = ('paths','website-directory', 2)
|
||||
|
||||
|
||||
default_value = {
|
||||
DEFAULT_SOURCE : False,
|
||||
RELATION_SHADE : True,
|
||||
ONLINE_MAPS : False,
|
||||
FAMILY_DETAILS : True,
|
||||
@ -96,7 +98,7 @@ default_value = {
|
||||
FILTER : False,
|
||||
FPREFIX : 'F%04d',
|
||||
EPREFIX : 'E%04d',
|
||||
RPREFIX : 'E%04d',
|
||||
RPREFIX : 'R%04d',
|
||||
IPREFIX : 'I%04d',
|
||||
OPREFIX : 'O%04d',
|
||||
PPREFIX : 'P%04d',
|
||||
@ -107,7 +109,7 @@ default_value = {
|
||||
RECENT_FILE : '',
|
||||
RECENT_IMPORT_DIR : '',
|
||||
RECENT_EXPORT_DIR : '',
|
||||
NAME_FORMAT : 0,
|
||||
NAME_FORMAT : 1,
|
||||
REPORT_DIRECTORY : './',
|
||||
RESEARCHER_ADDR : '',
|
||||
RESEARCHER_CITY : '',
|
||||
|
@ -480,11 +480,18 @@ class GrampsPreferences(ManagedWindow.ManagedWindow):
|
||||
table.set_col_spacings(6)
|
||||
table.set_row_spacings(6)
|
||||
|
||||
self.add_checkbox(table, _('Automatically load last database'), 0, Config.AUTOLOAD)
|
||||
self.add_checkbox(table, _('Enable spelling checker'), 1, Config.SPELLCHECK)
|
||||
self.add_checkbox(table, _('Display Tip of the Day'), 2, Config.USE_TIPS)
|
||||
self.add_checkbox(table, _('Download maps online'), 3, Config.ONLINE_MAPS)
|
||||
self.add_checkbox(table, _('Use shading in Relationship View'), 4, Config.RELATION_SHADE)
|
||||
self.add_checkbox(table, _('Automatically load last database'),
|
||||
0, Config.AUTOLOAD)
|
||||
self.add_checkbox(table, _('Add default source on import'),
|
||||
1, Config.DEFAULT_SOURCE)
|
||||
self.add_checkbox(table, _('Enable spelling checker'),
|
||||
2, Config.SPELLCHECK)
|
||||
self.add_checkbox(table, _('Display Tip of the Day'),
|
||||
3, Config.USE_TIPS)
|
||||
self.add_checkbox(table, _('Download maps online'),
|
||||
4, Config.ONLINE_MAPS)
|
||||
self.add_checkbox(table, _('Use shading in Relationship View'),
|
||||
5, Config.RELATION_SHADE)
|
||||
|
||||
return table
|
||||
|
||||
|
@ -69,6 +69,9 @@ from QuestionDialog import ErrorDialog, WarningDialog
|
||||
from _GrampsDbBase import EVENT_KEY
|
||||
from BasicUtils import UpdateCallback
|
||||
|
||||
# FIXME: This needs soon to become a preference setting
|
||||
use_def_src = True
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# Address/Place constants
|
||||
@ -235,7 +238,9 @@ def import2(database, filename, callback, codeset, use_trans):
|
||||
use_trans = False
|
||||
|
||||
try:
|
||||
t = time.time()
|
||||
close = g.parse_gedcom_file(use_trans)
|
||||
print time.time() - t
|
||||
except IOError,msg:
|
||||
errmsg = _("%s could not be opened\n") % filename
|
||||
ErrorDialog(errmsg,str(msg))
|
||||
@ -509,9 +514,10 @@ class GedcomParser(UpdateCallback):
|
||||
self.added = set()
|
||||
self.gedmap = GedcomInfoDB()
|
||||
self.gedsource = self.gedmap.get_from_source_tag('GEDCOM 5.5')
|
||||
self.def_src = RelLib.Source()
|
||||
fname = os.path.basename(filename).split('\\')[-1]
|
||||
self.def_src.set_title(_("Import from %s") % unicode(fname))
|
||||
if use_def_src:
|
||||
self.def_src = RelLib.Source()
|
||||
fname = os.path.basename(filename).split('\\')[-1]
|
||||
self.def_src.set_title(_("Import from %s") % unicode(fname))
|
||||
self.dir_path = os.path.dirname(filename)
|
||||
self.localref = 0
|
||||
self.placemap = {}
|
||||
@ -842,7 +848,8 @@ class GedcomParser(UpdateCallback):
|
||||
try:
|
||||
self.parse_header()
|
||||
self.parse_submitter()
|
||||
self.db.add_source(self.def_src,self.trans)
|
||||
if use_def_src:
|
||||
self.db.add_source(self.def_src,self.trans)
|
||||
self.parse_record()
|
||||
self.parse_trailer()
|
||||
except Errors.GedcomError, err:
|
||||
@ -888,7 +895,8 @@ class GedcomParser(UpdateCallback):
|
||||
if self.level_is_finished(matches,level):
|
||||
break
|
||||
elif matches[1] == TOKEN_NAME:
|
||||
self.def_src.set_author(matches[2])
|
||||
if use_def_src:
|
||||
self.def_src.set_author(matches[2])
|
||||
elif matches[1] == TOKEN_ADDR:
|
||||
self.ignore_sub_junk(level+1)
|
||||
|
||||
@ -1308,7 +1316,7 @@ class GedcomParser(UpdateCallback):
|
||||
self.db.commit_person(child, self.trans)
|
||||
|
||||
# add default reference if no reference exists
|
||||
if len(self.family.get_source_references()) == 0:
|
||||
if use_def_src and len(self.family.get_source_references()) == 0:
|
||||
sref = RelLib.SourceRef()
|
||||
sref.set_reference_handle(self.def_src.handle)
|
||||
self.family.add_source_reference(sref)
|
||||
@ -1546,7 +1554,7 @@ class GedcomParser(UpdateCallback):
|
||||
|
||||
# Add the default reference if no source has found
|
||||
|
||||
if len(self.media.get_source_references()) == 0:
|
||||
if use_def_src and len(self.media.get_source_references()) == 0:
|
||||
sref = RelLib.SourceRef()
|
||||
sref.set_reference_handle(self.def_src.handle)
|
||||
self.media.add_source_reference(sref)
|
||||
@ -1617,8 +1625,7 @@ class GedcomParser(UpdateCallback):
|
||||
func(matches, state)
|
||||
|
||||
# Add the default reference if no source has found
|
||||
|
||||
if len(self.person.get_source_references()) == 0:
|
||||
if use_def_src and len(self.person.get_source_references()) == 0:
|
||||
sref = RelLib.SourceRef()
|
||||
sref.set_reference_handle(self.def_src.handle)
|
||||
self.person.add_source_reference(sref)
|
||||
@ -2141,17 +2148,20 @@ class GedcomParser(UpdateCallback):
|
||||
elif matches[1] == TOKEN_NAME:
|
||||
pass
|
||||
elif matches[1] == TOKEN_VERS:
|
||||
self.def_src.set_data_item('Generated by',"%s %s" %
|
||||
(genby,matches[2]))
|
||||
pass
|
||||
if use_def_src:
|
||||
self.def_src.set_data_item('Generated by',"%s %s" %
|
||||
(genby,matches[2]))
|
||||
elif matches[1] == TOKEN_FILE:
|
||||
filename = os.path.basename(matches[2]).split('\\')[-1]
|
||||
self.def_src.set_title(_("Import from %s") % filename)
|
||||
if use_def_src:
|
||||
filename = os.path.basename(matches[2]).split('\\')[-1]
|
||||
self.def_src.set_title(_("Import from %s") % filename)
|
||||
elif matches[1] == TOKEN_COPR:
|
||||
self.def_src.set_publication_info(matches[2])
|
||||
if use_def_src:
|
||||
self.def_src.set_publication_info(matches[2])
|
||||
elif matches[1] == TOKEN_SUBM:
|
||||
self.parse_subm(2)
|
||||
elif matches[1] in (TOKEN_CORP, TOKEN_DATA, TOKEN_SUBN, TOKEN_LANG, TOKEN_TIME):
|
||||
elif matches[1] in (TOKEN_CORP, TOKEN_DATA, TOKEN_SUBN,
|
||||
TOKEN_LANG, TOKEN_TIME):
|
||||
self.ignore_sub_junk(2)
|
||||
elif matches[1] == TOKEN_DEST:
|
||||
if genby == "GRAMPS":
|
||||
@ -2172,9 +2182,11 @@ class GedcomParser(UpdateCallback):
|
||||
elif matches[1] == TOKEN_DATE:
|
||||
date = self.parse_date(2)
|
||||
date.date = matches[2]
|
||||
self.def_src.set_data_item('Creation date',matches[2])
|
||||
if use_def_src:
|
||||
self.def_src.set_data_item('Creation date',matches[2])
|
||||
elif matches[1] == TOKEN_NOTE:
|
||||
note = self.parse_note(matches,self.def_src,2,'')
|
||||
if use_def_src:
|
||||
note = self.parse_note(matches,self.def_src,2,'')
|
||||
elif matches[1] == TOKEN_UNKNOWN:
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
@ -2187,7 +2199,8 @@ class GedcomParser(UpdateCallback):
|
||||
if self.level_is_finished(matches, level):
|
||||
break
|
||||
elif matches[1] == TOKEN_NAME:
|
||||
self.def_src.set_author(matches[2])
|
||||
if use_def_src:
|
||||
self.def_src.set_author(matches[2])
|
||||
else:
|
||||
self.ignore_sub_junk(2)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user