2008-02-18 Raphael Ackermann <raphael.ackermann@gmail.com>
* src/GrampsDbUtils/_GedcomParse.py: remove encode_filename() as filename is already unicode encoded. * src/GrampsDbUtils/_GrampsDbWRFactories.py: doc fix * src/GrampsDbUtils/_ReadGedcom.py: doc and pylint fixes * src/GrampsDbUtils/importdbdir.py: pep8 fix ''' --> """ * src/ArgHandler.py: in method cl_import(self, filename, format): add call filename = Utils.get_unicode_path(filename) before calling ReadGedcom._import2(...,filename,...). +pylint fixes * src/DbLoader.py: doc fix. change variable choose to choose_db_dialog svn: r10047
This commit is contained in:
parent
de5edf9f29
commit
17ce1638d2
11
ChangeLog
11
ChangeLog
@ -1,3 +1,14 @@
|
|||||||
|
2008-02-18 Raphael Ackermann <raphael.ackermann@gmail.com>
|
||||||
|
* src/GrampsDbUtils/_GedcomParse.py: remove encode_filename() as filename
|
||||||
|
is already unicode encoded.
|
||||||
|
* src/GrampsDbUtils/_GrampsDbWRFactories.py: doc fix
|
||||||
|
* src/GrampsDbUtils/_ReadGedcom.py: doc and pylint fixes
|
||||||
|
* src/GrampsDbUtils/importdbdir.py: pep8 fix ''' --> """
|
||||||
|
* src/ArgHandler.py: in method cl_import(self, filename, format): add call
|
||||||
|
filename = Utils.get_unicode_path(filename) before calling
|
||||||
|
ReadGedcom._import2(...,filename,...). +pylint fixes
|
||||||
|
* src/DbLoader.py: doc fix. change variable choose to choose_db_dialog
|
||||||
|
|
||||||
2008-02-18 Raphael Ackermann <raphael.ackermann@gmail.com>
|
2008-02-18 Raphael Ackermann <raphael.ackermann@gmail.com>
|
||||||
* src/DataViews/PersonView.py
|
* src/DataViews/PersonView.py
|
||||||
* src/ViewManager.py
|
* src/ViewManager.py
|
||||||
|
@ -224,8 +224,8 @@ class ArgHandler:
|
|||||||
print "Input file does not exist: %s" % fullpath
|
print "Input file does not exist: %s" % fullpath
|
||||||
continue
|
continue
|
||||||
elif os.path.isdir(fullpath):
|
elif os.path.isdir(fullpath):
|
||||||
ftype = const.APP_FAMTREE
|
ftype = const.APP_FAMTREE
|
||||||
fname = fullpath
|
fname = fullpath
|
||||||
elif opt_ix<len(options)-1 \
|
elif opt_ix<len(options)-1 \
|
||||||
and options[opt_ix+1][0] in ( '-f', '--format'):
|
and options[opt_ix+1][0] in ( '-f', '--format'):
|
||||||
format = options[opt_ix+1][1]
|
format = options[opt_ix+1][1]
|
||||||
@ -267,7 +267,7 @@ class ArgHandler:
|
|||||||
else:
|
else:
|
||||||
print "Will skip the output file: %s" % fullpath
|
print "Will skip the output file: %s" % fullpath
|
||||||
continue
|
continue
|
||||||
if opt_ix<len(options)-1 \
|
if opt_ix < len(options)-1 \
|
||||||
and options[opt_ix+1][0] in ( '-f', '--format'):
|
and options[opt_ix+1][0] in ( '-f', '--format'):
|
||||||
outformat = options[opt_ix+1][1]
|
outformat = options[opt_ix+1][1]
|
||||||
if outformat not in ('gedcom',
|
if outformat not in ('gedcom',
|
||||||
@ -296,17 +296,17 @@ class ArgHandler:
|
|||||||
print "Unrecognized format for output file %s" % outfname
|
print "Unrecognized format for output file %s" % outfname
|
||||||
print "Ignoring output file: %s" % outfname
|
print "Ignoring output file: %s" % outfname
|
||||||
continue
|
continue
|
||||||
self.exports.append((fullpath,outformat))
|
self.exports.append((fullpath, outformat))
|
||||||
elif option in ( '-a', '--action' ):
|
elif option in ( '-a', '--action' ):
|
||||||
action = value
|
action = value
|
||||||
if action not in ( 'check', 'summary', 'report', 'tool' ):
|
if action not in ( 'check', 'summary', 'report', 'tool' ):
|
||||||
print "Unknown action: %s. Ignoring." % action
|
print "Unknown action: %s. Ignoring." % action
|
||||||
continue
|
continue
|
||||||
options_str = ""
|
options_str = ""
|
||||||
if opt_ix<len(options)-1 \
|
if opt_ix < len(options)-1 \
|
||||||
and options[opt_ix+1][0] in ( '-p', '--options' ):
|
and options[opt_ix+1][0] in ( '-p', '--options' ):
|
||||||
options_str = options[opt_ix+1][1]
|
options_str = options[opt_ix+1][1]
|
||||||
self.actions.append((action,options_str))
|
self.actions.append((action, options_str))
|
||||||
elif option in ('-d', '--debug'):
|
elif option in ('-d', '--debug'):
|
||||||
logger = logging.getLogger(value)
|
logger = logging.getLogger(value)
|
||||||
logger.setLevel(logging.DEBUG)
|
logger.setLevel(logging.DEBUG)
|
||||||
@ -395,7 +395,7 @@ class ArgHandler:
|
|||||||
#see if not just a name of a database is given
|
#see if not just a name of a database is given
|
||||||
data = self.dbman.family_tree(self.open_gui)
|
data = self.dbman.family_tree(self.open_gui)
|
||||||
if data is not None:
|
if data is not None:
|
||||||
filename, filetype= data[0], data[1]
|
filename, filetype = data[0], data[1]
|
||||||
success = True
|
success = True
|
||||||
else:
|
else:
|
||||||
ErrorDialog(
|
ErrorDialog(
|
||||||
@ -474,15 +474,15 @@ class ArgHandler:
|
|||||||
print "Launching interactive session..."
|
print "Launching interactive session..."
|
||||||
|
|
||||||
if self.cl:
|
if self.cl:
|
||||||
for (action,options_str) in self.actions:
|
for (action, options_str) in self.actions:
|
||||||
print "Performing action: %s." % action
|
print "Performing action: %s." % action
|
||||||
if options_str:
|
if options_str:
|
||||||
print "Using options string: %s" % options_str
|
print "Using options string: %s" % options_str
|
||||||
self.cl_action(action,options_str)
|
self.cl_action(action, options_str)
|
||||||
|
|
||||||
for expt in self.exports:
|
for expt in self.exports:
|
||||||
print "Exporting: file %s, format %s." % expt
|
print "Exporting: file %s, format %s." % expt
|
||||||
self.cl_export(expt[0],expt[1])
|
self.cl_export(expt[0], expt[1])
|
||||||
|
|
||||||
print "Cleaning up."
|
print "Cleaning up."
|
||||||
# remove files in import db subdir after use
|
# remove files in import db subdir after use
|
||||||
@ -526,7 +526,7 @@ class ArgHandler:
|
|||||||
if format == 'famtree':
|
if format == 'famtree':
|
||||||
#3.x database
|
#3.x database
|
||||||
if not self.__check_db(filename):
|
if not self.__check_db(filename):
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
try:
|
try:
|
||||||
GrampsDbUtils.gramps_db_reader_factory(const.APP_FAMTREE)(
|
GrampsDbUtils.gramps_db_reader_factory(const.APP_FAMTREE)(
|
||||||
self.state.db, filename, empty)
|
self.state.db, filename, empty)
|
||||||
@ -547,10 +547,11 @@ class ArgHandler:
|
|||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
elif format == 'gedcom':
|
elif format == 'gedcom':
|
||||||
filename = os.path.normpath(os.path.abspath(filename))
|
filename = os.path.normpath(os.path.abspath(filename))
|
||||||
|
filename = Utils.get_unicode_path(filename)
|
||||||
try:
|
try:
|
||||||
# Cheating here to use default encoding
|
# Cheating here to use default encoding
|
||||||
from GrampsDbUtils._ReadGedcom import import2
|
from GrampsDbUtils._ReadGedcom import import2
|
||||||
import2(self.state.db,filename,None,"",False)
|
import2(self.state.db, filename, None, "", False)
|
||||||
except:
|
except:
|
||||||
print "Error importing %s" % filename
|
print "Error importing %s" % filename
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -565,7 +566,7 @@ class ArgHandler:
|
|||||||
import ImportGeneWeb
|
import ImportGeneWeb
|
||||||
filename = os.path.normpath(os.path.abspath(filename))
|
filename = os.path.normpath(os.path.abspath(filename))
|
||||||
try:
|
try:
|
||||||
ImportGeneWeb.importData(self.state.db,filename,None)
|
ImportGeneWeb.importData(self.state.db, filename, None)
|
||||||
except:
|
except:
|
||||||
print "Error importing %s" % filename
|
print "Error importing %s" % filename
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -575,7 +576,7 @@ class ArgHandler:
|
|||||||
import tarfile
|
import tarfile
|
||||||
archive = tarfile.open(filename)
|
archive = tarfile.open(filename)
|
||||||
for tarinfo in archive:
|
for tarinfo in archive:
|
||||||
archive.extract(tarinfo,tmpdir_path)
|
archive.extract(tarinfo, tmpdir_path)
|
||||||
archive.close()
|
archive.close()
|
||||||
except tarfile.ReadError, msg:
|
except tarfile.ReadError, msg:
|
||||||
print "Error reading archive:", msg
|
print "Error reading archive:", msg
|
||||||
@ -587,7 +588,7 @@ class ArgHandler:
|
|||||||
print "Error extracting into %s" % tmpdir_path
|
print "Error extracting into %s" % tmpdir_path
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
dbname = os.path.join(tmpdir_path,const.XMLFILE)
|
dbname = os.path.join(tmpdir_path, const.XMLFILE)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
GrampsDbUtils.gramps_db_reader_factory(const.APP_GRAMPS_XML)(
|
GrampsDbUtils.gramps_db_reader_factory(const.APP_GRAMPS_XML)(
|
||||||
@ -625,7 +626,7 @@ class ArgHandler:
|
|||||||
# Export handler
|
# Export handler
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def cl_export(self,filename,format):
|
def cl_export(self, filename, format):
|
||||||
"""
|
"""
|
||||||
Command-line export routine.
|
Command-line export routine.
|
||||||
Try to write into filename using the format.
|
Try to write into filename using the format.
|
||||||
@ -647,7 +648,7 @@ class ArgHandler:
|
|||||||
filename = os.path.normpath(os.path.abspath(filename))
|
filename = os.path.normpath(os.path.abspath(filename))
|
||||||
if filename:
|
if filename:
|
||||||
try:
|
try:
|
||||||
g = GrampsDbUtils.XmlWriter(self.state.db,None,0,1)
|
g = GrampsDbUtils.XmlWriter(self.state.db, None, 0, 1)
|
||||||
ret = g.write(filename)
|
ret = g.write(filename)
|
||||||
print "... finished writing %s" % filename
|
print "... finished writing %s" % filename
|
||||||
except:
|
except:
|
||||||
@ -702,14 +703,14 @@ class ArgHandler:
|
|||||||
# Action handler
|
# Action handler
|
||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def cl_action(self,action,options_str):
|
def cl_action(self, action, options_str):
|
||||||
"""
|
"""
|
||||||
Command-line action routine. Try to perform specified action.
|
Command-line action routine. Try to perform specified action.
|
||||||
Any errors will cause the sys.exit(1) call.
|
Any errors will cause the sys.exit(1) call.
|
||||||
"""
|
"""
|
||||||
if action == 'check':
|
if action == 'check':
|
||||||
import Check
|
import Check
|
||||||
checker = Check.CheckIntegrity(self.state.db,None,None)
|
checker = Check.CheckIntegrity(self.state.db, None, None)
|
||||||
checker.check_for_broken_family_links()
|
checker.check_for_broken_family_links()
|
||||||
checker.cleanup_missing_photos(1)
|
checker.cleanup_missing_photos(1)
|
||||||
checker.check_parent_relationships()
|
checker.check_parent_relationships()
|
||||||
@ -719,7 +720,7 @@ class ArgHandler:
|
|||||||
checker.report(1)
|
checker.report(1)
|
||||||
elif action == 'summary':
|
elif action == 'summary':
|
||||||
import Summary
|
import Summary
|
||||||
text = Summary.build_report(self.state.db,None)
|
text = Summary.build_report(self.state.db, None)
|
||||||
print text
|
print text
|
||||||
elif action == "report":
|
elif action == "report":
|
||||||
try:
|
try:
|
||||||
@ -729,7 +730,7 @@ class ArgHandler:
|
|||||||
options_str_dict = {}
|
options_str_dict = {}
|
||||||
print "Ignoring invalid options string."
|
print "Ignoring invalid options string."
|
||||||
|
|
||||||
name = options_str_dict.pop('name',None)
|
name = options_str_dict.pop('name', None)
|
||||||
if not name:
|
if not name:
|
||||||
print "Report name not given. Please use name=reportname"
|
print "Report name not given. Please use name=reportname"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -739,13 +740,12 @@ class ArgHandler:
|
|||||||
category = item[1]
|
category = item[1]
|
||||||
report_class = item[2]
|
report_class = item[2]
|
||||||
options_class = item[3]
|
options_class = item[3]
|
||||||
if category in (CATEGORY_BOOK,CATEGORY_CODE,CATEGORY_WEB):
|
if category in (CATEGORY_BOOK, CATEGORY_CODE, CATEGORY_WEB):
|
||||||
options_class(self.state.db,name,
|
options_class(self.state.db, name, category,
|
||||||
category,options_str_dict)
|
options_str_dict)
|
||||||
else:
|
else:
|
||||||
cl_report(self.state.db,name,category,
|
cl_report(self.state.db, name, category, report_class,
|
||||||
report_class,options_class,
|
options_class, options_str_dict)
|
||||||
options_str_dict)
|
|
||||||
return
|
return
|
||||||
|
|
||||||
print "Unknown report name. Available names are:"
|
print "Unknown report name. Available names are:"
|
||||||
@ -759,7 +759,7 @@ class ArgHandler:
|
|||||||
options_str_dict = {}
|
options_str_dict = {}
|
||||||
print "Ignoring invalid options string."
|
print "Ignoring invalid options string."
|
||||||
|
|
||||||
name = options_str_dict.pop('name',None)
|
name = options_str_dict.pop('name', None)
|
||||||
if not name:
|
if not name:
|
||||||
print "Tool name not given. Please use name=toolname"
|
print "Tool name not given. Please use name=toolname"
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
@ -769,8 +769,8 @@ class ArgHandler:
|
|||||||
category = item[1]
|
category = item[1]
|
||||||
tool_class = item[2]
|
tool_class = item[2]
|
||||||
options_class = item[3]
|
options_class = item[3]
|
||||||
Tool.cli_tool(self.state,name,category,
|
Tool.cli_tool(self.state, name, category, tool_class,
|
||||||
tool_class,options_class,options_str_dict)
|
options_class, options_str_dict)
|
||||||
return
|
return
|
||||||
|
|
||||||
print "Unknown tool name. Available names are:"
|
print "Unknown tool name. Available names are:"
|
||||||
|
@ -105,19 +105,18 @@ class DbLoader:
|
|||||||
if not warn_dialog.run():
|
if not warn_dialog.run():
|
||||||
return False
|
return False
|
||||||
|
|
||||||
choose = gtk.FileChooserDialog(
|
choose_db_dialog = gtk.FileChooserDialog(_('GRAMPS: Import database'),
|
||||||
_('GRAMPS: Import database'),
|
self.uistate.window,
|
||||||
self.uistate.window,
|
gtk.FILE_CHOOSER_ACTION_OPEN,
|
||||||
gtk.FILE_CHOOSER_ACTION_OPEN,
|
(gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
|
||||||
(gtk.STOCK_CANCEL,gtk.RESPONSE_CANCEL,
|
'gramps-import', gtk.RESPONSE_OK))
|
||||||
'gramps-import',gtk.RESPONSE_OK))
|
choose_db_dialog.set_local_only(False)
|
||||||
choose.set_local_only(False)
|
|
||||||
|
|
||||||
# Always add automatic (match all files) filter
|
# Always add automatic (match all files) filter
|
||||||
add_all_files_filter(choose)
|
add_all_files_filter(choose_db_dialog)
|
||||||
add_grdb_filter(choose)
|
add_grdb_filter(choose_db_dialog)
|
||||||
add_xml_filter(choose)
|
add_xml_filter(choose_db_dialog)
|
||||||
add_gedcom_filter(choose)
|
add_gedcom_filter(choose_db_dialog)
|
||||||
|
|
||||||
format_list = OPEN_FORMATS[:]
|
format_list = OPEN_FORMATS[:]
|
||||||
|
|
||||||
@ -129,12 +128,12 @@ class DbLoader:
|
|||||||
format_name = data[4]
|
format_name = data[4]
|
||||||
|
|
||||||
if not native_format:
|
if not native_format:
|
||||||
choose.add_filter(mime_filter)
|
choose_db_dialog.add_filter(mime_filter)
|
||||||
format_list.append(mime_type)
|
format_list.append(mime_type)
|
||||||
_KNOWN_FORMATS[mime_type] = format_name
|
_KNOWN_FORMATS[mime_type] = format_name
|
||||||
|
|
||||||
(box, type_selector) = format_maker(format_list)
|
(box, type_selector) = format_maker(format_list)
|
||||||
choose.set_extra_widget(box)
|
choose_db_dialog.set_extra_widget(box)
|
||||||
|
|
||||||
# Suggested folder: try last open file, import, then last export,
|
# Suggested folder: try last open file, import, then last export,
|
||||||
# then home.
|
# then home.
|
||||||
@ -142,10 +141,10 @@ class DbLoader:
|
|||||||
if len(default_dir)<=1:
|
if len(default_dir)<=1:
|
||||||
default_dir = get_default_dir()
|
default_dir = get_default_dir()
|
||||||
|
|
||||||
choose.set_current_folder(default_dir)
|
choose_db_dialog.set_current_folder(default_dir)
|
||||||
response = choose.run()
|
response = choose_db_dialog.run()
|
||||||
if response == gtk.RESPONSE_OK:
|
if response == gtk.RESPONSE_OK:
|
||||||
filename = Utils.get_unicode_path(choose.get_filename())
|
filename = Utils.get_unicode_path(choose_db_dialog.get_filename())
|
||||||
if self.check_errors(filename):
|
if self.check_errors(filename):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@ -158,15 +157,14 @@ class DbLoader:
|
|||||||
try:
|
try:
|
||||||
filetype = Mime.get_type(filename)
|
filetype = Mime.get_type(filename)
|
||||||
except RuntimeError, msg:
|
except RuntimeError, msg:
|
||||||
ErrorDialog(
|
ErrorDialog(_("Could not open file: %s") % filename,
|
||||||
_("Could not open file: %s") % filename,
|
str(msg))
|
||||||
str(msg))
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
# First we try our best formats
|
# First we try our best formats
|
||||||
if filetype in OPEN_FORMATS:
|
if filetype in OPEN_FORMATS:
|
||||||
importer = GrampsDbUtils.gramps_db_reader_factory(filetype)
|
importer = GrampsDbUtils.gramps_db_reader_factory(filetype)
|
||||||
self.do_import(choose, importer, filename)
|
self.do_import(choose_db_dialog, importer, filename)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Then we try all the known plugins
|
# Then we try all the known plugins
|
||||||
@ -175,7 +173,7 @@ class DbLoader:
|
|||||||
for (importData, mime_filter, mime_type, native_format,
|
for (importData, mime_filter, mime_type, native_format,
|
||||||
format_name) in import_list:
|
format_name) in import_list:
|
||||||
if filetype == mime_type or the_file == mime_type:
|
if filetype == mime_type or the_file == mime_type:
|
||||||
self.do_import(choose, importData, filename)
|
self.do_import(choose_db_dialog, importData, filename)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
# Finally, we give up and declare this an unknown format
|
# Finally, we give up and declare this an unknown format
|
||||||
@ -185,13 +183,15 @@ class DbLoader:
|
|||||||
'Valid types are: GRAMPS database, GRAMPS XML, '
|
'Valid types are: GRAMPS database, GRAMPS XML, '
|
||||||
'GRAMPS package, and GEDCOM.') % filetype)
|
'GRAMPS package, and GEDCOM.') % filetype)
|
||||||
|
|
||||||
choose.destroy()
|
choose_db_dialog.destroy()
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def check_errors(self, filename):
|
def check_errors(self, filename):
|
||||||
"""
|
"""
|
||||||
This methods runs common error checks and returns True if any found.
|
Run common error checks and return True if any found.
|
||||||
In this process, warning dialog can pop up.
|
|
||||||
|
In this process, a warning dialog can pop up.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
if type(filename) not in (str, unicode):
|
if type(filename) not in (str, unicode):
|
||||||
|
@ -275,8 +275,7 @@ class GedcomParser(UpdateCallback):
|
|||||||
if self.use_def_src:
|
if self.use_def_src:
|
||||||
self.def_src = gen.lib.Source()
|
self.def_src = gen.lib.Source()
|
||||||
fname = os.path.basename(filename).split('\\')[-1]
|
fname = os.path.basename(filename).split('\\')[-1]
|
||||||
self.def_src.set_title(_("Import from GEDCOM (%s)") %
|
self.def_src.set_title(_("Import from GEDCOM (%s)") % fname)
|
||||||
encode_filename(fname))
|
|
||||||
self.dir_path = os.path.dirname(filename)
|
self.dir_path = os.path.dirname(filename)
|
||||||
self.is_ftw = False
|
self.is_ftw = False
|
||||||
self.is_ancestry_com = False
|
self.is_ancestry_com = False
|
||||||
@ -4423,10 +4422,3 @@ def family_event_name(event, family, dbase):
|
|||||||
'family' : Utils.family_name(family, dbase),
|
'family' : Utils.family_name(family, dbase),
|
||||||
}
|
}
|
||||||
event.set_description(text)
|
event.set_description(text)
|
||||||
|
|
||||||
def encode_filename(name):
|
|
||||||
enc = sys.getfilesystemencoding()
|
|
||||||
if enc == "UTF-8":
|
|
||||||
return name
|
|
||||||
else:
|
|
||||||
return unicode(name, encoding=enc, errors='replace')
|
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id$
|
# $Id:_GrampsDbWRFactories.py 9912 2008-01-22 09:17:46Z acraphae $
|
||||||
|
|
||||||
"""
|
"""
|
||||||
This module contains factory methods for accessing the different
|
This module contains factory methods for accessing the different
|
||||||
@ -46,7 +46,7 @@ from gen.db import GrampsDbException
|
|||||||
from PluginUtils import import_list
|
from PluginUtils import import_list
|
||||||
|
|
||||||
def gramps_db_reader_factory(db_type):
|
def gramps_db_reader_factory(db_type):
|
||||||
"""Factory class for obtaining a Gramps database importers.
|
"""Factory class for obtaining a Gramps database importer.
|
||||||
|
|
||||||
@param db_type: the type of backend required.
|
@param db_type: the type of backend required.
|
||||||
@type db_type: one of the app_* constants in const.py
|
@type db_type: one of the app_* constants in const.py
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
#
|
#
|
||||||
|
|
||||||
# $Id$
|
# $Id:_ReadGedcom.py 9912 2008-01-22 09:17:46Z acraphae $
|
||||||
|
|
||||||
"Import from GEDCOM"
|
"Import from GEDCOM"
|
||||||
|
|
||||||
@ -84,7 +84,7 @@ def importData(database, filename, callback=None, use_trans=False):
|
|||||||
|
|
||||||
if not gramps and ansel:
|
if not gramps and ansel:
|
||||||
glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__)
|
glade_file = "%s/gedcomimport.glade" % os.path.dirname(__file__)
|
||||||
top = gtk.glade.XML(glade_file, 'encoding','gramps')
|
top = gtk.glade.XML(glade_file, 'encoding', 'gramps')
|
||||||
code = top.get_widget('codeset')
|
code = top.get_widget('codeset')
|
||||||
code.set_active(0)
|
code.set_active(0)
|
||||||
dialog = top.get_widget('encoding')
|
dialog = top.get_widget('encoding')
|
||||||
@ -103,13 +103,13 @@ def importData(database, filename, callback=None, use_trans=False):
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def import2(database, filename, callback, code_set, use_trans):
|
def import2(database, filename, callback, code_set, use_trans):
|
||||||
"""
|
"""
|
||||||
Do the actual import of data
|
Import the gedcom file.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
assert(type(code_set) == str or type(code_set) == unicode)
|
assert(type(code_set) == str or type(code_set) == unicode)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
ifile = open(filename,"rU")
|
ifile = open(filename, "rU")
|
||||||
stage_one = StageOne(ifile)
|
stage_one = StageOne(ifile)
|
||||||
stage_one.parse()
|
stage_one.parse()
|
||||||
|
|
||||||
|
@ -48,9 +48,9 @@ from BasicUtils import name_displayer
|
|||||||
#
|
#
|
||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
def importData(database, dirname, callback=None, cl=0, use_trans=True):
|
def importData(database, dirname, callback=None, cl=0, use_trans=True):
|
||||||
'''
|
"""
|
||||||
Import dbdir database in dirname into dbdir database.
|
Import dbdir database in dirname into dbdir database.
|
||||||
'''
|
"""
|
||||||
name = os.path.normpath(dirname)
|
name = os.path.normpath(dirname)
|
||||||
|
|
||||||
other_database = GrampsDBDir()
|
other_database = GrampsDBDir()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user